urpanels-ui-pack 0.0.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.
Files changed (62) hide show
  1. package/README.md +37 -0
  2. package/dist/Button/Button.svelte +76 -0
  3. package/dist/Button/Button.svelte.d.ts +13 -0
  4. package/dist/Button/index.d.ts +1 -0
  5. package/dist/Button/index.js +1 -0
  6. package/dist/InfoCard/InfoCard.svelte +227 -0
  7. package/dist/InfoCard/InfoCard.svelte.d.ts +4 -0
  8. package/dist/InfoCard/InfoCard.types.d.ts +56 -0
  9. package/dist/InfoCard/InfoCard.types.js +1 -0
  10. package/dist/InfoCard/index.d.ts +2 -0
  11. package/dist/InfoCard/index.js +1 -0
  12. package/dist/LoadingSpinner/LoadingSpinner.svelte +3 -0
  13. package/dist/LoadingSpinner/LoadingSpinner.svelte.d.ts +26 -0
  14. package/dist/LoadingSpinner/index.d.ts +1 -0
  15. package/dist/LoadingSpinner/index.js +1 -0
  16. package/dist/Modal/Modal.svelte +122 -0
  17. package/dist/Modal/Modal.svelte.d.ts +39 -0
  18. package/dist/Modal/index.d.ts +1 -0
  19. package/dist/Modal/index.js +1 -0
  20. package/dist/PageLayout/ActionButton.svelte +26 -0
  21. package/dist/PageLayout/ActionButton.svelte.d.ts +8 -0
  22. package/dist/PageLayout/PageContent.svelte +19 -0
  23. package/dist/PageLayout/PageContent.svelte.d.ts +8 -0
  24. package/dist/PageLayout/PageHeader.svelte +29 -0
  25. package/dist/PageLayout/PageHeader.svelte.d.ts +9 -0
  26. package/dist/PageLayout/SearchBar.svelte +25 -0
  27. package/dist/PageLayout/SearchBar.svelte.d.ts +8 -0
  28. package/dist/PageLayout/ViewToggle.svelte +53 -0
  29. package/dist/PageLayout/ViewToggle.svelte.d.ts +8 -0
  30. package/dist/PageLayout/index.d.ts +5 -0
  31. package/dist/PageLayout/index.js +5 -0
  32. package/dist/Pagination/Pagination.svelte +96 -0
  33. package/dist/Pagination/Pagination.svelte.d.ts +4 -0
  34. package/dist/Pagination/Pagination.types.d.ts +11 -0
  35. package/dist/Pagination/Pagination.types.js +1 -0
  36. package/dist/Pagination/index.d.ts +2 -0
  37. package/dist/Pagination/index.js +1 -0
  38. package/dist/RichTextEditor/RichTextEditor.svelte +575 -0
  39. package/dist/RichTextEditor/RichTextEditor.svelte.d.ts +10 -0
  40. package/dist/RichTextEditor/index.d.ts +1 -0
  41. package/dist/RichTextEditor/index.js +1 -0
  42. package/dist/index.d.ts +5 -0
  43. package/dist/index.js +12 -0
  44. package/dist/sections/ArticlesGrid/ArticlesGrid.svelte +201 -0
  45. package/dist/sections/ArticlesGrid/ArticlesGrid.svelte.d.ts +31 -0
  46. package/dist/sections/ArticlesGrid/README.md +229 -0
  47. package/dist/sections/ArticlesGrid/index.d.ts +2 -0
  48. package/dist/sections/ArticlesGrid/index.js +1 -0
  49. package/dist/sections/FeaturedGalleryGrid/FeaturedGalleryGrid.svelte +118 -0
  50. package/dist/sections/FeaturedGalleryGrid/FeaturedGalleryGrid.svelte.d.ts +21 -0
  51. package/dist/sections/FeaturedGalleryGrid/README.md +270 -0
  52. package/dist/sections/FeaturedGalleryGrid/index.d.ts +2 -0
  53. package/dist/sections/FeaturedGalleryGrid/index.js +1 -0
  54. package/dist/sections/HeroCarousel/HeroCarousel.svelte +318 -0
  55. package/dist/sections/HeroCarousel/HeroCarousel.svelte.d.ts +23 -0
  56. package/dist/sections/HeroCarousel/index.d.ts +1 -0
  57. package/dist/sections/HeroCarousel/index.js +1 -0
  58. package/dist/sections/index.d.ts +5 -0
  59. package/dist/sections/index.js +3 -0
  60. package/dist/utils/translations.svelte.d.ts +37 -0
  61. package/dist/utils/translations.svelte.js +67 -0
  62. package/package.json +47 -0
