intelliwaketssveltekitv25 1.0.33 → 1.0.35

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.
@@ -177,7 +177,9 @@
177
177
  <div
178
178
  class='relative not-print:grid not-print:grid-rows-1 not-print:overflow-hidden'>
179
179
  {#if detail}
180
- {@render detail()}
180
+ {#key pathAnalyzer?.activePageSlug}
181
+ {@render detail()}
182
+ {/key}
181
183
  {/if}
182
184
  </div>
183
185
  </div>
@@ -10,10 +10,9 @@
10
10
  ToArray,
11
11
  ToDigits
12
12
  } from '@solidbasisventures/intelliwaketsfoundation'
13
- import { CookieCreate, CookieErase, CookieRead, type IDDAction, PageAdvanceSize } from './index'
13
+ import { type IDDAction, PageAdvanceSize } from './index'
14
14
  import { page as pageState } from '$app/state'
15
15
  import { goto, invalidate as doInvalidate, invalidateAll } from '$app/navigation'
16
- import { browser } from '$app/environment'
17
16
  import DropDown from './DropDown.svelte'
18
17
  import { untrack } from 'svelte'
19
18
 
@@ -22,18 +21,16 @@
22
21
  pageCount,
23
22
  verbose = false,
24
23
  updateQueryParams = false,
25
- cookieParms = false,
26
- cookieDays,
27
24
  invalidate,
28
- class: clazz = ''
25
+ class: clazz = '',
26
+ onPageChange
29
27
  }: (Pick<IPaginatorResponse, 'page' | 'pageCount'> &
30
28
  {
31
29
  verbose?: boolean
32
30
  updateQueryParams?: boolean | string
33
- cookieParms?: boolean | string
34
- cookieDays?: number
35
31
  invalidate?: string | string[] | (string | URL | ((url: URL) => boolean)) | (string | URL | ((url: URL) => boolean))[] | null
36
- class?: string
32
+ class?: string,
33
+ onPageChange?: (page: number) => void | Promise<void>
37
34
  }) = $props()
38
35
 
39
36
  type TDisplay = {
@@ -50,6 +47,7 @@
50
47
 
51
48
  function setPage(newPage: number) {
52
49
  page = newPage
50
+ if (onPageChange) onPageChange(page)
53
51
  }
54
52
 
55
53
  function createDisplay(parm_page: number, parm_pageCount: number, parm_clientWidth: number): TDisplay {
@@ -110,7 +108,6 @@
110
108
  let display = $derived(createDisplay(page, pageCount, clientWidth))
111
109
 
112
110
  let queryParamName = $derived(!updateQueryParams ? null : updateQueryParams === true ? 'page' : updateQueryParams)
113
- let cookieName = $derived(!cookieParms ? null : cookieParms === true ? 'page' : cookieParms)
114
111
 
115
112
  function performInvalidate() {
116
113
  if (page !== lastPage) {
@@ -133,9 +130,9 @@
133
130
  // Don't run the effect until clientWidth has been measured
134
131
  if (!clientWidth) return
135
132
 
136
- if (queryParamName || cookieName) {
137
- if (verbose) console.info('Paginator query/cookie', queryParamName, cookieName)
138
- const currentValue = CleanNumberNull(cookieName ? CookieRead(cookieName) : queryParamName ? pageState.url.searchParams.get(queryParamName) : null)
133
+ if (queryParamName) {
134
+ if (verbose) console.info('Paginator query', queryParamName)
135
+ const currentValue = CleanNumberNull(queryParamName ? pageState.url.searchParams.get(queryParamName) : null)
139
136
  const gotoSettings: {
140
137
  replaceState?: boolean | undefined;
141
138
  invalidateAll?: boolean | undefined;
@@ -151,18 +148,6 @@
151
148
  pageState.url.searchParams.delete(queryParamName)
152
149
  if (verbose) console.info('Paginator goto url', pageState.url, gotoSettings)
153
150
  goto(pageState.url, gotoSettings)
154
- } else if (cookieName) {
155
- if (verbose) console.info('Paginator Erase Cookie')
156
- CookieErase(cookieName)
157
- if (invalidate) {
158
- if (verbose) console.info('Paginator calling invalidate')
159
- performInvalidate()
160
- } else {
161
- if (verbose) console.info('Paginator doing a reload')
162
- if (browser) {
163
- window.location.reload()
164
- }
165
- }
166
151
  }
167
152
  }
168
153
  } else if (display.page !== currentValue) {
@@ -170,18 +155,6 @@
170
155
  pageState.url.searchParams.set(queryParamName, display.page.toString())
171
156
  if (verbose) console.info('Paginator goto url 2', pageState.url, gotoSettings)
172
157
  goto(pageState.url, gotoSettings)
173
- } else if (cookieName) {
174
- if (verbose) console.info('Paginator Cookie Create', display.page.toString(), cookieDays)
175
- CookieCreate(cookieName, display.page.toString(), cookieDays)
176
- if (invalidate) {
177
- if (verbose) console.info('Paginator calling invalidate 2')
178
- performInvalidate()
179
- } else {
180
- if (verbose) console.info('Paginator doing a reload 2')
181
- if (browser) {
182
- window.location.reload()
183
- }
184
- }
185
158
  }
186
159
  }
187
160
  } else if (invalidate) {
@@ -2,10 +2,9 @@ import { type IPaginatorResponse } from '@solidbasisventures/intelliwaketsfounda
2
2
  type $$ComponentProps = (Pick<IPaginatorResponse, 'page' | 'pageCount'> & {
3
3
  verbose?: boolean;
4
4
  updateQueryParams?: boolean | string;
5
- cookieParms?: boolean | string;
6
- cookieDays?: number;
7
5
  invalidate?: string | string[] | (string | URL | ((url: URL) => boolean)) | (string | URL | ((url: URL) => boolean))[] | null;
8
6
  class?: string;
7
+ onPageChange?: (page: number) => void | Promise<void>;
9
8
  });
10
9
  declare const Paginator: import("svelte").Component<$$ComponentProps, {}, "page">;
11
10
  type Paginator = ReturnType<typeof Paginator>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intelliwaketssveltekitv25",
3
- "version": "1.0.33",
3
+ "version": "1.0.35",
4
4
  "exports": {
5
5
  ".": {
6
6
  "types": "./dist/index.d.ts",