@sierra-95/svelte-scaffold 1.2.19 → 1.2.21

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.
@@ -0,0 +1,36 @@
1
+ <script lang="ts">
2
+ import { isDesktop } from "../../../../index.js";
3
+
4
+ const {
5
+ navBackground = 'var(--background)',
6
+ contentPadding = '24px',
7
+ contentBackground = 'var(--background)',
8
+ navItems,
9
+ children
10
+ } = $props()
11
+ </script>
12
+
13
+ <style>
14
+ #sierra-content-switcher {
15
+ display: flex;
16
+ height: 100%;
17
+ }
18
+ #sierra-content-switcher nav ul {
19
+ width: 100%;
20
+ }
21
+ #sierra-content-switcher div{
22
+ overflow-y: auto;
23
+ flex: 1;
24
+ }
25
+ </style>
26
+
27
+ <main id="sierra-content-switcher" style="{!$isDesktop ? 'flex-direction: column-reverse;' : ''}">
28
+ <nav style="{!$isDesktop ? 'width:100%;' : 'width: 300px;'}; background-color: {navBackground}">
29
+ <ul style="{!$isDesktop ? 'display:flex; justify-content: center;' : ''}">
30
+ {@render navItems?.()}
31
+ </ul>
32
+ </nav>
33
+ <div style="padding: {contentPadding};background-color: {contentBackground}">
34
+ {@render children?.()}
35
+ </div>
36
+ </main>
@@ -0,0 +1,9 @@
1
+ declare const ContentSwitcher: import("svelte").Component<{
2
+ navBackground?: string;
3
+ contentPadding?: string;
4
+ contentBackground?: string;
5
+ navItems: any;
6
+ children: any;
7
+ }, {}, "">;
8
+ type ContentSwitcher = ReturnType<typeof ContentSwitcher>;
9
+ export default ContentSwitcher;
@@ -1,7 +1,7 @@
1
- export declare function buildRedirectUrl(baseUrl: string, redirectTo?: string): string;
1
+ export declare function buildRedirectUrl(baseUrl: string, redirectTo?: string, extraParameters?: Record<string, string>): string;
2
2
  type RedirectOptions = {
3
3
  replaceState?: boolean;
4
4
  useHardRedirect?: boolean;
5
5
  };
6
- export declare function handleRedirect(baseUrl: string, redirectTo?: string, options?: RedirectOptions): void;
6
+ export declare function handleRedirect(baseUrl: string, redirectTo?: string, options?: RedirectOptions, extraParameters?: Record<string, string>): void;
7
7
  export {};
@@ -14,16 +14,23 @@ function sanitizeRedirect(redirectTo) {
14
14
  }
15
15
  return redirectTo;
16
16
  }