@@ -0,0 +1,67 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ /**
3
+ * Get translations from window (set by layout)
4
+ */
5
+ function getTranslations() {
6
+ if (typeof window !== 'undefined' && window.__urpanels_translations) {
7
+ return window.__urpanels_translations;
8
+ }
9
+ return {};
10
+ }
11
+ /**
12
+ * Get translation by key
13
+ * Supports nested keys with dot notation (e.g., 'students.title')
14
+ *
15
+ * @param key - Translation key (dot notation for nested)
16
+ * @param fallback - Fallback value if key not found (defaults to key itself)
17
+ * @param params - Optional parameters for interpolation (e.g., { count: 5 })
18
+ * @returns Translated string or fallback
19
+ *
20
+ * @example
21
+ * t('common.save') // Returns "Kaydet" or "Save"
22
+ * t('students.title') // Returns "Öğrenciler" or "Students"
23
+ * t('validation.minLength', undefined, { min: 3 }) // Returns "En az 3 karakter olmalıdır"
24
+ */
25
+ export function t(key, fallback, params) {
26
+ const translations = getTranslations();
27
+ const keys = key.split('.');
28
+ let value = translations;
29
+ for (const k of keys) {
30
+ if (value && typeof value === 'object' && k in value) {
31
+ value = value[k];
32
+ }
33
+ else {
34
+ return fallback !== null && fallback !== void 0 ? fallback : key;
35
+ }
36
+ }
37
+ if (typeof value !== 'string') {
38
+ return fallback !== null && fallback !== void 0 ? fallback : key;
39
+ }
40
+ if (params) {
41
+ return value.replace(/\{(\w+)\}/g, (_, paramKey) => {
42
+ return params[paramKey] !== undefined ? String(params[paramKey]) : `{${paramKey}}`;
43
+ });
44
+ }
45
+ return value;
46
+ }
47
+ export function getCurrentLanguage() {
48
+ if (typeof window !== 'undefined' && window.__urpanels_language) {
49
+ return window.__urpanels_language;
50
+ }
51
+ return 'tr';
52
+ }
53
+ export function isTranslationsLoaded() {
54
+ if (typeof window !== 'undefined') {
55
+ return window.__urpanels_translations_loaded || false;
56
+ }
57
+ return false;
58
+ }
59
+ export function getAllTranslations() {
60
+ return getTranslations();
61
+ }
62
+ export async function initTranslations(_apiFront, _settings) {
63
+ // No-op - layout handles initialization
64
+ }
65
+ export async function changeLanguage(_apiFront, _language) {
66
+ // No-op - layout handles language changes
67
+ }
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "urpanels-ui-pack",
3
+ "version": "0.0.2",
4
+ "description": "Reusable Svelte 5 UI components for urPanels templates",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "scripts": {
8
+ "check": "svelte-check --tsconfig ./tsconfig.json",
9
+ "build": "svelte-package",
10
+ "prepare": "npm run build"
11
+ },
12
+ "exports": {
13
+ ".": {
14
+ "types": "./dist/index.d.ts",
15
+ "svelte": "./dist/index.js",
16
+ "import": "./dist/index.js",
17
+ "default": "./dist/index.js"
18
+ },
19
+ "./package.json": "./package.json"
20
+ },
21
+ "files": [
22
+ "dist"
23
+ ],
24
+ "svelte": "./dist/index.js",
25
+ "types": "./dist/index.d.ts",
26
+ "main": "./dist/index.js",
27
+ "module": "./dist/index.js",
28
+ "devDependencies": {
29
+ "@sveltejs/package": "^2.3.0",
30
+ "@sveltejs/vite-plugin-svelte": "^6.1.3",
31
+ "svelte": "^5.0.0",
32
+ "svelte-check": "^4.3.1",
33
+ "typescript": "^5.9.2"
34
+ },
35
+ "peerDependencies": {
36
+ "svelte": "^5.0.0"
37
+ },
38
+ "dependencies": {
39
+ "@tiptap/core": "^3.15.3",
40
+ "@tiptap/extension-table": "^3.15.3",
41
+ "@tiptap/extension-table-cell": "^3.15.3",
42
+ "@tiptap/extension-table-header": "^3.15.3",
43
+ "@tiptap/extension-table-row": "^3.15.3",
44
+ "@tiptap/pm": "^3.15.3",
45
+ "@tiptap/starter-kit": "^3.15.3"
46
+ }
47
+ }