includio-cms 0.1.4 → 0.5.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/CHANGELOG.md +83 -0
- package/ROADMAP.md +26 -13
- package/dist/admin/api/accept-invite.js +1 -5
- package/dist/admin/api/invite.js +7 -16
- package/dist/admin/client/account/account-page.svelte +20 -50
- package/dist/admin/client/account/lang.d.ts +15 -23
- package/dist/admin/client/account/lang.js +51 -67
- package/dist/admin/client/account/preferences-section.svelte +26 -84
- package/dist/admin/client/account/profile-section.svelte +60 -40
- package/dist/admin/client/account/schema.d.ts +11 -3
- package/dist/admin/client/account/schema.js +25 -16
- package/dist/admin/client/account/security-section.svelte +139 -105
- package/dist/admin/client/account/sessions-section.svelte +35 -34
- package/dist/admin/client/admin/admin-after-login-layout-content.svelte +3 -5
- package/dist/admin/client/admin/admin-layout.svelte +3 -2
- package/dist/admin/client/admin/admin-preloader.svelte +36 -0
- package/dist/admin/client/admin/admin-preloader.svelte.d.ts +18 -0
- package/dist/admin/client/admin/dashboard-page.svelte +35 -67
- package/dist/admin/client/collection/a11y-score-cell.svelte +45 -0
- package/dist/admin/client/collection/a11y-score-cell.svelte.d.ts +6 -0
- package/dist/admin/client/collection/bulk-actions-bar.svelte +100 -0
- package/dist/admin/client/collection/bulk-actions-bar.svelte.d.ts +10 -0
- package/dist/admin/client/collection/collection-entries.svelte +277 -258
- package/dist/admin/client/collection/collection-view.svelte.d.ts +4 -3
- package/dist/admin/client/collection/collection-view.svelte.js +9 -5
- package/dist/admin/client/collection/collection.svelte +22 -12
- package/dist/admin/client/collection/data-table.svelte +50 -39
- package/dist/admin/client/collection/data-table.svelte.d.ts +1 -0
- package/dist/admin/client/collection/date-cell.svelte +7 -5
- package/dist/admin/client/collection/date-cell.svelte.d.ts +1 -1
- package/dist/admin/client/collection/empty-state.svelte +28 -0
- package/dist/admin/client/collection/empty-state.svelte.d.ts +9 -0
- package/dist/admin/client/collection/entry-link.svelte +10 -4
- package/dist/admin/client/collection/entry-link.svelte.d.ts +1 -0
- package/dist/admin/client/collection/grid-view.svelte +21 -23
- package/dist/admin/client/collection/grid-view.svelte.d.ts +1 -2
- package/dist/admin/client/collection/row-actions.svelte +69 -0
- package/dist/admin/client/collection/row-actions.svelte.d.ts +10 -0
- package/dist/admin/client/collection/status-badge.svelte +7 -8
- package/dist/admin/client/collection/table-pagination.svelte +122 -79
- package/dist/admin/client/collection/table-pagination.svelte.d.ts +1 -0
- package/dist/admin/client/collection/table-toolbar.svelte +108 -88
- package/dist/admin/client/collection/table-toolbar.svelte.d.ts +8 -9
- package/dist/admin/client/entry/entry-form.svelte +109 -1
- package/dist/admin/client/entry/entry-header.svelte +143 -37
- package/dist/admin/client/entry/entry-header.svelte.d.ts +8 -0
- package/dist/admin/client/entry/entry.svelte +272 -61
- package/dist/admin/client/entry/header/a11y-validator.d.ts +47 -0
- package/dist/admin/client/entry/header/a11y-validator.js +352 -0
- package/dist/admin/client/entry/header/publish-panel.svelte +531 -129
- package/dist/admin/client/entry/header/publish-panel.svelte.d.ts +4 -0
- package/dist/admin/client/entry/header/save-indicator.svelte +33 -23
- package/dist/admin/client/entry/header/schedule-popover.svelte +1 -1
- package/dist/admin/client/entry/header/status-badge.svelte +25 -118
- package/dist/admin/client/entry/header/version-history-sheet.svelte +322 -98
- package/dist/admin/client/form/form-submission/form-submission.svelte +271 -83
- package/dist/admin/client/form/form-submission/submission-field.svelte +12 -12
- package/dist/admin/client/form/form-submissions.svelte +421 -139
- package/dist/admin/client/form/submission-link.svelte +8 -2
- package/dist/admin/client/form/submission-link.svelte.d.ts +1 -0
- package/dist/admin/client/form/submission-status-badge.svelte +18 -4
- package/dist/admin/client/form/submission-status-badge.svelte.d.ts +1 -0
- package/dist/admin/client/login/lang.d.ts +32 -0
- package/dist/admin/client/login/lang.js +66 -2
- package/dist/admin/client/login/login-form.svelte +237 -95
- package/dist/admin/client/login/login-form.svelte.d.ts +2 -17
- package/dist/admin/client/login/login-page.svelte +34 -98
- package/dist/admin/client/login/reset-password-page.svelte +235 -0
- package/dist/admin/client/login/reset-password-page.svelte.d.ts +4 -0
- package/dist/admin/client/login/schema.d.ts +15 -0
- package/dist/admin/client/login/schema.js +21 -0
- package/dist/admin/client/users/accept-invite-page.svelte +166 -37
- package/dist/admin/client/users/create-user-dialog.svelte +15 -7
- package/dist/admin/client/users/delete-user-dialog.svelte +81 -16
- package/dist/admin/client/users/delete-user-dialog.svelte.d.ts +4 -1
- package/dist/admin/client/users/edit-user-dialog.svelte +3 -0
- package/dist/admin/client/users/invite-user-dialog.svelte +16 -3
- package/dist/admin/client/users/lang.d.ts +27 -0
- package/dist/admin/client/users/lang.js +64 -10
- package/dist/admin/client/users/pending-invitations.svelte +59 -23
- package/dist/admin/client/users/users-page.svelte +471 -72
- package/dist/admin/components/accessibility/accessibility-overview.svelte +2 -7
- package/dist/admin/components/dashboard/a11y-gauge.svelte +90 -0
- package/dist/admin/components/dashboard/a11y-gauge.svelte.d.ts +18 -0
- package/dist/admin/components/dashboard/accessibility-hub.svelte +13 -12
- package/dist/admin/components/dashboard/changelog-dialog.svelte +157 -0
- package/dist/admin/components/dashboard/changelog-dialog.svelte.d.ts +6 -0
- package/dist/admin/components/dashboard/form-submissions-widget.svelte +71 -113
- package/dist/admin/components/dashboard/index.d.ts +4 -2
- package/dist/admin/components/dashboard/index.js +4 -2
- package/dist/admin/components/dashboard/orphaned-entries-notice.svelte +240 -0
- package/dist/admin/components/dashboard/orphaned-entries-notice.svelte.d.ts +13 -0
- package/dist/admin/components/dashboard/recent-activity.svelte +53 -75
- package/dist/admin/components/dashboard/recent-entries.svelte +94 -0
- package/dist/admin/components/dashboard/recent-entries.svelte.d.ts +18 -0
- package/dist/admin/components/dashboard/stat-card.svelte +2 -2
- package/dist/admin/components/dashboard/tip-of-the-day.svelte +109 -0
- package/dist/admin/components/dashboard/tip-of-the-day.svelte.d.ts +3 -0
- package/dist/admin/components/dashboard/welcome-header.svelte +45 -0
- package/dist/admin/components/dashboard/welcome-header.svelte.d.ts +3 -0
- package/dist/admin/components/fields/{array-field.svelte → blocks-field.svelte} +4 -4
- package/dist/admin/components/fields/{array-field.svelte.d.ts → blocks-field.svelte.d.ts} +5 -5
- package/dist/admin/components/fields/content-field.svelte +27 -0
- package/dist/admin/components/fields/content-field.svelte.d.ts +31 -0
- package/dist/admin/components/fields/field-renderer.svelte +9 -7
- package/dist/admin/components/fields/image-field.svelte +2 -2
- package/dist/admin/components/fields/media-field.svelte +2 -2
- package/dist/admin/components/fields/seo-field.svelte +205 -25
- package/dist/admin/components/fields/simple-array-field.svelte +289 -0
- package/dist/admin/components/fields/simple-array-field.svelte.d.ts +30 -0
- package/dist/admin/components/fields/slug-field.svelte +3 -2
- package/dist/admin/components/fields/standalone-field-renderer.svelte +148 -0
- package/dist/admin/components/fields/standalone-field-renderer.svelte.d.ts +9 -0
- package/dist/admin/components/fields/text-field-wrapper.svelte +147 -3
- package/dist/admin/components/fields/text-field-wrapper.svelte.d.ts +2 -2
- package/dist/admin/components/fields/url-field.svelte +5 -4
- package/dist/admin/components/layout/app-sidebar.svelte +27 -24
- package/dist/admin/components/layout/lang.d.ts +6 -0
- package/dist/admin/components/layout/lang.js +13 -1
- package/dist/admin/components/layout/layout-renderer.svelte +352 -0
- package/dist/admin/components/layout/layout-renderer.svelte.d.ts +14 -0
- package/dist/admin/components/layout/nav-breadcrumbs.svelte +4 -4
- package/dist/admin/components/layout/nav-collections.svelte +65 -36
- package/dist/admin/components/layout/nav-footer.svelte +38 -0
- package/dist/admin/components/layout/nav-footer.svelte.d.ts +3 -0
- package/dist/admin/components/layout/nav-forms.svelte +55 -30
- package/dist/admin/components/layout/nav-main.svelte +14 -52
- package/dist/admin/components/layout/nav-search.svelte +4 -3
- package/dist/admin/components/layout/nav-singletons.svelte +59 -17
- package/dist/admin/components/layout/nav-singletons.svelte.d.ts +17 -8
- package/dist/admin/components/layout/site-header.svelte +74 -13
- package/dist/admin/components/media/alt-input.svelte +32 -22
- package/dist/admin/components/media/bulk-action-bar.svelte +139 -150
- package/dist/admin/components/media/file/file-details.svelte +299 -217
- package/dist/admin/components/media/file/file-miniature.svelte +54 -41
- package/dist/admin/components/media/file/file-miniature.svelte.d.ts +1 -0
- package/dist/admin/components/media/file/file-preview.svelte +1 -1
- package/dist/admin/components/media/file-upload.svelte +24 -26
- package/dist/admin/components/media/files-list.svelte +112 -40
- package/dist/admin/components/media/files-list.svelte.d.ts +2 -0
- package/dist/admin/components/media/focal-point-input.svelte +122 -26
- package/dist/admin/components/media/media-library.svelte +127 -70
- package/dist/admin/components/media/media-search.svelte +6 -6
- package/dist/admin/components/media/media-sort.svelte +3 -1
- package/dist/admin/components/media/multi-file-summary.svelte +88 -68
- package/dist/admin/components/media/tag-combobox.svelte +141 -66
- package/dist/admin/components/media/tag-combobox.svelte.d.ts +1 -0
- package/dist/admin/components/media/tag-sidebar.svelte +139 -121
- package/dist/admin/components/tiptap/FigureNodeView.svelte +144 -15
- package/dist/admin/components/tiptap/InlineBlockNodeView.svelte +254 -0
- package/dist/admin/components/tiptap/InlineBlockNodeView.svelte.d.ts +4 -0
- package/dist/admin/components/tiptap/SlashCommandPopup.svelte +212 -0
- package/dist/admin/components/tiptap/SlashCommandPopup.svelte.d.ts +8 -0
- package/dist/admin/components/tiptap/content-editor.svelte +280 -0
- package/dist/admin/components/tiptap/content-editor.svelte.d.ts +9 -0
- package/dist/admin/components/tiptap/editor-toolbar.svelte +230 -0
- package/dist/admin/components/tiptap/editor-toolbar.svelte.d.ts +16 -0
- package/dist/admin/components/tiptap/heading-a11y-plugin.d.ts +2 -0
- package/dist/admin/components/tiptap/heading-a11y-plugin.js +67 -0
- package/dist/admin/components/tiptap/image-dialog.svelte +172 -11
- package/dist/admin/components/tiptap/inline-block-node.d.ts +19 -0
- package/dist/admin/components/tiptap/inline-block-node.js +98 -0
- package/dist/admin/components/tiptap/link-dialog.svelte +9 -4
- package/dist/admin/components/tiptap/slash-command.d.ts +17 -0
- package/dist/admin/components/tiptap/slash-command.js +181 -0
- package/dist/admin/components/tiptap/structured-content-utils.d.ts +21 -0
- package/dist/admin/components/tiptap/structured-content-utils.js +150 -0
- package/dist/admin/components/tiptap/tiptap-editor.svelte +18 -190
- package/dist/admin/email/invite-template.d.ts +8 -0
- package/dist/admin/email/invite-template.js +99 -0
- package/dist/admin/email/reset-password-template.d.ts +7 -0
- package/dist/admin/email/reset-password-template.js +96 -0
- package/dist/admin/remote/ai.remote.d.ts +1 -0
- package/dist/admin/remote/ai.remote.js +4 -1
- package/dist/admin/remote/entry.remote.d.ts +9 -0
- package/dist/admin/remote/entry.remote.js +58 -8
- package/dist/admin/remote/preview.remote.js +2 -1
- package/dist/admin/shared/password-schema.d.ts +5 -0
- package/dist/admin/shared/password-schema.js +10 -0
- package/dist/admin/state/content-language.svelte.d.ts +3 -0
- package/dist/admin/state/content-language.svelte.js +8 -0
- package/dist/admin/styles/admin.css +1530 -151
- package/dist/admin/utils/formatDate.d.ts +1 -0
- package/dist/admin/utils/formatDate.js +8 -0
- package/dist/admin/utils/roleLabel.d.ts +2 -0
- package/dist/admin/utils/roleLabel.js +13 -0
- package/dist/admin/utils/translationStatus.d.ts +17 -0
- package/dist/admin/utils/translationStatus.js +134 -0
- package/dist/ai-claude/index.d.ts +2 -0
- package/dist/ai-claude/index.js +56 -0
- package/dist/cms/runtime/api.d.ts +6 -1
- package/dist/cms/runtime/api.js +3 -0
- package/dist/cms/runtime/schemas.d.ts +9 -1
- package/dist/cms/runtime/schemas.js +8 -0
- package/dist/cms/runtime/types.d.ts +82 -10
- package/dist/cms/runtime/types.js +4 -0
- package/dist/components/ui/accordion/accordion.stories.svelte +39 -0
- package/dist/components/ui/accordion/accordion.stories.svelte.d.ts +27 -0
- package/dist/components/ui/alert/alert.stories.svelte +53 -0
- package/dist/components/ui/alert/alert.stories.svelte.d.ts +27 -0
- package/dist/components/ui/alert/alert.svelte +5 -0
- package/dist/components/ui/alert/alert.svelte.d.ts +9 -0
- package/dist/components/ui/avatar/avatar.stories.svelte +16 -0
- package/dist/components/ui/avatar/avatar.stories.svelte.d.ts +27 -0
- package/dist/components/ui/badge/badge.stories.svelte +33 -0
- package/dist/components/ui/badge/badge.stories.svelte.d.ts +27 -0
- package/dist/components/ui/breadcrumb/breadcrumb.stories.svelte +33 -0
- package/dist/components/ui/breadcrumb/breadcrumb.stories.svelte.d.ts +27 -0
- package/dist/components/ui/button/button.stories.svelte +43 -0
- package/dist/components/ui/button/button.stories.svelte.d.ts +27 -0
- package/dist/components/ui/button/button.svelte +1 -2
- package/dist/components/ui/button/button.svelte.d.ts +0 -3
- package/dist/components/ui/button-group/button-group-separator.svelte.d.ts +1 -1
- package/dist/components/ui/card/card.stories.svelte +42 -0
- package/dist/components/ui/card/card.stories.svelte.d.ts +27 -0
- package/dist/components/ui/command/command.stories.svelte +51 -0
- package/dist/components/ui/command/command.stories.svelte.d.ts +27 -0
- package/dist/components/ui/dialog/dialog.stories.svelte +29 -0
- package/dist/components/ui/dialog/dialog.stories.svelte.d.ts +27 -0
- package/dist/components/ui/field/field-label.svelte.d.ts +1 -1
- package/dist/components/ui/field/field.stories.svelte +21 -0
- package/dist/components/ui/field/field.stories.svelte.d.ts +27 -0
- package/dist/components/ui/input/input.stories.svelte +40 -0
- package/dist/components/ui/input/input.stories.svelte.d.ts +27 -0
- package/dist/components/ui/input/input.svelte +2 -4
- package/dist/components/ui/item/item-separator.svelte.d.ts +1 -1
- package/dist/components/ui/label/label.stories.svelte +20 -0
- package/dist/components/ui/label/label.stories.svelte.d.ts +27 -0
- package/dist/components/ui/popover/popover.stories.svelte +29 -0
- package/dist/components/ui/popover/popover.stories.svelte.d.ts +27 -0
- package/dist/components/ui/select/select-group-heading.svelte.d.ts +1 -1
- package/dist/components/ui/select/select.stories.svelte +23 -0
- package/dist/components/ui/select/select.stories.svelte.d.ts +27 -0
- package/dist/components/ui/separator/separator.stories.svelte +24 -0
- package/dist/components/ui/separator/separator.stories.svelte.d.ts +27 -0
- package/dist/components/ui/sheet/sheet.stories.svelte +29 -0
- package/dist/components/ui/sheet/sheet.stories.svelte.d.ts +27 -0
- package/dist/components/ui/sidebar/sidebar-group.svelte +3 -3
- package/dist/components/ui/sidebar/sidebar-group.svelte.d.ts +2 -2
- package/dist/components/ui/sidebar/sidebar-menu-button.svelte +28 -30
- package/dist/components/ui/sidebar/sidebar-menu-button.svelte.d.ts +7 -7
- package/dist/components/ui/sidebar/sidebar-separator.svelte.d.ts +1 -1
- package/dist/components/ui/sidebar/sidebar-trigger.svelte +4 -4
- package/dist/components/ui/sonner/sonner.stories.svelte +22 -0
- package/dist/components/ui/sonner/sonner.stories.svelte.d.ts +26 -0
- package/dist/components/ui/sonner/sonner.svelte +8 -2
- package/dist/components/ui/sonner/toast-demo.svelte +29 -0
- package/dist/components/ui/sonner/toast-demo.svelte.d.ts +6 -0
- package/dist/components/ui/textarea/textarea.stories.svelte +22 -0
- package/dist/components/ui/textarea/textarea.stories.svelte.d.ts +27 -0
- package/dist/components/ui/textarea/textarea.svelte +0 -2
- package/dist/components/ui/toggle/toggle.stories.svelte +22 -0
- package/dist/components/ui/toggle/toggle.stories.svelte.d.ts +27 -0
- package/dist/components/ui/toggle-group/toggle-group.stories.svelte +17 -0
- package/dist/components/ui/toggle-group/toggle-group.stories.svelte.d.ts +27 -0
- package/dist/components/ui/tooltip/tooltip.stories.svelte +26 -0
- package/dist/components/ui/tooltip/tooltip.stories.svelte.d.ts +27 -0
- package/dist/core/fields/fieldSchemaToTs.d.ts +1 -0
- package/dist/core/fields/fieldSchemaToTs.js +133 -1
- package/dist/core/fields/layoutUtils.d.ts +17 -0
- package/dist/core/fields/layoutUtils.js +149 -0
- package/dist/core/fields/structuredToHtml.d.ts +9 -0
- package/dist/core/fields/structuredToHtml.js +161 -0
- package/dist/core/server/entries/operations/create.js +2 -1
- package/dist/core/server/entries/operations/get.js +10 -7
- package/dist/core/server/entries/operations/update.d.ts +3 -0
- package/dist/core/server/entries/operations/update.js +30 -2
- package/dist/core/server/fields/queryStructuredContent.d.ts +15 -0
- package/dist/core/server/fields/queryStructuredContent.js +65 -0
- package/dist/core/server/fields/resolveImageFields.js +51 -2
- package/dist/core/server/fields/resolveRelationFields.js +2 -2
- package/dist/core/server/fields/resolveRichtextLinks.js +80 -13
- package/dist/core/server/fields/resolveUrlFields.js +57 -6
- package/dist/core/server/fields/slugResolver.d.ts +10 -0
- package/dist/core/server/fields/slugResolver.js +34 -0
- package/dist/core/server/generator/fields.js +15 -4
- package/dist/core/server/generator/generator.js +3 -2
- package/dist/db-postgres/index.js +10 -6
- package/dist/files-local/index.js +126 -64
- package/dist/server/auth.d.ts +5 -0
- package/dist/server/auth.js +12 -1
- package/dist/sveltekit/components/structured-content.svelte +204 -0
- package/dist/sveltekit/components/structured-content.svelte.d.ts +21 -0
- package/dist/sveltekit/config.d.ts +13 -3
- package/dist/sveltekit/index.d.ts +3 -0
- package/dist/sveltekit/index.js +3 -0
- package/dist/sveltekit/server/handle.js +1 -0
- package/dist/types/config.d.ts +3 -0
- package/dist/types/entries.d.ts +3 -0
- package/dist/types/fields.d.ts +19 -2
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.js +2 -0
- package/dist/types/layout.d.ts +54 -0
- package/dist/types/layout.js +6 -0
- package/dist/types/structured-content.d.ts +63 -0
- package/dist/types/structured-content.js +1 -0
- package/dist/updates/0.1.5/index.d.ts +2 -0
- package/dist/updates/0.1.5/index.js +18 -0
- package/dist/updates/0.2.0/index.d.ts +2 -0
- package/dist/updates/0.2.0/index.js +11 -0
- package/dist/updates/0.2.2/index.d.ts +2 -0
- package/dist/updates/0.2.2/index.js +13 -0
- package/dist/updates/0.5.0/index.d.ts +2 -0
- package/dist/updates/0.5.0/index.js +14 -0
- package/dist/updates/0.5.1/index.d.ts +2 -0
- package/dist/updates/0.5.1/index.js +17 -0
- package/dist/updates/index.js +6 -1
- package/package.json +16 -9
- package/dist/admin/components/dashboard/updates-banner.svelte +0 -170
- package/dist/admin/components/dashboard/updates-banner.svelte.d.ts +0 -3
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { InterfaceLanguage } from '../../types/languages.js';
|
|
2
2
|
export declare function toLocaleCode(lang: string): string;
|
|
3
3
|
export declare function formatRelativeDate(date: Date | string, lang?: InterfaceLanguage): string;
|
|
4
|
+
export declare function formatShortDate(date: Date | string, lang?: InterfaceLanguage): string;
|
|
4
5
|
export declare function formatAbsoluteDate(date: Date | string, lang?: InterfaceLanguage): string;
|
|
@@ -86,6 +86,14 @@ export function formatRelativeDate(date, lang = 'en') {
|
|
|
86
86
|
}
|
|
87
87
|
return labels[lang].justNow;
|
|
88
88
|
}
|
|
89
|
+
export function formatShortDate(date, lang = 'en') {
|
|
90
|
+
const d = typeof date === 'string' ? new Date(date) : date;
|
|
91
|
+
return d.toLocaleDateString(toLocaleCode(lang), {
|
|
92
|
+
year: 'numeric',
|
|
93
|
+
month: 'short',
|
|
94
|
+
day: 'numeric'
|
|
95
|
+
});
|
|
96
|
+
}
|
|
89
97
|
export function formatAbsoluteDate(date, lang = 'en') {
|
|
90
98
|
const d = typeof date === 'string' ? new Date(date) : date;
|
|
91
99
|
return d.toLocaleString(toLocaleCode(lang), {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Field } from '../../types/fields.js';
|
|
2
|
+
export type TranslationCompleteness = 'complete' | 'partial' | 'empty';
|
|
3
|
+
export interface LangStatus {
|
|
4
|
+
filled: number;
|
|
5
|
+
total: number;
|
|
6
|
+
percentage: number;
|
|
7
|
+
status: TranslationCompleteness;
|
|
8
|
+
missingFields: {
|
|
9
|
+
slug: string;
|
|
10
|
+
label: string;
|
|
11
|
+
}[];
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Compute translation status for each language.
|
|
15
|
+
* Checks all localized fields (text, richtext, content) + seo/url sub-fields.
|
|
16
|
+
*/
|
|
17
|
+
export declare function computeTranslationStatus(data: Record<string, unknown>, fields: Field[], languages: string[]): Record<string, LangStatus>;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { getAtPath } from './objectPath.js';
|
|
2
|
+
/** Extract a label string from Localized, preferring pl then en then slug. */
|
|
3
|
+
function extractLabel(label, fallback) {
|
|
4
|
+
if (!label)
|
|
5
|
+
return fallback;
|
|
6
|
+
if (typeof label === 'string')
|
|
7
|
+
return label;
|
|
8
|
+
return label.pl || label.en || fallback;
|
|
9
|
+
}
|
|
10
|
+
/** Check if a value counts as "filled" for a given field type. */
|
|
11
|
+
function isFieldFilled(value, fieldType) {
|
|
12
|
+
if (value == null)
|
|
13
|
+
return false;
|
|
14
|
+
switch (fieldType) {
|
|
15
|
+
case 'text':
|
|
16
|
+
case 'richtext':
|
|
17
|
+
return typeof value === 'string' && value.length > 0;
|
|
18
|
+
case 'content': {
|
|
19
|
+
if (typeof value !== 'object')
|
|
20
|
+
return false;
|
|
21
|
+
const doc = value;
|
|
22
|
+
return doc.type === 'doc' && Array.isArray(doc.content) && doc.content.length > 0;
|
|
23
|
+
}
|
|
24
|
+
case 'seo': {
|
|
25
|
+
if (typeof value !== 'object')
|
|
26
|
+
return false;
|
|
27
|
+
const seo = value;
|
|
28
|
+
// At least title or description filled
|
|
29
|
+
return ((typeof seo.title === 'string' && seo.title.length > 0) ||
|
|
30
|
+
(typeof seo.description === 'string' && seo.description.length > 0));
|
|
31
|
+
}
|
|
32
|
+
case 'url': {
|
|
33
|
+
if (typeof value !== 'object')
|
|
34
|
+
return false;
|
|
35
|
+
const url = value;
|
|
36
|
+
return typeof url.url === 'string' && url.url.length > 0;
|
|
37
|
+
}
|
|
38
|
+
default:
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/** Collect all localized fields from a field list, including nested seo/url sub-fields. */
|
|
43
|
+
function collectLocalizedFields(fields) {
|
|
44
|
+
const result = [];
|
|
45
|
+
for (const field of fields) {
|
|
46
|
+
if (field.localized === false)
|
|
47
|
+
continue;
|
|
48
|
+
const label = extractLabel(field.label, field.slug);
|
|
49
|
+
if (field.type === 'text' || field.type === 'richtext' || field.type === 'content') {
|
|
50
|
+
result.push({ slug: field.slug, label, type: field.type, required: !!field.required });
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
// SEO and URL fields are always localized by nature (sub-fields are lang-keyed)
|
|
54
|
+
for (const field of fields) {
|
|
55
|
+
if (field.type === 'seo') {
|
|
56
|
+
const label = extractLabel(field.label, field.slug);
|
|
57
|
+
result.push({ slug: field.slug, label, type: 'seo', required: !!field.required });
|
|
58
|
+
}
|
|
59
|
+
if (field.type === 'url') {
|
|
60
|
+
const label = extractLabel(field.label, field.slug);
|
|
61
|
+
result.push({ slug: field.slug, label, type: 'url', required: !!field.required });
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return result;
|
|
65
|
+
}
|
|
66
|
+
/** Resolve the value of a field for a given language. */
|
|
67
|
+
function resolveFieldValue(data, field, lang) {
|
|
68
|
+
if (field.type === 'seo') {
|
|
69
|
+
const seoData = getAtPath(data, field.slug);
|
|
70
|
+
if (seoData && typeof seoData === 'object') {
|
|
71
|
+
const seo = seoData;
|
|
72
|
+
const title = extractLangValue(seo.title, lang);
|
|
73
|
+
const desc = extractLangValue(seo.description, lang);
|
|
74
|
+
return { title, description: desc };
|
|
75
|
+
}
|
|
76
|
+
return undefined;
|
|
77
|
+
}
|
|
78
|
+
else if (field.type === 'url') {
|
|
79
|
+
const urlData = getAtPath(data, field.slug);
|
|
80
|
+
if (urlData && typeof urlData === 'object') {
|
|
81
|
+
const url = urlData;
|
|
82
|
+
const urlVal = url.url && typeof url.url === 'object'
|
|
83
|
+
? url.url[lang]
|
|
84
|
+
: undefined;
|
|
85
|
+
return { url: urlVal || '' };
|
|
86
|
+
}
|
|
87
|
+
return undefined;
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
const fieldData = getAtPath(data, field.slug);
|
|
91
|
+
if (fieldData && typeof fieldData === 'object' && !Array.isArray(fieldData)) {
|
|
92
|
+
return fieldData[lang];
|
|
93
|
+
}
|
|
94
|
+
return undefined;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Compute translation status for each language.
|
|
99
|
+
* Checks all localized fields (text, richtext, content) + seo/url sub-fields.
|
|
100
|
+
*/
|
|
101
|
+
export function computeTranslationStatus(data, fields, languages) {
|
|
102
|
+
const allLocalizedFields = collectLocalizedFields(fields);
|
|
103
|
+
// Pre-filter: keep field if required OR has content in at least one language
|
|
104
|
+
const localizedFields = allLocalizedFields.filter((field) => field.required ||
|
|
105
|
+
languages.some((lang) => isFieldFilled(resolveFieldValue(data, field, lang), field.type)));
|
|
106
|
+
const result = {};
|
|
107
|
+
for (const lang of languages) {
|
|
108
|
+
let filled = 0;
|
|
109
|
+
const total = localizedFields.length;
|
|
110
|
+
const missingFields = [];
|
|
111
|
+
for (const field of localizedFields) {
|
|
112
|
+
const value = resolveFieldValue(data, field, lang);
|
|
113
|
+
if (isFieldFilled(value, field.type)) {
|
|
114
|
+
filled++;
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
missingFields.push({ slug: field.slug, label: field.label });
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
const percentage = total === 0 ? 100 : Math.round((filled / total) * 100);
|
|
121
|
+
const status = percentage === 100 ? 'complete' : percentage === 0 ? 'empty' : 'partial';
|
|
122
|
+
result[lang] = { filled, total, percentage, status, missingFields };
|
|
123
|
+
}
|
|
124
|
+
return result;
|
|
125
|
+
}
|
|
126
|
+
/** Extract lang value from a possibly lang-keyed value. */
|
|
127
|
+
function extractLangValue(value, lang) {
|
|
128
|
+
if (typeof value === 'string')
|
|
129
|
+
return value;
|
|
130
|
+
if (value && typeof value === 'object') {
|
|
131
|
+
return (value[lang]) || '';
|
|
132
|
+
}
|
|
133
|
+
return '';
|
|
134
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { getCMS } from '../core/cms.js';
|
|
2
|
+
import Anthropic from '@anthropic-ai/sdk';
|
|
3
|
+
import sharp from 'sharp';
|
|
4
|
+
export function claudeAdapter(config) {
|
|
5
|
+
const client = new Anthropic({
|
|
6
|
+
apiKey: config.apiKey
|
|
7
|
+
});
|
|
8
|
+
return {
|
|
9
|
+
generateAltText: async (fileId) => {
|
|
10
|
+
const mediaFile = await getCMS().databaseAdapter.getMediaFile({
|
|
11
|
+
data: {
|
|
12
|
+
id: fileId
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
if (!mediaFile) {
|
|
16
|
+
throw new Error('Media file not found in database');
|
|
17
|
+
}
|
|
18
|
+
const file = await getCMS().filesAdapter.downloadFile(mediaFile.url.split('/').pop() || '');
|
|
19
|
+
if (!file) {
|
|
20
|
+
throw new Error('File not found');
|
|
21
|
+
}
|
|
22
|
+
const fileBuffer = Buffer.from(await file.arrayBuffer());
|
|
23
|
+
const pngBuffer = await sharp(fileBuffer).png().toBuffer();
|
|
24
|
+
const imageBase64 = pngBuffer.toString('base64');
|
|
25
|
+
const prompt = `Generate a concise and descriptive alt text for the following image file in polish language. The alt text should accurately describe the content and context of the image, be no longer than 125 characters, and avoid using phrases like "image of" or "picture of". Return only the alt text, nothing else.`;
|
|
26
|
+
const message = await client.messages.create({
|
|
27
|
+
model: 'claude-haiku-4-5-20251001',
|
|
28
|
+
max_tokens: 256,
|
|
29
|
+
messages: [
|
|
30
|
+
{
|
|
31
|
+
role: 'user',
|
|
32
|
+
content: [
|
|
33
|
+
{
|
|
34
|
+
type: 'text',
|
|
35
|
+
text: prompt
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
type: 'image',
|
|
39
|
+
source: {
|
|
40
|
+
type: 'base64',
|
|
41
|
+
media_type: 'image/png',
|
|
42
|
+
data: imageBase64
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
});
|
|
49
|
+
const textBlock = message.content.find((block) => block.type === 'text');
|
|
50
|
+
if (!textBlock || textBlock.type !== 'text') {
|
|
51
|
+
throw new Error('AI response did not contain text');
|
|
52
|
+
}
|
|
53
|
+
return textBlock.text.trim();
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SingleEntryMap, SingleSlug, CollectionEntryMap, CollectionSlug, SiteLanguage } from './types';
|
|
1
|
+
import type { SingleEntryMap, SingleSlug, CollectionEntryMap, CollectionSlug, FormEntryMap, SiteLanguage } from './types';
|
|
2
2
|
interface GetEntryQueryOptions<T extends {
|
|
3
3
|
data: Record<string, unknown>;
|
|
4
4
|
}> {
|
|
@@ -15,4 +15,9 @@ interface GetEntryOptions {
|
|
|
15
15
|
export declare function getSingleEntry<K extends SingleSlug>(slug: K, data: GetEntryQueryOptions<SingleEntryMap[K]>, options: GetEntryOptions): Promise<SingleEntryMap[K] | null>;
|
|
16
16
|
export declare function getCollectionEntry<K extends CollectionSlug>(slug: K, data: GetEntryQueryOptions<CollectionEntryMap[K]>, options: GetEntryOptions): Promise<CollectionEntryMap[K] | null>;
|
|
17
17
|
export declare function getCollectionEntries<K extends CollectionSlug>(slug: K, options: GetEntryOptions): Promise<CollectionEntryMap[K][]>;
|
|
18
|
+
export interface SubmitFormOptions {
|
|
19
|
+
ip?: string;
|
|
20
|
+
userAgent?: string;
|
|
21
|
+
}
|
|
22
|
+
export declare function submitForm<K extends keyof FormEntryMap>(slug: K, data: FormEntryMap[K]['data'], options?: SubmitFormOptions): Promise<boolean>;
|
|
18
23
|
export {};
|
package/dist/cms/runtime/api.js
CHANGED
|
@@ -17,3 +17,6 @@ export async function getCollectionEntry(slug, data, options) {
|
|
|
17
17
|
export async function getCollectionEntries(slug, options) {
|
|
18
18
|
return (await getEntries({ slug, ...options }));
|
|
19
19
|
}
|
|
20
|
+
export async function submitForm(slug, data, options) {
|
|
21
|
+
return createFormSubmission({ slug, data, ...options });
|
|
22
|
+
}
|
|
@@ -1,2 +1,10 @@
|
|
|
1
1
|
// This file is auto-generated. Do not edit directly.
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
+
export const contactFormSchema = z.object({
|
|
4
|
+
"name": z.string().min(1),
|
|
5
|
+
"email": z.string().min(1).email(),
|
|
6
|
+
"phone": z.string(),
|
|
7
|
+
"subject": z.string(),
|
|
8
|
+
"message": z.string().min(1),
|
|
9
|
+
"consent": z.boolean()
|
|
10
|
+
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ImageFieldData } from 'includio-cms/types';
|
|
1
|
+
import type { ImageFieldData, StructuredContentDoc } from 'includio-cms/types';
|
|
2
2
|
export type SingleSlug = "settings" | "image-showcase";
|
|
3
3
|
export interface Settings {
|
|
4
4
|
id: string;
|
|
@@ -6,6 +6,8 @@ export interface Settings {
|
|
|
6
6
|
data: {
|
|
7
7
|
siteName: string;
|
|
8
8
|
description?: string;
|
|
9
|
+
logo?: ImageFieldData | null;
|
|
10
|
+
favicon?: ImageFieldData | null;
|
|
9
11
|
socialLinks?: ({
|
|
10
12
|
slug: 'socialLink';
|
|
11
13
|
data: {
|
|
@@ -15,6 +17,9 @@ export interface Settings {
|
|
|
15
17
|
};
|
|
16
18
|
};
|
|
17
19
|
})[];
|
|
20
|
+
footerText?: string;
|
|
21
|
+
analyticsId?: string;
|
|
22
|
+
customHeadCode?: string;
|
|
18
23
|
};
|
|
19
24
|
publishedAt: Date | null;
|
|
20
25
|
}
|
|
@@ -29,27 +34,35 @@ export interface ImageShowcase {
|
|
|
29
34
|
export type SingleEntryMap = {
|
|
30
35
|
settings: Settings;
|
|
31
36
|
};
|
|
32
|
-
export type CollectionSlug = "blog-post" | "project";
|
|
37
|
+
export type CollectionSlug = "blog-post" | "project" | "array-test";
|
|
33
38
|
export interface BlogPost {
|
|
34
39
|
id: string;
|
|
35
40
|
slug: string;
|
|
36
41
|
data: {
|
|
37
42
|
title: string;
|
|
38
43
|
slug?: string;
|
|
44
|
+
cover?: ImageFieldData | null;
|
|
45
|
+
rating: number;
|
|
46
|
+
category?: string;
|
|
47
|
+
publishedAt?: string;
|
|
48
|
+
thumbnail?: ImageFieldData | null;
|
|
49
|
+
content?: StructuredContentDoc;
|
|
50
|
+
tags?: string[];
|
|
39
51
|
seo: {
|
|
40
|
-
slug
|
|
52
|
+
slug: string;
|
|
41
53
|
canonicalUrl?: string;
|
|
42
|
-
title
|
|
54
|
+
title: string;
|
|
43
55
|
description?: string;
|
|
44
56
|
ogImage?: string;
|
|
45
57
|
keywords?: string;
|
|
46
58
|
customCode?: string;
|
|
47
59
|
};
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
60
|
+
test?: ({
|
|
61
|
+
slug: 'test-object';
|
|
62
|
+
data: {
|
|
63
|
+
dupa: string;
|
|
64
|
+
};
|
|
65
|
+
})[];
|
|
53
66
|
};
|
|
54
67
|
publishedAt: Date | null;
|
|
55
68
|
}
|
|
@@ -59,6 +72,8 @@ export interface Project {
|
|
|
59
72
|
data: {
|
|
60
73
|
title: string;
|
|
61
74
|
description?: string;
|
|
75
|
+
status?: string;
|
|
76
|
+
startDate?: string;
|
|
62
77
|
url?: {
|
|
63
78
|
url: string;
|
|
64
79
|
};
|
|
@@ -69,8 +84,65 @@ export interface Project {
|
|
|
69
84
|
name: string;
|
|
70
85
|
};
|
|
71
86
|
})[];
|
|
87
|
+
seo: {
|
|
88
|
+
slug: string;
|
|
89
|
+
canonicalUrl?: string;
|
|
90
|
+
title: string;
|
|
91
|
+
description?: string;
|
|
92
|
+
ogImage?: string;
|
|
93
|
+
keywords?: string;
|
|
94
|
+
customCode?: string;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
publishedAt: Date | null;
|
|
98
|
+
}
|
|
99
|
+
export interface ArrayTest {
|
|
100
|
+
id: string;
|
|
101
|
+
slug: string;
|
|
102
|
+
data: {
|
|
103
|
+
name: string;
|
|
104
|
+
tags?: string[];
|
|
105
|
+
localizedTags?: Record<string, string>[];
|
|
106
|
+
scores?: number[];
|
|
107
|
+
links?: UrlFieldData[];
|
|
108
|
+
unlimited?: string[];
|
|
109
|
+
content?: ({
|
|
110
|
+
slug: 'text-block';
|
|
111
|
+
data: {
|
|
112
|
+
heading: string;
|
|
113
|
+
body?: string;
|
|
114
|
+
};
|
|
115
|
+
} | {
|
|
116
|
+
slug: 'image-block';
|
|
117
|
+
data: {
|
|
118
|
+
image: ImageFieldData;
|
|
119
|
+
caption?: string;
|
|
120
|
+
};
|
|
121
|
+
})[];
|
|
122
|
+
highlights?: ({
|
|
123
|
+
slug: 'highlight';
|
|
124
|
+
data: {
|
|
125
|
+
title: string;
|
|
126
|
+
value?: number;
|
|
127
|
+
};
|
|
128
|
+
})[];
|
|
72
129
|
};
|
|
73
130
|
publishedAt: Date | null;
|
|
74
131
|
}
|
|
75
132
|
export type CollectionEntryMap = {};
|
|
76
|
-
export type
|
|
133
|
+
export type FormSlug = "contact";
|
|
134
|
+
export interface Contact {
|
|
135
|
+
data: {
|
|
136
|
+
name: string;
|
|
137
|
+
email: string;
|
|
138
|
+
phone: string;
|
|
139
|
+
subject: string;
|
|
140
|
+
message: string;
|
|
141
|
+
consent: boolean;
|
|
142
|
+
};
|
|
143
|
+
publishedAt: Date | null;
|
|
144
|
+
}
|
|
145
|
+
export type FormMap = {
|
|
146
|
+
contact: Contact;
|
|
147
|
+
};
|
|
148
|
+
export type SiteLanguage = "en" | "pl";
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import { Accordion, AccordionItem, AccordionTrigger, AccordionContent } from './index.js';
|
|
4
|
+
import { Input } from '../input/index.js';
|
|
5
|
+
import { Textarea } from '../textarea/index.js';
|
|
6
|
+
|
|
7
|
+
const { Story } = defineMeta({
|
|
8
|
+
title: 'UI/Layout/Accordion',
|
|
9
|
+
component: Accordion,
|
|
10
|
+
tags: ['autodocs'],
|
|
11
|
+
});
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<Story name="SEO Section">
|
|
15
|
+
<div style="max-width:320px;border:1px solid var(--border);border-radius:12px;overflow:hidden;">
|
|
16
|
+
<Accordion type="single" collapsible>
|
|
17
|
+
<AccordionItem value="seo">
|
|
18
|
+
<AccordionTrigger>
|
|
19
|
+
<span style="display:flex;align-items:center;gap:8px;">
|
|
20
|
+
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/></svg>
|
|
21
|
+
SEO
|
|
22
|
+
</span>
|
|
23
|
+
</AccordionTrigger>
|
|
24
|
+
<AccordionContent>
|
|
25
|
+
<div style="display:flex;flex-direction:column;gap:12px;padding:0 4px;">
|
|
26
|
+
<div>
|
|
27
|
+
<div style="font-size:12px;font-weight:600;color:var(--muted-foreground);margin-bottom:4px;">Meta tytuł</div>
|
|
28
|
+
<Input value="Jak pisać dostępne treści | AriaCMS" />
|
|
29
|
+
</div>
|
|
30
|
+
<div>
|
|
31
|
+
<div style="font-size:12px;font-weight:600;color:var(--muted-foreground);margin-bottom:4px;">Meta opis</div>
|
|
32
|
+
<Textarea rows={2} value="Praktyczny przewodnik po tworzeniu treści dostępnych dla wszystkich." />
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
</AccordionContent>
|
|
36
|
+
</AccordionItem>
|
|
37
|
+
</Accordion>
|
|
38
|
+
</div>
|
|
39
|
+
</Story>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export default Accordion;
|
|
2
|
+
type Accordion = SvelteComponent<{
|
|
3
|
+
[x: string]: never;
|
|
4
|
+
}, {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare const Accordion: $$__sveltets_2_IsomorphicComponent<{
|
|
10
|
+
[x: string]: never;
|
|
11
|
+
}, {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
}, {}, {}, string>;
|
|
14
|
+
import { Accordion } from './index.js';
|
|
15
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
16
|
+
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
17
|
+
$$bindings?: Bindings;
|
|
18
|
+
} & Exports;
|
|
19
|
+
(internal: unknown, props: {
|
|
20
|
+
$$events?: Events;
|
|
21
|
+
$$slots?: Slots;
|
|
22
|
+
}): Exports & {
|
|
23
|
+
$set?: any;
|
|
24
|
+
$on?: any;
|
|
25
|
+
};
|
|
26
|
+
z_$$bindings?: Bindings;
|
|
27
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import { Alert, AlertDescription } from './index.js';
|
|
4
|
+
|
|
5
|
+
const { Story } = defineMeta({
|
|
6
|
+
title: 'UI/Feedback/Alert',
|
|
7
|
+
component: Alert,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
});
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<Story name="Default">
|
|
13
|
+
<div style="max-width:500px;">
|
|
14
|
+
<Alert>
|
|
15
|
+
<AlertDescription>Domyślny alert z neutralnym stylem</AlertDescription>
|
|
16
|
+
</Alert>
|
|
17
|
+
</div>
|
|
18
|
+
</Story>
|
|
19
|
+
|
|
20
|
+
<Story name="Info">
|
|
21
|
+
<div style="max-width:500px;">
|
|
22
|
+
<Alert variant="info">
|
|
23
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/></svg>
|
|
24
|
+
<AlertDescription>Pominięty poziom nagłówka — rozważ H3 zamiast H4</AlertDescription>
|
|
25
|
+
</Alert>
|
|
26
|
+
</div>
|
|
27
|
+
</Story>
|
|
28
|
+
|
|
29
|
+
<Story name="Success">
|
|
30
|
+
<div style="max-width:500px;">
|
|
31
|
+
<Alert variant="success">
|
|
32
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/><polyline points="22 4 12 14.01 9 11.01"/></svg>
|
|
33
|
+
<AlertDescription>Hierarchia nagłówków poprawna</AlertDescription>
|
|
34
|
+
</Alert>
|
|
35
|
+
</div>
|
|
36
|
+
</Story>
|
|
37
|
+
|
|
38
|
+
<Story name="Warning">
|
|
39
|
+
<div style="max-width:500px;">
|
|
40
|
+
<Alert variant="warning">
|
|
41
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg>
|
|
42
|
+
<AlertDescription>1 obraz bez opisu alternatywnego</AlertDescription>
|
|
43
|
+
</Alert>
|
|
44
|
+
</div>
|
|
45
|
+
</Story>
|
|
46
|
+
|
|
47
|
+
<Story name="Destructive">
|
|
48
|
+
<div style="max-width:500px;">
|
|
49
|
+
<Alert variant="destructive">
|
|
50
|
+
<AlertDescription>Nie udało się zapisać — sprawdź wymagane pola</AlertDescription>
|
|
51
|
+
</Alert>
|
|
52
|
+
</div>
|
|
53
|
+
</Story>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export default Alert;
|
|
2
|
+
type Alert = SvelteComponent<{
|
|
3
|
+
[x: string]: never;
|
|
4
|
+
}, {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare const Alert: $$__sveltets_2_IsomorphicComponent<{
|
|
10
|
+
[x: string]: never;
|
|
11
|
+
}, {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
}, {}, {}, string>;
|
|
14
|
+
import { Alert } from './index.js';
|
|
15
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
16
|
+
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
17
|
+
$$bindings?: Bindings;
|
|
18
|
+
} & Exports;
|
|
19
|
+
(internal: unknown, props: {
|
|
20
|
+
$$events?: Events;
|
|
21
|
+
$$slots?: Slots;
|
|
22
|
+
}): Exports & {
|
|
23
|
+
$set?: any;
|
|
24
|
+
$on?: any;
|
|
25
|
+
};
|
|
26
|
+
z_$$bindings?: Bindings;
|
|
27
|
+
}
|
|
@@ -8,6 +8,11 @@
|
|
|
8
8
|
default: "bg-card text-card-foreground",
|
|
9
9
|
destructive:
|
|
10
10
|
"text-destructive bg-card *:data-[slot=alert-description]:text-destructive/90 [&>svg]:text-current",
|
|
11
|
+
success:
|
|
12
|
+
"border-success/20 bg-success-bg text-success *:data-[slot=alert-description]:text-success/90 [&>svg]:text-current",
|
|
13
|
+
warning:
|
|
14
|
+
"border-warning/20 bg-warning-bg text-warning *:data-[slot=alert-description]:text-warning/90 [&>svg]:text-current",
|
|
15
|
+
info: "border-primary/15 bg-lavender-lighter text-plum-dark *:data-[slot=alert-description]:text-plum-dark/90 [&>svg]:text-current",
|
|
11
16
|
},
|
|
12
17
|
},
|
|
13
18
|
defaultVariants: {
|
|
@@ -3,16 +3,25 @@ export declare const alertVariants: import("tailwind-variants").TVReturnType<{
|
|
|
3
3
|
variant: {
|
|
4
4
|
default: string;
|
|
5
5
|
destructive: string;
|
|
6
|
+
success: string;
|
|
7
|
+
warning: string;
|
|
8
|
+
info: string;
|
|
6
9
|
};
|
|
7
10
|
}, undefined, "relative grid w-full grid-cols-[0_1fr] items-start gap-y-0.5 rounded-lg border px-4 py-3 text-sm has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] has-[>svg]:gap-x-3 [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current", {
|
|
8
11
|
variant: {
|
|
9
12
|
default: string;
|
|
10
13
|
destructive: string;
|
|
14
|
+
success: string;
|
|
15
|
+
warning: string;
|
|
16
|
+
info: string;
|
|
11
17
|
};
|
|
12
18
|
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
13
19
|
variant: {
|
|
14
20
|
default: string;
|
|
15
21
|
destructive: string;
|
|
22
|
+
success: string;
|
|
23
|
+
warning: string;
|
|
24
|
+
info: string;
|
|
16
25
|
};
|
|
17
26
|
}, undefined, "relative grid w-full grid-cols-[0_1fr] items-start gap-y-0.5 rounded-lg border px-4 py-3 text-sm has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] has-[>svg]:gap-x-3 [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current", unknown, unknown, undefined>>;
|
|
18
27
|
export type AlertVariant = VariantProps<typeof alertVariants>["variant"];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import { Avatar, AvatarFallback } from './index.js';
|
|
4
|
+
|
|
5
|
+
const { Story } = defineMeta({
|
|
6
|
+
title: 'UI/Data/Avatar',
|
|
7
|
+
component: Avatar,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
});
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<Story name="Gradient">
|
|
13
|
+
<Avatar style="background:linear-gradient(135deg, var(--lavender), var(--primary));">
|
|
14
|
+
<AvatarFallback style="background:transparent;color:white;font-weight:700;font-size:12px;">PK</AvatarFallback>
|
|
15
|
+
</Avatar>
|
|
16
|
+
</Story>
|