17
- export function buildRedirectUrl(baseUrl, redirectTo) {
17
+ export function buildRedirectUrl(baseUrl, redirectTo, extraParameters = {}) {
18
18
  const safe = sanitizeRedirect(redirectTo);
19
- return safe
20
- ? `${baseUrl}?redirectTo=${encodeURIComponent(safe)}`
21
- : baseUrl;
19
+ const url = new URL(baseUrl, window.location.origin);
20
+ Object.entries(extraParameters).forEach(([key, value]) => {
21
+ if (value !== undefined && value !== null) {
22
+ url.searchParams.set(key, value);
23
+ }
24
+ });
25
+ if (safe) {
26
+ url.searchParams.set('redirectTo', safe);
27
+ }
28
+ return url.pathname + url.search;
22
29
  }
23
- export function handleRedirect(baseUrl, redirectTo, options = {}) {
30
+ export function handleRedirect(baseUrl, redirectTo, options = {}, extraParameters = {}) {
24
31
  if (!browser)
25
32
  return;
26
- const finalUrl = buildRedirectUrl(baseUrl, redirectTo);
33
+ const finalUrl = buildRedirectUrl(baseUrl, redirectTo, extraParameters);
27
34
  const { replaceState = false, useHardRedirect = false } = options;
28
35
  if (useHardRedirect) {
29
36
  window.location.href = finalUrl;
package/dist/index.d.ts CHANGED
@@ -29,6 +29,7 @@ export { default as MenuItem } from './Core/components/Menus/MenuItem/menuItem.s
29
29
  export { default as DropdownContainer } from './Core/components/Menus/DropdownContainer/dropdown.svelte';
30
30
  export { default as Tabs } from './Core/components/Menus/Tabs/main.svelte';
31
31
  export { default as HamburgerMenu } from './Core/components/Menus/Hamburger/hamburger.svelte';
32
+ export { default as ContentSwitcher } from './Core/components/Menus/ContentSwitcher/contentSwitcher.svelte';
32
33
  export { default as Modal } from './Core/components/others/Modal/modal.svelte';
33
34
  export { default as Backdrop } from './Core/components/others/Backdrop/backdrop.svelte';
34
35
  export { default as Wrapper } from './Core/components/others/Wrapper/wrapper.svelte';
@@ -56,11 +57,11 @@ export { fileInputStore, resetFileInputStore, fileInputConfig } from './stores/m
56
57
  export type { FileInputStoreMediaItem } from './stores/modules/fileInput.js';
57
58
  export { layoutStore, resetLayoutStore } from './stores/modules/layout.js';
58
59
  export { addToast, removeToast, toasts } from './stores/features/toastManager.js';
59
- export { getPreviewUrlForMedia, toggleSelectForMedia, removeFileForMedia, DOCUMENT_MIME_TYPES, IMAGE_MIME_TYPES_PREVIEW } from './Hooks/preview.js';
60
- export { validateLayoutMenuSections, filterSectionsByRole } from './Hooks/layout_menu.js';
61
- export { buttonRipple } from './Hooks/button.js';
62
- export { buildSearchIndex } from './Hooks/buildSearch.js';
63
- export { isValidEmail } from './Hooks/validateForms.js';
64
- export { handleRedirect, buildRedirectUrl } from './Hooks/redirectTo.js';
65
- export type { SearchResult } from './Hooks/buildSearch.js';
60
+ export { getPreviewUrlForMedia, toggleSelectForMedia, removeFileForMedia, DOCUMENT_MIME_TYPES, IMAGE_MIME_TYPES_PREVIEW } from './Utils/preview.js';
61
+ export { validateLayoutMenuSections, filterSectionsByRole } from './Utils/layout_menu.js';
62
+ export { buttonRipple } from './Utils/button.js';
63
+ export { buildSearchIndex } from './Utils/buildSearch.js';
64
+ export { isValidEmail } from './Utils/validateForms.js';
65
+ export { handleRedirect, buildRedirectUrl } from './Utils/redirectTo.js';
66
+ export type { SearchResult } from './Utils/buildSearch.js';
66
67
  export type { Section, SectionItem } from './stores/modules/layout.js';
package/dist/index.js CHANGED
@@ -35,6 +35,7 @@ export { default as MenuItem } from './Core/components/Menus/MenuItem/menuItem.s
35
35
  export { default as DropdownContainer } from './Core/components/Menus/DropdownContainer/dropdown.svelte';
36
36
  export { default as Tabs } from './Core/components/Menus/Tabs/main.svelte';
37
37
  export { default as HamburgerMenu } from './Core/components/Menus/Hamburger/hamburger.svelte';
38
+ export { default as ContentSwitcher } from './Core/components/Menus/ContentSwitcher/contentSwitcher.svelte';
38
39
  //others
39
40
  export { default as Modal } from './Core/components/others/Modal/modal.svelte';
40
41
  export { default as Backdrop } from './Core/components/others/Backdrop/backdrop.svelte';
@@ -68,9 +69,9 @@ export { fileInputStore, resetFileInputStore, fileInputConfig } from './stores/m
68
69
  export { layoutStore, resetLayoutStore } from './stores/modules/layout.js';
69
70
  export { addToast, removeToast, toasts } from './stores/features/toastManager.js';
70
71
  //#######################HOOKS/UTILS########################
71
- export { getPreviewUrlForMedia, toggleSelectForMedia, removeFileForMedia, DOCUMENT_MIME_TYPES, IMAGE_MIME_TYPES_PREVIEW } from './Hooks/preview.js';
72
- export { validateLayoutMenuSections, filterSectionsByRole } from './Hooks/layout_menu.js';
73
- export { buttonRipple } from './Hooks/button.js';
74
- export { buildSearchIndex } from './Hooks/buildSearch.js';
75
- export { isValidEmail } from './Hooks/validateForms.js';
76
- export { handleRedirect, buildRedirectUrl } from './Hooks/redirectTo.js';
72
+ export { getPreviewUrlForMedia, toggleSelectForMedia, removeFileForMedia, DOCUMENT_MIME_TYPES, IMAGE_MIME_TYPES_PREVIEW } from './Utils/preview.js';
73
+ export { validateLayoutMenuSections, filterSectionsByRole } from './Utils/layout_menu.js';
74
+ export { buttonRipple } from './Utils/button.js';
75
+ export { buildSearchIndex } from './Utils/buildSearch.js';
76
+ export { isValidEmail } from './Utils/validateForms.js';
77
+ export { handleRedirect, buildRedirectUrl } from './Utils/redirectTo.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sierra-95/svelte-scaffold",
3
- "version": "1.2.19",
3
+ "version": "1.2.21",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run prepack",
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes