@meistrari/tela-build 1.9.0 → 1.9.2
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/components/tela/chat/text-message/index.vue +1 -0
- package/components/tela/complex-table/complex-table-cell.vue +1 -1
- package/components/tela/disclaimer/disclaimer.stories.ts +6 -6
- package/components/tela/icon/custom.vue +1 -1
- package/components/tela/multiple-select/multiple-select.vue +2 -1
- package/components/tela/popover/popover.stories.ts +1 -1
- package/components/tela/range-calendar.stories.ts +1 -1
- package/components/tela/select-menu/select-menu-content.vue +1 -1
- package/components/tela/status/status.vue +1 -1
- package/composables/status-toast.ts +3 -0
- package/lib/doc-generator.ts +19 -11
- package/lib/type-resolver.ts +7 -4
- package/nuxt.config.ts +5 -1
- package/package.json +1 -1
- package/plugins/test-id.ts +4 -2
- package/types/nuxt-macros.d.ts +13 -0
- package/types/template-globals.d.ts +11 -0
- package/unocss.config.ts +1 -1
- package/utils/select-menu.ts +2 -0
|
@@ -48,14 +48,14 @@ const meta = {
|
|
|
48
48
|
autoHideDelay: 86400000,
|
|
49
49
|
showCloseButton: true,
|
|
50
50
|
},
|
|
51
|
-
} satisfies Meta<
|
|
51
|
+
} satisfies Meta<any>
|
|
52
52
|
|
|
53
53
|
export default meta
|
|
54
54
|
|
|
55
|
-
type Story = StoryObj<
|
|
55
|
+
type Story = StoryObj<any>
|
|
56
56
|
|
|
57
57
|
export const Default: Story = {
|
|
58
|
-
render: args => ({
|
|
58
|
+
render: (args: any) => ({
|
|
59
59
|
components: { Disclaimer },
|
|
60
60
|
setup() {
|
|
61
61
|
return { args }
|
|
@@ -70,7 +70,7 @@ export const WithAutoHideDemo: Story = {
|
|
|
70
70
|
description: 'Watch this disclaimer disappear automatically after the timeout.',
|
|
71
71
|
autoHideDelay: 5000,
|
|
72
72
|
},
|
|
73
|
-
render: args => ({
|
|
73
|
+
render: (args: any) => ({
|
|
74
74
|
components: { Disclaimer },
|
|
75
75
|
setup() {
|
|
76
76
|
return { args }
|
|
@@ -86,7 +86,7 @@ export const WithoutAutoHide: Story = {
|
|
|
86
86
|
autoHide: false,
|
|
87
87
|
icon: 'i-ph-info',
|
|
88
88
|
},
|
|
89
|
-
render: args => ({
|
|
89
|
+
render: (args: any) => ({
|
|
90
90
|
components: { Disclaimer },
|
|
91
91
|
setup() {
|
|
92
92
|
return { args }
|
|
@@ -105,7 +105,7 @@ export const WithoutCloseButton: Story = {
|
|
|
105
105
|
showCloseButton: false,
|
|
106
106
|
icon: 'i-ph-warning',
|
|
107
107
|
},
|
|
108
|
-
render: args => ({
|
|
108
|
+
render: (args: any) => ({
|
|
109
109
|
components: { Disclaimer },
|
|
110
110
|
setup() {
|
|
111
111
|
return { args }
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
} from 'radix-vue'
|
|
15
15
|
import { nextTick } from 'vue'
|
|
16
16
|
import PopoverList from '../popover-list/popover-list.vue'
|
|
17
|
+
import { useI18n } from 'vue-i18n'
|
|
17
18
|
|
|
18
19
|
const props = withDefaults(defineProps<{
|
|
19
20
|
modelValue?: string[]
|
|
@@ -50,7 +51,7 @@ const emit = defineEmits<{
|
|
|
50
51
|
'blur': []
|
|
51
52
|
}>()
|
|
52
53
|
|
|
53
|
-
const { t } =
|
|
54
|
+
const { t } = useI18n()
|
|
54
55
|
|
|
55
56
|
type SelectMenuOption = {
|
|
56
57
|
value: string
|
|
@@ -4,7 +4,7 @@ import Popover from './popover.vue'
|
|
|
4
4
|
import PopoverTrigger from './popover-trigger.vue'
|
|
5
5
|
import PopoverContent from './popover-content.vue'
|
|
6
6
|
|
|
7
|
-
const meta: Meta<
|
|
7
|
+
const meta: Meta<any> = {
|
|
8
8
|
title: 'Core/Popover',
|
|
9
9
|
component: Popover,
|
|
10
10
|
subcomponents: { PopoverTrigger, PopoverContent },
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
2
|
import TelaRangeCalendar from './range-calendar.vue'
|
|
3
3
|
|
|
4
|
-
const meta: Meta<
|
|
4
|
+
const meta: Meta<any> = {
|
|
5
5
|
title: 'Tela/RangeCalendar',
|
|
6
6
|
component: TelaRangeCalendar,
|
|
7
7
|
tags: ['autodocs'],
|
|
@@ -71,7 +71,7 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits)
|
|
|
71
71
|
|
|
72
72
|
<style>
|
|
73
73
|
.SelectContent {
|
|
74
|
-
width: var(--reka-select-trigger-width);
|
|
74
|
+
min-width: var(--reka-select-trigger-width);
|
|
75
75
|
transform-origin: var(--reka-select-content-transform-origin);
|
|
76
76
|
|
|
77
77
|
&[data-state="open"] {
|
package/lib/doc-generator.ts
CHANGED
|
@@ -59,7 +59,7 @@ export async function collectComponentDocs(layerPath: string, appRootDir?: strin
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
// Initialize type resolver for the project (used to format types in markdown)
|
|
62
|
-
const typeResolver = await getTypeResolver(layerPath
|
|
62
|
+
const typeResolver = await getTypeResolver(layerPath)
|
|
63
63
|
|
|
64
64
|
// Prepare Volar extractor once (optional)
|
|
65
65
|
let volar: VolarExtractor | null = null
|
|
@@ -262,7 +262,7 @@ export async function parseMdxFile(mdxPath: string): Promise<StoryDoc | undefine
|
|
|
262
262
|
|
|
263
263
|
// Extract title from the main heading
|
|
264
264
|
const titleMatch = content.match(/^#\s+(.+)$/m)
|
|
265
|
-
const title = titleMatch
|
|
265
|
+
const title = titleMatch?.[1] ?? ''
|
|
266
266
|
|
|
267
267
|
// Extract code examples from ```vue blocks with better heading detection
|
|
268
268
|
const examples: any[] = []
|
|
@@ -271,8 +271,11 @@ export async function parseMdxFile(mdxPath: string): Promise<StoryDoc | undefine
|
|
|
271
271
|
|
|
272
272
|
for (let i = 0; i < matches.length; i++) {
|
|
273
273
|
const match = matches[i]
|
|
274
|
-
const codeContent = match[1]
|
|
275
|
-
const codeBlockStart = match
|
|
274
|
+
const codeContent = match?.[1]?.trim()
|
|
275
|
+
const codeBlockStart = match?.index
|
|
276
|
+
if (!codeContent || codeBlockStart === undefined) {
|
|
277
|
+
continue
|
|
278
|
+
}
|
|
276
279
|
|
|
277
280
|
// Find the closest heading before this code block
|
|
278
281
|
const beforeCode = content.substring(0, codeBlockStart)
|
|
@@ -302,18 +305,22 @@ function findClosestHeading(textBeforeCode: string, exampleIndex: number): strin
|
|
|
302
305
|
|
|
303
306
|
// Look for headings starting from the end (closest to code block)
|
|
304
307
|
for (let i = lines.length - 1; i >= 0; i--) {
|
|
305
|
-
const
|
|
308
|
+
const rawLine = lines[i]
|
|
309
|
+
if (!rawLine) {
|
|
310
|
+
continue
|
|
311
|
+
}
|
|
312
|
+
const line = rawLine.trim()
|
|
306
313
|
|
|
307
314
|
// Check for markdown headings (### or ####)
|
|
308
315
|
const headingMatch = line.match(/^###?\s+(.+)/)
|
|
309
316
|
if (headingMatch) {
|
|
310
|
-
return headingMatch[1]
|
|
317
|
+
return headingMatch?.[1]?.trim() ?? `Example ${exampleIndex}`
|
|
311
318
|
}
|
|
312
319
|
|
|
313
320
|
// Check for bold text that might be a heading (**text**)
|
|
314
321
|
const boldMatch = line.match(/^\*\*([^*]+)\*\*\s*$/)
|
|
315
322
|
if (boldMatch) {
|
|
316
|
-
return boldMatch[1]
|
|
323
|
+
return boldMatch?.[1]?.trim() ?? `Example ${exampleIndex}`
|
|
317
324
|
}
|
|
318
325
|
|
|
319
326
|
// If we hit a higher level heading (## or #), stop looking
|
|
@@ -748,7 +755,7 @@ ${sections}
|
|
|
748
755
|
function dedent(strings: TemplateStringsArray, ...values: any[]): string {
|
|
749
756
|
let result = ''
|
|
750
757
|
for (let i = 0; i < strings.length; i++) {
|
|
751
|
-
result += strings[i].replace(/\r/g, '')
|
|
758
|
+
result += (strings[i] ?? '').replace(/\r/g, '')
|
|
752
759
|
if (i < values.length)
|
|
753
760
|
result += String(values[i])
|
|
754
761
|
}
|
|
@@ -766,7 +773,8 @@ function dedent(strings: TemplateStringsArray, ...values: any[]): string {
|
|
|
766
773
|
}
|
|
767
774
|
if (minIndent && minIndent > 0) {
|
|
768
775
|
for (let i = 0; i < lines.length; i++) {
|
|
769
|
-
|
|
776
|
+
const line = lines[i] ?? ''
|
|
777
|
+
lines[i] = line.startsWith(' '.repeat(minIndent)) ? line.slice(minIndent) : line
|
|
770
778
|
}
|
|
771
779
|
}
|
|
772
780
|
return `${lines.join('\n').replace(/[ \t]+$/gm, '').trim()}\n`
|
|
@@ -786,7 +794,7 @@ function groupByDirectory(components: ComponentDoc[]): Record<string, ComponentD
|
|
|
786
794
|
// Sort directories
|
|
787
795
|
const sortedGrouped: Record<string, ComponentDoc[]> = {}
|
|
788
796
|
Object.keys(grouped).sort().forEach((key) => {
|
|
789
|
-
sortedGrouped[key] = grouped[key]
|
|
797
|
+
sortedGrouped[key] = grouped[key] ?? []
|
|
790
798
|
})
|
|
791
799
|
|
|
792
800
|
return sortedGrouped
|
|
@@ -803,7 +811,7 @@ function sanitizeInlineComment(value?: string): string {
|
|
|
803
811
|
|
|
804
812
|
const sentenceMatch = singleLine.match(/^(.*?\.)\s/)
|
|
805
813
|
if (sentenceMatch) {
|
|
806
|
-
return sentenceMatch[1]
|
|
814
|
+
return sentenceMatch?.[1]?.trim() ?? singleLine
|
|
807
815
|
}
|
|
808
816
|
return singleLine
|
|
809
817
|
}
|
package/lib/type-resolver.ts
CHANGED
|
@@ -277,7 +277,10 @@ export class TypeResolver {
|
|
|
277
277
|
|
|
278
278
|
const arraySuffixMatch = trimmed.match(/^(.*)\[\]$/)
|
|
279
279
|
if (arraySuffixMatch) {
|
|
280
|
-
const elementType = arraySuffixMatch[1]
|
|
280
|
+
const elementType = arraySuffixMatch?.[1]?.trim()
|
|
281
|
+
if (!elementType) {
|
|
282
|
+
return 'any'
|
|
283
|
+
}
|
|
281
284
|
const resolvedElement = this.resolveTypeInternal(elementType, seen)
|
|
282
285
|
return this.formatArrayType(resolvedElement)
|
|
283
286
|
}
|
|
@@ -365,7 +368,7 @@ export class TypeResolver {
|
|
|
365
368
|
const closers = new Map(Array.from(openers.entries()).map(([o, c]) => [c, o]))
|
|
366
369
|
|
|
367
370
|
for (let i = 0; i < input.length; i++) {
|
|
368
|
-
const char = input[i]
|
|
371
|
+
const char = input[i] ?? ''
|
|
369
372
|
if (openers.has(char)) {
|
|
370
373
|
depth++
|
|
371
374
|
}
|
|
@@ -393,9 +396,9 @@ export class TypeResolver {
|
|
|
393
396
|
// Global instance
|
|
394
397
|
let globalResolver: TypeResolver | null = null
|
|
395
398
|
|
|
396
|
-
export async function getTypeResolver(projectRoot: string
|
|
399
|
+
export async function getTypeResolver(projectRoot: string): Promise<TypeResolver> {
|
|
397
400
|
if (!globalResolver) {
|
|
398
|
-
globalResolver = new TypeResolver(projectRoot
|
|
401
|
+
globalResolver = new TypeResolver(projectRoot)
|
|
399
402
|
await globalResolver.initialize()
|
|
400
403
|
}
|
|
401
404
|
return globalResolver
|
package/nuxt.config.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/// <reference types="@unocss/nuxt" />
|
|
2
|
+
|
|
3
|
+
import type {} from '@unocss/nuxt'
|
|
4
|
+
|
|
1
5
|
import { dirname, join } from 'node:path'
|
|
2
6
|
import { fileURLToPath } from 'node:url'
|
|
3
7
|
import { createResolver } from 'nuxt/kit'
|
|
@@ -84,4 +88,4 @@ export default defineNuxtConfig({
|
|
|
84
88
|
},
|
|
85
89
|
},
|
|
86
90
|
},
|
|
87
|
-
})
|
|
91
|
+
} as any)
|
package/package.json
CHANGED
package/plugins/test-id.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { defineNuxtPlugin } from 'nuxt/app'
|
|
2
|
+
|
|
1
3
|
export default defineNuxtPlugin((nuxtApp) => {
|
|
2
4
|
nuxtApp.vueApp.directive('test', {
|
|
3
|
-
created(el, binding) {
|
|
4
|
-
el.setAttribute('data-testid', binding.value)
|
|
5
|
+
created(el: HTMLElement, binding: any) {
|
|
6
|
+
el.setAttribute('data-testid', String(binding.value))
|
|
5
7
|
},
|
|
6
8
|
})
|
|
7
9
|
})
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Nuxt provides `defineNuxtConfig` / `defineAppConfig` at runtime when loading
|
|
2
|
+
// `nuxt.config.*` and `app.config.*`, but TypeScript's workspace `tsc` doesn't
|
|
3
|
+
// know about those globals.
|
|
4
|
+
//
|
|
5
|
+
// We declare the globals here (types-only) so root `pnpm -w exec tsc` passes,
|
|
6
|
+
// without importing Nuxt runtime modules (which breaks Nitro/Vercel bundling).
|
|
7
|
+
|
|
8
|
+
export {}
|
|
9
|
+
|
|
10
|
+
declare global {
|
|
11
|
+
const defineNuxtConfig: typeof import('nuxt/config').defineNuxtConfig
|
|
12
|
+
const defineAppConfig: typeof import('nuxt/app').defineAppConfig
|
|
13
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare module '@vue/runtime-core' {
|
|
2
|
+
interface ComponentCustomProperties {
|
|
3
|
+
$t: (key: string, ...args: unknown[]) => string
|
|
4
|
+
cn: (...inputs: unknown[]) => string
|
|
5
|
+
navigateTo: (...args: unknown[]) => unknown
|
|
6
|
+
$route: any
|
|
7
|
+
DT: any
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export {}
|
package/unocss.config.ts
CHANGED