intelliwaketssveltekitv25 0.1.121 → 0.1.123

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.
@@ -1,6 +1,7 @@
1
1
  import type { Writable } from 'svelte/store';
2
2
  import { type TDateAny } from '@solidbasisventures/intelliwaketsfoundation';
3
3
  import type { IconDefinition } from '@fortawesome/fontawesome-common-types';
4
+ import type { Snippet } from 'svelte';
4
5
  export interface IFAProps {
5
6
  icon: IconDefinition;
6
7
  size?: 'xs' | 'sm' | 'lg' | '1x' | '2x' | '3x' | '4x' | '5x' | '6x' | '7x' | '8x' | '9x' | '10x';
@@ -62,8 +63,8 @@ export interface ISpinItem<T = number> {
62
63
  classItem?: string | null;
63
64
  }
64
65
  export type TListGroupItem = {
65
- title: string;
66
- sub_title?: string;
66
+ title: string | Snippet;
67
+ sub_title?: string | Snippet;
67
68
  hover_title?: string;
68
69
  hidden?: boolean;
69
70
  faProps?: IFAProps;
@@ -1,5 +1,6 @@
1
1
  <script lang='ts'>
2
2
  import { IncludesHTML, ReplaceLinks, TextToHTML } from '@solidbasisventures/intelliwaketsfoundation'
3
+ import type { Snippet } from 'svelte'
3
4
 
4
5
  let {
5
6
  value,
@@ -9,7 +10,7 @@
9
10
  */
10
11
  noLinkReplace = false
11
12
  }: {
12
- value: string | null | undefined
13
+ value: string | null | undefined | Snippet
13
14
  anchorClasses?: string
14
15
  /**
15
16
  * Use the noLinkReplace property to not try to change a URL into an anchor link
@@ -17,15 +18,23 @@
17
18
  noLinkReplace?: boolean
18
19
  } = $props()
19
20
 
20
- let valueLink = $derived(((noLinkReplace ? (value ?? '') : ReplaceLinks(TextToHTML((value ?? '').toString()), anchorClasses)) ?? '').toString())
21
+ let isSnippet = $derived(!!value && typeof value === 'function')
21
22
 
22
- let isHTML = $derived(IncludesHTML((valueLink ?? '').toString()))
23
+ let valueLink = $derived(isSnippet ? null : ((noLinkReplace ? (value ?? '') : ReplaceLinks(TextToHTML((value ?? '').toString()), anchorClasses)) ?? '').toString())
24
+
25
+ let isHTML = $derived(!isSnippet && IncludesHTML((valueLink ?? '').toString()))
23
26
  </script>
24
27
 
25
- {#if valueLink}
26
- {#if isHTML}
27
- {@html valueLink}
28
+ {#if !!value}
29
+ {#if typeof value === 'function'}
30
+ {@render value()}
28
31
  {:else}
29
- {valueLink}
32
+ {#if valueLink}
33
+ {#if isHTML}
34
+ {@html valueLink}
35
+ {:else}
36
+ {valueLink}
37
+ {/if}
38
+ {/if}
30
39
  {/if}
31
40
  {/if}
@@ -1,5 +1,6 @@
1
+ import type { Snippet } from 'svelte';
1
2
  type $$ComponentProps = {
2
- value: string | null | undefined;
3
+ value: string | null | undefined | Snippet;
3
4
  anchorClasses?: string;
4
5
  /**
5
6
  * Use the noLinkReplace property to not try to change a URL into an anchor link
@@ -130,19 +130,20 @@
130
130
  {:else}
131
131
  {#each subItems as listItem, idx (getKey(listItem))}
132
132
  {#if listItem?.section && listItem.section !== subItems[idx - 1]?.section}
133
- <li class='listGroupHeader block w-full select-none font-bold p-1 cursor-pointer sticky top-0 bg-primary-main text-white'
134
- class:mt-4={rounded}
135
- class:overflow-x-hidden={wrapText || ellipses}
136
- class:whitespace-nowrap={!wrapText}
137
- class:mt-1={idx > 0}
138
- class:roundedListGroupItem={rounded}
139
- class:rounded-lg={rounded}
140
- class:px-2={rounded}
141
- title={listItem.hover_title}
142
- role='menuitem'
143
- tabindex={-1}
144
- onkeydown={e => doKeyExecute(e, () => sectionClick(listItem.section ?? ""))}
145
- onclick={() => sectionClick(listItem?.section ?? "")}>
133
+ <li
134
+ class='listGroupHeader block w-full select-none font-bold p-1 cursor-pointer sticky top-0 bg-primary-main text-white'
135
+ class:mt-4={rounded}
136
+ class:overflow-x-hidden={wrapText || ellipses}
137
+ class:whitespace-nowrap={!wrapText}
138
+ class:mt-1={idx > 0}
139
+ class:roundedListGroupItem={rounded}
140
+ class:rounded-lg={rounded}
141
+ class:px-2={rounded}
142
+ title={listItem.hover_title}
143
+ role='menuitem'
144
+ tabindex={-1}
145
+ onkeydown={e => doKeyExecute(e, () => sectionClick(listItem.section ?? ""))}
146
+ onclick={() => sectionClick(listItem?.section ?? "")}>
146
147
  <DisplayHTML noLinkReplace={listItem.noLinkReplace ?? noLinkReplace}
147
148
  value={listItem.section} />
148
149
  </li>
@@ -229,7 +230,7 @@
229
230
  <Icon fw
230
231
  scale={!listItem.bigIcon ? 1 : 2}
231
232
  {...listItem.faProps}
232
- class={`mr-2 inline-block ${!listItem.bigIcon ? '' : 'ml-2'} ${listItem.faProps.class ?? ''}`.trim()}/>
233
+ class={`mr-2 inline-block ${!listItem.bigIcon ? '' : 'ml-2'} ${listItem.faProps.class ?? ''}`.trim()} />
233
234
  {/if}
234
235
  {#if !!listItem.icon}
235
236
  <Icon fw
@@ -241,7 +242,7 @@
241
242
  <div class='overflow-hidden'
242
243
  class:whitespace-nowrap={!wrapText}
243
244
  class:text-ellipsis={!wrapText && ellipses}
244
- title={!ellipses ? undefined : listItem.title}>
245
+ title={!ellipses ? undefined : typeof listItem.title === 'string' ? listItem.title : ''}>
245
246
  <DisplayHTML noLinkReplace={listItem.noLinkReplace ?? noLinkReplace}
246
247
  value={listItem.title} />
247
248
  {#if listItem.sub_title && !rounded}
@@ -313,7 +314,7 @@
313
314
  <div class='overflow-hidden'
314
315
  class:whitespace-nowrap={!wrapText}
315
316
  class:text-ellipsis={!wrapText && ellipses}
316
- title={!ellipses ? undefined : listItem.title}>
317
+ title={!ellipses ? undefined : typeof listItem.title === 'string' ? listItem.title : ''}>
317
318
  <DisplayHTML noLinkReplace={listItem.noLinkReplace ?? noLinkReplace}
318
319
  value={listItem.title} />
319
320
  {#if listItem.sub_title}
@@ -101,6 +101,15 @@ export class PathAnalyzer {
101
101
  return BuildPath('/', ...this.predecessorComponents);
102
102
  let components = [...this.preComponents, ...this.activePageComponents];
103
103
  if (!components[components.length - 1]?.toLowerCase().startsWith('tab')) {
104
+ const indexOfBase = components.findIndex(comp => comp === this.base);
105
+ const indexOfTab = components.findIndex(comp => comp.toLowerCase().startsWith('tab'));
106
+ if (indexOfBase > 0 && indexOfBase >= indexOfTab) {
107
+ const indexOfTilde = components.findIndex(comp => comp === '~');
108
+ if (indexOfTilde > 0) {
109
+ return BuildPath('/', ...components.slice(0, indexOfBase + 1), ...components.slice(indexOfTilde, components.length - 1));
110
+ }
111
+ return BuildPath('/', ...components.slice(0, indexOfBase + 1));
112
+ }
104
113
  return BuildPath('/', ...components.slice(0, components.length - 1));
105
114
  }
106
115
  while (components[components.length - 1]?.toLowerCase().startsWith('tab')) {
@@ -163,16 +172,16 @@ export class PathAnalyzer {
163
172
  if (closeIfOpen) {
164
173
  // const pathNoDigits = path.replace(/[0-9]/g, '')
165
174
  if (this.isOpen(path)) {
166
- if (path.includes('/')) {
167
- return BuildPath(this.basePath, path.substring(0, path.indexOf('/')));
168
- }
169
- else {
170
- // if (path === pathNoDigits) {
171
- return this.basePath;
172
- // } else {
173
- // return BuildPath(this.basePath, pathNoDigits)
174
- // }
175
- }
175
+ // if (path.includes('/')) {
176
+ // console.log(this.base, this.basePath, path)
177
+ // return BuildPath(this.basePath, path.substring(0, path.indexOf('/')))
178
+ // } else {
179
+ // if (path === pathNoDigits) {
180
+ return this.basePath;
181
+ // } else {
182
+ // return BuildPath(this.basePath, pathNoDigits)
183
+ // }
184
+ // }
176
185
  // } else if (pathNoDigits !== path && path === this.activePageSlug) {
177
186
  // return BuildPath(this.basePath, pathNoDigits)
178
187
  // } else if (pathNoDigits === path && path === (this.activePageSlug ?? '').replace(/[0-9]/g, '') && pathNoDigits !== this.activePage) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intelliwaketssveltekitv25",
3
- "version": "0.1.121",
3
+ "version": "0.1.123",
4
4
  "exports": {
5
5
  ".": {
6
6
  "types": "./dist/index.d.ts",