Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: remove lodash #678

Merged
merged 3 commits into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/components/color-picker/ColorPicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const colorMode = useColorMode()

// Computed

const primaryColors = computed(() => useWithout(appConfig.ui.colors, 'primary').map(color => ({ value: color, text: color, hex: colors[color][colorMode.value === 'dark' ? 400 : 500] })))
const primaryColors = computed(() => appConfig.ui.colors.filter(color => color !== 'primary').map(color => ({ value: color, text: color, hex: colors[color][colorMode.value === 'dark' ? 400 : 500] })))
const primary = computed({
get () {
return primaryColors.value.find(option => option.value === appConfig.ui.primary)
Expand Down
13 changes: 7 additions & 6 deletions docs/components/content/ComponentCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
import { transformContent } from '@nuxt/content/transformers'
// @ts-ignore
import { useShikiHighlighter } from '@nuxtjs/mdc/runtime'
import { upperFirst, camelCase, kebabCase } from 'scule'

// eslint-disable-next-line vue/no-dupe-keys
const props = defineProps({
Expand Down Expand Up @@ -116,8 +117,8 @@ const appConfig = useAppConfig()
const route = useRoute()
// eslint-disable-next-line vue/no-dupe-keys
const slug = props.slug || route.params.slug[route.params.slug.length - 1]
const camelName = useCamelCase(slug)
const name = `U${useUpperFirst(camelName)}`
const camelName = camelCase(slug)
const name = `U${upperFirst(camelName)}`

const meta = await fetchComponentMeta(name)

Expand All @@ -140,8 +141,8 @@ const propsToSelect = computed(() => Object.keys(componentProps).map((key) => {
}

const prop = meta?.meta?.props?.find((prop: any) => prop.name === key)
const dottedKey = useKebabCase(key).replaceAll('-', '.')
const keys = useGet(ui.value, dottedKey, {})
const dottedKey = kebabCase(key).replaceAll('-', '.')
const keys = ui.value[dottedKey] ?? {}
let options = typeof keys === 'object' && Object.keys(keys)
if (key.toLowerCase().endsWith('color')) {
// @ts-ignore
Expand All @@ -151,7 +152,7 @@ const propsToSelect = computed(() => Object.keys(componentProps).map((key) => {
return {
type: prop?.type || 'string',
name: key,
label: key === 'modelValue' ? 'value' : useCamelCase(key),
label: key === 'modelValue' ? 'value' : camelCase(key),
options
}
}).filter(Boolean))
Expand All @@ -165,7 +166,7 @@ const code = computed(() => {
continue
}

code += ` ${(typeof value === 'boolean' && value !== true) || typeof value === 'object' || typeof value === 'number' ? ':' : ''}${key === 'modelValue' ? 'value' : useKebabCase(key)}${typeof value === 'boolean' && !!value && key !== 'modelValue' ? '' : `="${typeof value === 'object' ? renderObject(value) : value}"`}`
code += ` ${(typeof value === 'boolean' && value !== true) || typeof value === 'object' || typeof value === 'number' ? ':' : ''}${key === 'modelValue' ? 'value' : kebabCase(key)}${typeof value === 'boolean' && !!value && key !== 'modelValue' ? '' : `="${typeof value === 'object' ? renderObject(value) : value}"`}`
}

if (props.slots) {
Expand Down
5 changes: 3 additions & 2 deletions docs/components/content/ComponentPreset.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<script setup lang="ts">
// @ts-expect-error
import { transformContent } from '@nuxt/content/transformers'
import { upperFirst, camelCase } from 'scule'

const props = defineProps({
slug: {
Expand All @@ -17,8 +18,8 @@ const appConfig = useAppConfig()
const route = useRoute()
// eslint-disable-next-line vue/no-dupe-keys
const slug = props.slug || route.params.slug[route.params.slug.length - 1]
const camelName = useCamelCase(slug)
const name = `U${useUpperFirst(camelName)}`
const camelName = camelCase(slug)
const name = `U${upperFirst(camelName)}`

const preset = appConfig.ui[camelName]

Expand Down
6 changes: 4 additions & 2 deletions docs/components/content/ComponentProps.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
</template>

<script setup lang="ts">
import { upperFirst, camelCase } from 'scule'

const props = defineProps({
slug: {
type: String,
Expand All @@ -17,8 +19,8 @@ const props = defineProps({
const route = useRoute()
// eslint-disable-next-line vue/no-dupe-keys
const slug = props.slug || route.params.slug[route.params.slug.length - 1]
const camelName = useCamelCase(slug)
const name = `U${useUpperFirst(camelName)}`
const camelName = camelCase(slug)
const name = `U${upperFirst(camelName)}`

const meta = await fetchComponentMeta(name)
</script>
6 changes: 4 additions & 2 deletions docs/components/content/ComponentSlots.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
</template>

<script setup lang="ts">
import { upperFirst, camelCase } from 'scule'

const props = defineProps({
slug: {
type: String,
Expand All @@ -28,8 +30,8 @@ const props = defineProps({
const route = useRoute()
// eslint-disable-next-line vue/no-dupe-keys
const slug = props.slug || route.params.slug[route.params.slug.length - 1]
const camelName = useCamelCase(slug)
const name = `U${useUpperFirst(camelName)}`
const camelName = camelCase(slug)
const name = `U${upperFirst(camelName)}`

const meta = await fetchComponentMeta(name)
</script>
3 changes: 1 addition & 2 deletions docs/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ export default defineNuxtConfig({
'@nuxtjs/google-fonts',
'@nuxtjs/plausible',
'@vueuse/nuxt',
'nuxt-component-meta',
'nuxt-lodash'
'nuxt-component-meta'
],
runtimeConfig: {
public: {
Expand Down
3 changes: 1 addition & 2 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"@nuxt/content": "^2.8.2",
"@nuxt/devtools": "^0.8.3",
"@nuxt/eslint-config": "^0.2.0",
"@nuxthq/elements": "npm:@nuxthq/[email protected]28241821.23b95ff",
"@nuxthq/elements": "npm:@nuxthq/[email protected]28245159.d523b38",
"@nuxthq/studio": "^0.14.1",
"@nuxtjs/fontaine": "^0.4.1",
"@nuxtjs/google-fonts": "^3.0.2",
Expand All @@ -20,7 +20,6 @@
"joi": "^17.10.1",
"nuxt": "^3.7.1",
"nuxt-component-meta": "^0.5.3",
"nuxt-lodash": "^2.5.0",
"nuxt-og-image": "^2.0.25",
"typescript": "^5.2.2",
"ufo": "^1.3.0",
Expand Down
90 changes: 60 additions & 30 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading