@lexriver/dome 1.5.10 → 2.0.0
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/out/{AnimatedArray.d.ts → src/AnimatedArray.d.mts} +29 -29
- package/out/{AnimatedArray.js → src/AnimatedArray.mjs} +52 -51
- package/out/{AnimatedTable.d.ts → src/AnimatedTable.d.mts} +38 -38
- package/out/{AnimatedTable.js → src/AnimatedTable.mjs} +88 -91
- package/out/{AnimatedText.d.ts → src/AnimatedText.d.mts} +13 -13
- package/out/{AnimatedText.js → src/AnimatedText.mjs} +24 -24
- package/out/{Animation.d.ts → src/Animation.d.mts} +4 -4
- package/out/{temp-test.d.ts → src/Animation.mjs} +1 -1
- package/out/{Dome.d.ts → src/Dome.d.mts} +9 -9
- package/out/{Dome.js → src/Dome.mjs} +291 -295
- package/out/{DomeComponent.d.ts → src/DomeComponent.d.mts} +22 -19
- package/out/{DomeComponent.js → src/DomeComponent.mjs} +47 -44
- package/out/{DomeManipulator.d.ts → src/DomeManipulator.d.mts} +48 -48
- package/out/{DomeManipulator.js → src/DomeManipulator.mjs} +329 -329
- package/out/src/DomeRouter.console-test.d.mts +1 -0
- package/out/{DomeRouter.console-test.js → src/DomeRouter.console-test.mjs} +44 -44
- package/out/{DomeRouter.d.ts → src/DomeRouter.d.mts} +30 -30
- package/out/{DomeRouter.js → src/DomeRouter.mjs} +236 -237
- package/out/{LongestCommonSubsequence.d.ts → src/LongestCommonSubsequence.d.mts} +15 -15
- package/out/{LongestCommonSubsequence.js → src/LongestCommonSubsequence.mjs} +164 -164
- package/out/src/index.d.mts +11 -0
- package/out/src/index.mjs +11 -0
- package/out/src/temp-test.d.mts +1 -0
- package/out/{temp-test.js → src/temp-test.mjs} +20 -20
- package/out/vitest.config.d.ts +2 -0
- package/out/vitest.config.js +9 -0
- package/package.json +16 -14
- package/src/{AnimatedArray.ts → AnimatedArray.mts} +3 -3
- package/src/{AnimatedTable.ts → AnimatedTable.mts} +6 -6
- package/src/{AnimatedText.ts → AnimatedText.mts} +4 -4
- package/src/{Dome.ts → Dome.mts} +7 -11
- package/src/{DomeComponent.ts → DomeComponent.mts} +3 -3
- package/src/{DomeManipulator.ts → DomeManipulator.mts} +5 -5
- package/src/{DomeRouter.ts → DomeRouter.mts} +3 -3
- package/src/index.mts +12 -0
- package/src/{temp-test.ts → temp-test.mts} +1 -1
- package/tsconfig.json +57 -60
- package/vitest.config.ts +10 -0
- package/jest.config.js +0 -22
- package/out/Animation.js +0 -0
- package/out/DomeRouter.console-test.d.ts +0 -0
- package/out/index.d.ts +0 -12
- package/out/index.js +0 -14
- package/src/index.ts +0 -14
- /package/src/{Animation.ts → Animation.mts} +0 -0
- /package/src/{DomeRouter.console-test.ts → DomeRouter.console-test.mts} +0 -0
- /package/src/{LongestCommonSubsequence.ts → LongestCommonSubsequence.mts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
|
|
6
|
-
// function checkUrlMatchRouteAndGetParameters(url:string, route:string, exactMatch:boolean = true):Map<string,string>|undefined{
|
|
7
|
-
// // this function is purely for export
|
|
8
|
-
// const urlSlices = getRouteSlices(url)
|
|
9
|
-
// const routeSlices = getRouteSlices(route)
|
|
10
|
-
// if(exactMatch && routeSlices.length !== urlSlices.length) return undefined
|
|
11
|
-
// // all routeSlices must match for !exactMatch
|
|
12
|
-
// const extractedParameters = new Map<string,string>()
|
|
13
|
-
// for(let i=0;i<routeSlices.length;i++){
|
|
14
|
-
// let cRouteSlice = routeSlices[i]
|
|
15
|
-
// let cUrlSlice = urlSlices[i] // could be undefined
|
|
16
|
-
// //console.info('\t\t cRouteSlice=', cRouteSlice, 'cUrlSlice=', cUrlSlice)
|
|
17
|
-
// if(cRouteSlice.startsWith(':')){
|
|
18
|
-
// // we have a param name
|
|
19
|
-
// if(cUrlSlice === undefined){
|
|
20
|
-
// return undefined
|
|
21
|
-
// }
|
|
22
|
-
// // we have some variable, save it
|
|
23
|
-
// extractedParameters.set(cRouteSlice.substring(1), cUrlSlice)
|
|
24
|
-
// } else {
|
|
25
|
-
// // no param name
|
|
26
|
-
// if(cRouteSlice !== cUrlSlice){
|
|
27
|
-
// return undefined
|
|
28
|
-
// }
|
|
29
|
-
// }
|
|
30
|
-
// }
|
|
31
|
-
// return extractedParameters
|
|
32
|
-
// }
|
|
33
|
-
// DomeRouter.onRoute('/', true, ()=>{ console.log('exact /')})
|
|
34
|
-
// DomeRouter.onRoute('/', false, ()=>{ console.log('notexact /')})
|
|
35
|
-
// DomeRouter.onRoute('/test', true, ()=>{ console.log('exact /test')})
|
|
36
|
-
// DomeRouter.onRoute('/test/:id', true, (p)=>{ console.log('exact /test/:id', 'params=', p)})
|
|
37
|
-
// DomeRouter.onRoute('/test/:id', false, (p)=>{ console.log('notexact /test/:id', 'params=', p)})
|
|
38
|
-
// DomeRouter.onRoute('/test', false, ()=>{ console.log('notexact /test')})
|
|
39
|
-
// DomeRouter.onRoute('/test/:id/:id2', true, (p)=>{ console.log('exact /test/:id/:id2', 'params=', p)})
|
|
40
|
-
// let testRoute = '//test/34/st'
|
|
41
|
-
// console.log('** testing route:', testRoute)
|
|
42
|
-
// DomeRouter.execute(testRoute)
|
|
43
|
-
// //expect(!true).toBeTruthy()
|
|
44
|
-
//console.log(checkUrlMatchRouteAndGetParameters('/get-product/123', '/get-product/:id/:id2', false))
|
|
1
|
+
// //import { DomeRouter } from "./DomeRouter"
|
|
2
|
+
// function getRouteSlices(route:string){
|
|
3
|
+
// return route.split('/').filter(x => x.length>0)
|
|
4
|
+
// }
|
|
5
|
+
export {};
|
|
6
|
+
// function checkUrlMatchRouteAndGetParameters(url:string, route:string, exactMatch:boolean = true):Map<string,string>|undefined{
|
|
7
|
+
// // this function is purely for export
|
|
8
|
+
// const urlSlices = getRouteSlices(url)
|
|
9
|
+
// const routeSlices = getRouteSlices(route)
|
|
10
|
+
// if(exactMatch && routeSlices.length !== urlSlices.length) return undefined
|
|
11
|
+
// // all routeSlices must match for !exactMatch
|
|
12
|
+
// const extractedParameters = new Map<string,string>()
|
|
13
|
+
// for(let i=0;i<routeSlices.length;i++){
|
|
14
|
+
// let cRouteSlice = routeSlices[i]
|
|
15
|
+
// let cUrlSlice = urlSlices[i] // could be undefined
|
|
16
|
+
// //console.info('\t\t cRouteSlice=', cRouteSlice, 'cUrlSlice=', cUrlSlice)
|
|
17
|
+
// if(cRouteSlice.startsWith(':')){
|
|
18
|
+
// // we have a param name
|
|
19
|
+
// if(cUrlSlice === undefined){
|
|
20
|
+
// return undefined
|
|
21
|
+
// }
|
|
22
|
+
// // we have some variable, save it
|
|
23
|
+
// extractedParameters.set(cRouteSlice.substring(1), cUrlSlice)
|
|
24
|
+
// } else {
|
|
25
|
+
// // no param name
|
|
26
|
+
// if(cRouteSlice !== cUrlSlice){
|
|
27
|
+
// return undefined
|
|
28
|
+
// }
|
|
29
|
+
// }
|
|
30
|
+
// }
|
|
31
|
+
// return extractedParameters
|
|
32
|
+
// }
|
|
33
|
+
// DomeRouter.onRoute('/', true, ()=>{ console.log('exact /')})
|
|
34
|
+
// DomeRouter.onRoute('/', false, ()=>{ console.log('notexact /')})
|
|
35
|
+
// DomeRouter.onRoute('/test', true, ()=>{ console.log('exact /test')})
|
|
36
|
+
// DomeRouter.onRoute('/test/:id', true, (p)=>{ console.log('exact /test/:id', 'params=', p)})
|
|
37
|
+
// DomeRouter.onRoute('/test/:id', false, (p)=>{ console.log('notexact /test/:id', 'params=', p)})
|
|
38
|
+
// DomeRouter.onRoute('/test', false, ()=>{ console.log('notexact /test')})
|
|
39
|
+
// DomeRouter.onRoute('/test/:id/:id2', true, (p)=>{ console.log('exact /test/:id/:id2', 'params=', p)})
|
|
40
|
+
// let testRoute = '//test/34/st'
|
|
41
|
+
// console.log('** testing route:', testRoute)
|
|
42
|
+
// DomeRouter.execute(testRoute)
|
|
43
|
+
// //expect(!true).toBeTruthy()
|
|
44
|
+
//console.log(checkUrlMatchRouteAndGetParameters('/get-product/123', '/get-product/:id/:id2', false))
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
export
|
|
2
|
-
[key: string]: string;
|
|
3
|
-
}, url: string, scrollToPreviousPositionAsync: () => Promise<void>) => void | Promise<void>;
|
|
4
|
-
export declare
|
|
5
|
-
let maxHistoryUrlsCount: number;
|
|
6
|
-
function navigate(url: string): void;
|
|
7
|
-
function goBack(): void;
|
|
8
|
-
function goForward(): void;
|
|
9
|
-
function changeUrl(url: string): void;
|
|
10
|
-
function getCurrentUrl(): string;
|
|
11
|
-
/**
|
|
12
|
-
* get previous page url navigated by router
|
|
13
|
-
* @param previousPageIndex 0=previousPage, 1=previousPage-1, etc
|
|
14
|
-
*/
|
|
15
|
-
function getPreviousPageUrl(previousPageIndex?: number): string | undefined;
|
|
16
|
-
function resolveUrl(url?: string, addToHistory?: boolean): void;
|
|
17
|
-
function onRoute(route: string, exactMatch: boolean, action: RouteAction): void;
|
|
18
|
-
function onNotFound(action: () => void): void;
|
|
19
|
-
/**
|
|
20
|
-
* Check if url matched route.
|
|
21
|
-
* example: /get-product/445345, /get-product/:productId, true ==> Map([productId:445345])
|
|
22
|
-
* example: /get-product/123, /another-route, true ==> undefined
|
|
23
|
-
* example: /articles, /articles, true ==> Map()
|
|
24
|
-
* example: /articles/some-article, /articles, false ==> Map()
|
|
25
|
-
* @param url
|
|
26
|
-
* @param route
|
|
27
|
-
* @param exactMatch
|
|
28
|
-
*/
|
|
29
|
-
function checkUrlMatchRouteAndGetParameters(url: string, route: string, exactMatch?: boolean): Object | undefined;
|
|
30
|
-
}
|
|
1
|
+
export type RouteAction = (params: {
|
|
2
|
+
[key: string]: string;
|
|
3
|
+
}, url: string, scrollToPreviousPositionAsync: () => Promise<void>) => void | Promise<void>;
|
|
4
|
+
export declare namespace DomeRouter {
|
|
5
|
+
let maxHistoryUrlsCount: number;
|
|
6
|
+
function navigate(url: string): void;
|
|
7
|
+
function goBack(): void;
|
|
8
|
+
function goForward(): void;
|
|
9
|
+
function changeUrl(url: string): void;
|
|
10
|
+
function getCurrentUrl(): string;
|
|
11
|
+
/**
|
|
12
|
+
* get previous page url navigated by router
|
|
13
|
+
* @param previousPageIndex 0=previousPage, 1=previousPage-1, etc
|
|
14
|
+
*/
|
|
15
|
+
function getPreviousPageUrl(previousPageIndex?: number): string | undefined;
|
|
16
|
+
function resolveUrl(url?: string, addToHistory?: boolean): void;
|
|
17
|
+
function onRoute(route: string, exactMatch: boolean, action: RouteAction): void;
|
|
18
|
+
function onNotFound(action: () => void): void;
|
|
19
|
+
/**
|
|
20
|
+
* Check if url matched route.
|
|
21
|
+
* example: /get-product/445345, /get-product/:productId, true ==> Map([productId:445345])
|
|
22
|
+
* example: /get-product/123, /another-route, true ==> undefined
|
|
23
|
+
* example: /articles, /articles, true ==> Map()
|
|
24
|
+
* example: /articles/some-article, /articles, false ==> Map()
|
|
25
|
+
* @param url
|
|
26
|
+
* @param route
|
|
27
|
+
* @param exactMatch
|
|
28
|
+
*/
|
|
29
|
+
function checkUrlMatchRouteAndGetParameters(url: string, route: string, exactMatch?: boolean): Object | undefined;
|
|
30
|
+
}
|