arrowjs-aluminum 0.9.2 → 1.0.1
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/dist/ArrowElementGenerator.d.ts +16 -32
- package/dist/ArrowElementGenerator.d.ts.map +1 -1
- package/dist/ArrowElementGenerator.js +11 -36
- package/dist/ArrowElementGenerator.js.map +1 -1
- package/dist/Router.d.ts +35 -13
- package/dist/Router.d.ts.map +1 -1
- package/dist/Router.js +101 -67
- package/dist/Router.js.map +1 -1
- package/package.json +1 -1
|
@@ -5,10 +5,10 @@ import { type ArrowTemplate } from "@arrow-js/core";
|
|
|
5
5
|
export declare class ArrowElementGenerator<T> {
|
|
6
6
|
readonly type: string;
|
|
7
7
|
protected readonly attributes: {
|
|
8
|
-
[attribute: string]:
|
|
8
|
+
[attribute: string]: any;
|
|
9
9
|
};
|
|
10
10
|
protected readonly createTransform: (args: T, currentAttributes: {
|
|
11
|
-
[attribute: string]:
|
|
11
|
+
[attribute: string]: any;
|
|
12
12
|
}) => void;
|
|
13
13
|
/**
|
|
14
14
|
* Creates an ArrowElement
|
|
@@ -17,50 +17,34 @@ export declare class ArrowElementGenerator<T> {
|
|
|
17
17
|
* @param createTransform A function that gets run when {@link create} is called. See {@link create} for more info
|
|
18
18
|
*/
|
|
19
19
|
constructor(type: string, attributes: {
|
|
20
|
-
[attribute: string]:
|
|
20
|
+
[attribute: string]: any;
|
|
21
21
|
}, createTransform: (args: T, currentAttributes: {
|
|
22
|
-
[attribute: string]:
|
|
22
|
+
[attribute: string]: any;
|
|
23
23
|
}) => void);
|
|
24
24
|
/**
|
|
25
25
|
* Creates a new template from this generator, optionally adding some additional attributes
|
|
26
|
-
* @param contents The contents of this template (the stuff between the tags)
|
|
27
26
|
* @param requiredValue The value you need to pass into this generator, specified when the generator was created (the `createTransform`)
|
|
28
27
|
* @param attributes Additional attributes to add to this template
|
|
29
28
|
* @return A renderable {@link ArrowTemplate}
|
|
30
29
|
*/
|
|
31
|
-
create(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
};
|
|
35
|
-
replace?: {
|
|
36
|
-
[attribute: string]: string | (() => string);
|
|
37
|
-
};
|
|
38
|
-
transform?: {
|
|
39
|
-
[attribute: string]: (previousValue: (string | undefined | (() => string))) => string;
|
|
40
|
-
};
|
|
41
|
-
}): ArrowTemplate;
|
|
30
|
+
create(requiredValue: T, attributes?: {
|
|
31
|
+
[attribute: string]: (previousValue: any) => any;
|
|
32
|
+
}): (strings: TemplateStringsArray, ...expSlots: any[]) => ArrowTemplate;
|
|
42
33
|
/**
|
|
43
34
|
* Creates a new generator based on this one
|
|
44
|
-
* @param attributes
|
|
35
|
+
* @param attributes An object of callbacks, where each callback takes the old attribute and returns the new attribute.
|
|
36
|
+
* If a value is passed in instead of a callback, the new value will overwrite the old value.
|
|
45
37
|
* @param newCreateTransform Takes the `requiredValue` from {@link create} and the attributes of this generator,
|
|
46
38
|
* and applies the `requiredValue` to the attributes
|
|
47
39
|
* @param type The node type of this template. Optional, will inherit from parent if not specified
|
|
48
40
|
* @return A new {@link ArrowElementGenerator} with the specified attributes, type, and transform function
|
|
49
41
|
*/
|
|
50
42
|
extend<T2>(attributes: {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
replace?: {
|
|
55
|
-
[attribute: string]: string | (() => string);
|
|
56
|
-
};
|
|
57
|
-
transform?: {
|
|
58
|
-
[attribute: string]: (previousValue: (string | undefined | (() => string))) => string;
|
|
59
|
-
};
|
|
60
|
-
}, newCreateTransform: (superTransform: (args: T, currentAttributes: {
|
|
61
|
-
[attribute: string]: string | (() => string);
|
|
43
|
+
[attribute: string]: any;
|
|
44
|
+
} | undefined, newCreateTransform: (superTransform: (args: T, currentAttributes: {
|
|
45
|
+
[attribute: string]: any;
|
|
62
46
|
}) => void) => (args: T2, currentAttributes: {
|
|
63
|
-
[attribute: string]:
|
|
47
|
+
[attribute: string]: any;
|
|
64
48
|
}) => void, type?: string): ArrowElementGenerator<T2>;
|
|
65
49
|
}
|
|
66
50
|
/**
|
|
@@ -70,9 +54,9 @@ export declare class ArrowElementGenerator<T> {
|
|
|
70
54
|
* @param createTransform A function that gets run when {@link create} is called. See {@link create} for more info
|
|
71
55
|
* @return A new {@link ArrowElementGenerator} with the specified attributes, type, and transform function
|
|
72
56
|
*/
|
|
73
|
-
export default function createGenerator<T>(type: string, attributes
|
|
74
|
-
[attribute: string]:
|
|
57
|
+
export default function createGenerator<T>(type: string, attributes?: {
|
|
58
|
+
[attribute: string]: any;
|
|
75
59
|
}, createTransform?: (args: T, currentAttributes: {
|
|
76
|
-
[attribute: string]:
|
|
60
|
+
[attribute: string]: any;
|
|
77
61
|
}) => void): ArrowElementGenerator<T>;
|
|
78
62
|
//# sourceMappingURL=ArrowElementGenerator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArrowElementGenerator.d.ts","sourceRoot":"","sources":["../src/ArrowElementGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,aAAa,EAAO,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"ArrowElementGenerator.d.ts","sourceRoot":"","sources":["../src/ArrowElementGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,aAAa,EAAO,MAAM,gBAAgB,CAAC;AAUxD;;GAEG;AACH,qBAAa,qBAAqB,CAAC,CAAC;IAChC,SAAgB,IAAI,SAAC;IACrB,SAAS,CAAC,QAAQ,CAAC,UAAU;;MAAC;IAC9B,SAAS,CAAC,QAAQ,CAAC,eAAe,SASA,CAAC,qBAAoB;QAAC,CAAC,SAAS,EAAC,MAAM,GAAE,GAAG,CAAA;KAAC,KAAG,IAAI,CATnD;IAEnC;;;;;OAKG;gBACS,IAAI,EAAC,MAAM,EAAE,UAAU,EAAC;QAAC,CAAC,SAAS,EAAC,MAAM,GAAE,GAAG,CAAA;KAAC,EAChD,eAAe,EAAC,CAAC,IAAI,EAAC,CAAC,EAAE,iBAAiB,EAAC;QAAC,CAAC,SAAS,EAAC,MAAM,GAAE,GAAG,CAAA;KAAC,KAAG,IAAI;IAMtF;;;;;OAKG;IACH,MAAM,CAAC,aAAa,EAAC,CAAC,EAAE,UAAU,GAAC;QAAC,CAAC,SAAS,EAAC,MAAM,GAAE,CAAC,aAAa,EAAC,GAAG,KAAG,GAAG,CAAA;KAAI,IAavE,SAAQ,oBAAoB,EAAE,GAAG,UAAU,GAAG,EAAE;IAI5D;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,EAAE,UAAU,EAAC;QAAC,CAAC,SAAS,EAAC,MAAM,GAAE,GAAG,CAAA;KAAC,YAAG,EACzC,kBAAkB,EAAC,CAAC,cAAc,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,iBAAiB,EAAE;QAC7D,CAAC,SAAS,EAAE,MAAM,GAAG,GAAG,CAAA;KAC3B,KAAK,IAAI,KACN,CAAC,IAAI,EAAC,EAAE,EAAE,iBAAiB,EAAC;QACxB,CAAC,SAAS,EAAC,MAAM,GAAG,GAAG,CAAA;KAC1B,KAAK,IAAI,EACd,IAAI,CAAC,EAAC,MAAM;CAMvB;AAGD;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,CAAC,EAAE,IAAI,EAAC,MAAM,EAAE,UAAU,GAAC;IAAC,CAAC,SAAS,EAAC,MAAM,GAAE,GAAG,CAAA;CAAI,EACtF,eAAe,GAAE,CAAC,IAAI,EAAC,CAAC,EAAE,iBAAiB,EAAC;IACxC,CAAC,SAAS,EAAC,MAAM,GAAE,GAAG,CAAA;CACzB,KAAG,IAAa,4BAIxB"}
|
|
@@ -1,33 +1,8 @@
|
|
|
1
1
|
import { html } from "@arrow-js/core";
|
|
2
|
-
function extendAttributes(originalAttrs, transformers) {
|
|
2
|
+
function extendAttributes(originalAttrs, transformers = {}) {
|
|
3
3
|
const newAttributes = { ...originalAttrs };
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
if (newAttributes[attribute] === undefined)
|
|
7
|
-
newAttributes[attribute] = addValue;
|
|
8
|
-
else if (typeof addValue === "string") {
|
|
9
|
-
if (typeof newAttributes[attribute] === "string")
|
|
10
|
-
newAttributes[attribute] += " " + addValue;
|
|
11
|
-
else {
|
|
12
|
-
const old = newAttributes[attribute];
|
|
13
|
-
newAttributes[attribute] = () => old() + " " + addValue;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
const old = newAttributes[attribute];
|
|
18
|
-
if (typeof old === "function")
|
|
19
|
-
newAttributes[attribute] = () => old() + " " + addValue();
|
|
20
|
-
else
|
|
21
|
-
newAttributes[attribute] = () => addValue() + " " + old;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
if (transformers.replace !== undefined)
|
|
26
|
-
Object.assign(newAttributes, transformers.replace);
|
|
27
|
-
if (transformers.transform !== undefined) {
|
|
28
|
-
for (const [attribute, transformer] of Object.entries(transformers.transform)) {
|
|
29
|
-
newAttributes[attribute] = transformer(newAttributes[attribute]);
|
|
30
|
-
}
|
|
4
|
+
for (const [attribute, transformer] of Object.entries(transformers)) {
|
|
5
|
+
newAttributes[attribute] = transformer(newAttributes[attribute]);
|
|
31
6
|
}
|
|
32
7
|
return newAttributes;
|
|
33
8
|
}
|
|
@@ -51,12 +26,11 @@ export class ArrowElementGenerator {
|
|
|
51
26
|
}
|
|
52
27
|
/**
|
|
53
28
|
* Creates a new template from this generator, optionally adding some additional attributes
|
|
54
|
-
* @param contents The contents of this template (the stuff between the tags)
|
|
55
29
|
* @param requiredValue The value you need to pass into this generator, specified when the generator was created (the `createTransform`)
|
|
56
30
|
* @param attributes Additional attributes to add to this template
|
|
57
31
|
* @return A renderable {@link ArrowTemplate}
|
|
58
32
|
*/
|
|
59
|
-
create(
|
|
33
|
+
create(requiredValue, attributes = {}) {
|
|
60
34
|
const newAttributes = { ...this.attributes };
|
|
61
35
|
this.createTransform(requiredValue, newAttributes);
|
|
62
36
|
const newerAttributes = extendAttributes(newAttributes, attributes);
|
|
@@ -66,18 +40,19 @@ export class ArrowElementGenerator {
|
|
|
66
40
|
...(orderedContents.length > 0 ? ['">'] : []), `</${this.type}>`];
|
|
67
41
|
// @ts-ignore
|
|
68
42
|
staticStringContents.raw = [...staticStringContents];
|
|
69
|
-
return html(staticStringContents, ...[...orderedContents.map(data => data[1]),
|
|
43
|
+
return (strings, ...expSlots) => html(staticStringContents, ...[...orderedContents.map(data => data[1]), html(strings, ...expSlots)]);
|
|
70
44
|
}
|
|
71
45
|
/**
|
|
72
46
|
* Creates a new generator based on this one
|
|
73
|
-
* @param attributes
|
|
47
|
+
* @param attributes An object of callbacks, where each callback takes the old attribute and returns the new attribute.
|
|
48
|
+
* If a value is passed in instead of a callback, the new value will overwrite the old value.
|
|
74
49
|
* @param newCreateTransform Takes the `requiredValue` from {@link create} and the attributes of this generator,
|
|
75
50
|
* and applies the `requiredValue` to the attributes
|
|
76
51
|
* @param type The node type of this template. Optional, will inherit from parent if not specified
|
|
77
52
|
* @return A new {@link ArrowElementGenerator} with the specified attributes, type, and transform function
|
|
78
53
|
*/
|
|
79
|
-
extend(attributes, newCreateTransform, type) {
|
|
80
|
-
return new ArrowElementGenerator(type || this.type, extendAttributes(this.attributes, attributes), newCreateTransform(this.createTransform));
|
|
54
|
+
extend(attributes = {}, newCreateTransform, type) {
|
|
55
|
+
return new ArrowElementGenerator(type || this.type, extendAttributes(this.attributes, Object.fromEntries(Object.entries(attributes).map(([k, v]) => [k, typeof v === "function" ? v : () => v]))), newCreateTransform(this.createTransform));
|
|
81
56
|
}
|
|
82
57
|
}
|
|
83
58
|
const defaultGenerator = new ArrowElementGenerator("", {}, () => { });
|
|
@@ -88,7 +63,7 @@ const defaultGenerator = new ArrowElementGenerator("", {}, () => { });
|
|
|
88
63
|
* @param createTransform A function that gets run when {@link create} is called. See {@link create} for more info
|
|
89
64
|
* @return A new {@link ArrowElementGenerator} with the specified attributes, type, and transform function
|
|
90
65
|
*/
|
|
91
|
-
export default function createGenerator(type, attributes, createTransform = () => { }) {
|
|
92
|
-
return defaultGenerator.extend(
|
|
66
|
+
export default function createGenerator(type, attributes = {}, createTransform = () => { }) {
|
|
67
|
+
return defaultGenerator.extend(Object.fromEntries(Object.entries(attributes).map(([k, v]) => [k, () => v])), () => createTransform, type);
|
|
93
68
|
}
|
|
94
69
|
//# sourceMappingURL=ArrowElementGenerator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArrowElementGenerator.js","sourceRoot":"","sources":["../src/ArrowElementGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,IAAI,EAAC,MAAM,gBAAgB,CAAC;AAExD,SAAS,gBAAgB,CAAC,
|
|
1
|
+
{"version":3,"file":"ArrowElementGenerator.js","sourceRoot":"","sources":["../src/ArrowElementGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,IAAI,EAAC,MAAM,gBAAgB,CAAC;AAExD,SAAS,gBAAgB,CAAC,aAAsC,EAAC,eAA2D,EAAE;IAC1H,MAAM,aAAa,GAAG,EAAC,GAAG,aAAa,EAAC,CAAC;IACzC,KAAI,MAAM,CAAC,SAAS,EAAE,WAAW,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,EAAC,CAAC;QAChE,aAAa,CAAC,SAAS,CAAC,GAAG,WAAW,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC;IACrE,CAAC;IACD,OAAO,aAAa,CAAC;AACzB,CAAC;AAED;;GAEG;AACH,MAAM,OAAO,qBAAqB;IACd,IAAI,CAAC;IACF,UAAU,CAAC;IACX,eAAe,CAAC;IAEnC;;;;;OAKG;IACH,YAAY,IAAW,EAAE,UAAmC,EAChD,eAA0E;QAClF,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,eAAe,GAAC,eAAe,CAAC;IACzC,CAAC;IAED;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Y;QAEhB,OAAO,IAAI,qBAAqB,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,gBAAgB,CAAC,IAAI,CAAC,UAAU,EAChF,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAC,CAAC,CAAC,EAAC,EAAE,CACvD,CAAC,CAAC,EAAC,OAAO,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAE,EAAE,CAAA,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,kBAAkB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC;IAClG,CAAC;CACJ;AAED,MAAM,gBAAgB,GAAG,IAAI,qBAAqB,CAAC,EAAE,EAAC,EAAE,EAAE,GAAE,EAAE,GAAC,CAAC,CAAC,CAAC;AAClE;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CAAI,IAAW,EAAE,aAAoC,EAAE,EACtF,kBAEW,GAAE,EAAE,GAAC,CAAC;IACrB,OAAO,gBAAgB,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,GAAG,CAC5E,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,GAAE,EAAE,CAAA,CAAC,CAAC,CAAC,CAAC,EACxB,GAAE,EAAE,CAAA,eAAe,EAAE,IAAI,CAAC,CAAC;AACnC,CAAC"}
|
package/dist/Router.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { type ArrowTemplate } from "@arrow-js/core";
|
|
2
|
+
type getRoute = (variables: {
|
|
3
|
+
[variableName: string]: string;
|
|
4
|
+
}) => ArrowTemplate;
|
|
2
5
|
type routeType = {
|
|
3
6
|
[subPath: string]: routeType;
|
|
4
|
-
[
|
|
5
|
-
[variableName: string]: string;
|
|
6
|
-
}) => ArrowTemplate;
|
|
7
|
+
[getRouteOrRouter: symbol]: getRoute | Router;
|
|
7
8
|
};
|
|
8
9
|
/**
|
|
9
10
|
* A basic router
|
|
@@ -11,11 +12,17 @@ type routeType = {
|
|
|
11
12
|
export default class Router {
|
|
12
13
|
protected readonly routes: routeType;
|
|
13
14
|
protected readonly route404: ArrowTemplate;
|
|
15
|
+
protected readonly transformBeforeFetch: (template: ArrowTemplate, vars: {
|
|
16
|
+
[variableName: string]: string;
|
|
17
|
+
}) => ArrowTemplate;
|
|
14
18
|
/**
|
|
15
19
|
* Creates a router
|
|
16
20
|
* @param route404 The template to render if no other path was found. Defaults to "404" text
|
|
21
|
+
* @param transformBeforeFetch An optional function that can transform the path before it's fetched (either in {@link getPath} or {@link getPathNo404}
|
|
17
22
|
*/
|
|
18
|
-
constructor(route404?: ArrowTemplate
|
|
23
|
+
constructor(route404?: ArrowTemplate, transformBeforeFetch?: (template: ArrowTemplate, vars: {
|
|
24
|
+
[variableName: string]: string;
|
|
25
|
+
}) => ArrowTemplate);
|
|
19
26
|
/**
|
|
20
27
|
* Adds a route to this router
|
|
21
28
|
*
|
|
@@ -30,9 +37,9 @@ export default class Router {
|
|
|
30
37
|
* or end (unless you know what you're doing)
|
|
31
38
|
* @param renderTemplate The template to render at this location
|
|
32
39
|
*/
|
|
33
|
-
addRoute(path: string, renderTemplate: (variables: {
|
|
40
|
+
addRoute(path: string, renderTemplate: ((variables: {
|
|
34
41
|
[variableName: string]: string;
|
|
35
|
-
}) => ArrowTemplate): this;
|
|
42
|
+
}) => ArrowTemplate) | Router): this;
|
|
36
43
|
/**
|
|
37
44
|
* Gets the template to render from the given location. Will default to the 404 path if no path found
|
|
38
45
|
* @param location The location to fetch
|
|
@@ -43,6 +50,15 @@ export default class Router {
|
|
|
43
50
|
* @param location The location to fetch
|
|
44
51
|
*/
|
|
45
52
|
getPathNo404(location: string): ArrowTemplate | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* @return this router's 404 route
|
|
55
|
+
*/
|
|
56
|
+
get404(): ArrowTemplate;
|
|
57
|
+
/**
|
|
58
|
+
* @return `this.routes`. If you want just a single route, try {@link getPath}
|
|
59
|
+
*/
|
|
60
|
+
accessRoutes(): routeType;
|
|
61
|
+
private getPathInternal;
|
|
46
62
|
}
|
|
47
63
|
/**
|
|
48
64
|
* A router that can manages the web page based on the page's url
|
|
@@ -50,25 +66,31 @@ export default class Router {
|
|
|
50
66
|
export declare class PageAttachedRouter extends Router {
|
|
51
67
|
protected readonly rootElement: HTMLElement | undefined;
|
|
52
68
|
protected readonly location: import("./utils.js").Ref<string[]>;
|
|
53
|
-
protected readonly transformBeforeRender: (template: ArrowTemplate) => ArrowTemplate;
|
|
54
69
|
/**
|
|
55
70
|
* Creates a page attached router
|
|
56
71
|
* @param attachTo The dom element to attach this router to. Defaults to `document.body`
|
|
57
72
|
* @param route404 The template to render if no other path was found. Defaults to "404" text
|
|
58
|
-
* @param
|
|
73
|
+
* @param transformBeforeFetch An optional function that can transform the path before it's {@link rerender}ed
|
|
59
74
|
*/
|
|
60
|
-
constructor(attachTo: HTMLElement | undefined, route404?: ArrowTemplate,
|
|
75
|
+
constructor(attachTo: HTMLElement | undefined, route404?: ArrowTemplate, transformBeforeFetch?: (template: ArrowTemplate, vars: {
|
|
76
|
+
[variableName: string]: string;
|
|
77
|
+
}) => ArrowTemplate);
|
|
61
78
|
/**
|
|
62
|
-
* Rerenders the page
|
|
79
|
+
* Rerenders the page
|
|
80
|
+
* @return this for chaining
|
|
63
81
|
*/
|
|
64
|
-
rerender():
|
|
82
|
+
rerender(): this;
|
|
65
83
|
/**
|
|
66
84
|
* Updates the window's `location` and rerenders the page
|
|
67
85
|
* @param newLocation The new url
|
|
68
86
|
* @param replace Whether this new url should replace the current url in history or be a new entry
|
|
69
|
-
* @return
|
|
87
|
+
* @return this for chaining
|
|
88
|
+
*/
|
|
89
|
+
redirect(newLocation?: string, replace?: boolean): this;
|
|
90
|
+
/**
|
|
91
|
+
* An ArrowTemplateGenerator that creates links that work with this router
|
|
70
92
|
*/
|
|
71
|
-
|
|
93
|
+
readonly link: import("./ArrowElementGenerator.js").ArrowElementGenerator<string>;
|
|
72
94
|
}
|
|
73
95
|
export {};
|
|
74
96
|
//# sourceMappingURL=Router.d.ts.map
|
package/dist/Router.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Router.d.ts","sourceRoot":"","sources":["../src/Router.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,aAAa,
|
|
1
|
+
{"version":3,"file":"Router.d.ts","sourceRoot":"","sources":["../src/Router.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,aAAa,EAAO,MAAM,gBAAgB,CAAC;AAMxD,KAAK,QAAQ,GAAG,CAAC,SAAS,EAAC;IAAC,CAAC,YAAY,EAAC,MAAM,GAAE,MAAM,CAAA;CAAC,KAAG,aAAa,CAAC;AAC1E,KAAK,SAAS,GAAG;IAAC,CAAC,OAAO,EAAC,MAAM,GAAE,SAAS,CAAC;IAAC,CAAC,gBAAgB,EAAC,MAAM,GAAE,QAAQ,GAAC,MAAM,CAAA;CAAC,CAAC;AAIzF;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,MAAM;IACvB,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAC,SAAS,CAAI;IACvC,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAC,aAAa,CAAC;IAC1C,SAAS,CAAC,QAAQ,CAAC,oBAAoB,aAOwC,aAAa,QAAO;QAAC,CAAC,YAAY,EAAC,MAAM,GAAE,MAAM,CAAA;KAAC,KAAG,aAAa,CAPzG;IAExC;;;;OAIG;gBACS,QAAQ,GAAC,aAAwB,EAAE,oBAAoB,CAAC,EAAC,CAAC,QAAQ,EAAC,aAAa,EAAE,IAAI,EAAC;QAAC,CAAC,YAAY,EAAC,MAAM,GAAE,MAAM,CAAA;KAAC,KAAG,aAAa;IAKjJ;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,IAAI,EAAC,MAAM,EAAE,cAAc,EAAC,CAAC,CAAC,SAAS,EAAC;QAAC,CAAC,YAAY,EAAC,MAAM,GAAE,MAAM,CAAA;KAAC,KAAG,aAAa,CAAC,GAAC,MAAM;IAwBvG;;;OAGG;IACH,OAAO,CAAC,QAAQ,EAAC,MAAM;IAGvB;;;OAGG;IACH,YAAY,CAAC,QAAQ,EAAC,MAAM;IAQ5B;;OAEG;IACH,MAAM;IACN;;OAEG;IACH,YAAY;IAEZ,OAAO,CAAC,eAAe;CAqC1B;AAGD;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,MAAM;IAC1C,SAAS,CAAC,QAAQ,CAAC,WAAW,0BAAC;IAC/B,SAAS,CAAC,QAAQ,CAAC,QAAQ,qCAAqB;IAEhD;;;;;OAKG;gBACS,QAAQ,EAAC,WAAW,GAAC,SAAS,EAAE,QAAQ,CAAC,EAAC,aAAa,EACvD,oBAAoB,CAAC,EAAC,CAAC,QAAQ,EAAC,aAAa,EAAE,IAAI,EAAC;QAAC,CAAC,YAAY,EAAC,MAAM,GAAE,MAAM,CAAA;KAAC,KAAG,aAAa;IAW9G;;;OAGG;IACI,QAAQ;IASf;;;;;OAKG;IACH,QAAQ,CAAC,WAAW,GAAC,MAA+B,EAAE,OAAO,CAAC,EAAC,OAAO;IActE;;OAEG;IACH,SAAgB,IAAI,qEAOb;CACV"}
|
package/dist/Router.js
CHANGED
|
@@ -1,31 +1,8 @@
|
|
|
1
|
-
import { html
|
|
1
|
+
import { html } from "@arrow-js/core";
|
|
2
2
|
import { ref } from "./utils.js";
|
|
3
|
+
import createGenerator from "./ArrowElementGenerator.js";
|
|
3
4
|
const getRouteSymbol = Symbol("getRoute");
|
|
4
|
-
|
|
5
|
-
if (subPaths.length === 0 && routes[getRouteSymbol] !== undefined)
|
|
6
|
-
return { subRoutes: routes, variables };
|
|
7
|
-
//regular path
|
|
8
|
-
if (routes[subPaths[0]] !== undefined) {
|
|
9
|
-
if (routes[subPaths[0]] !== undefined)
|
|
10
|
-
return getPath(routes[subPaths[0]], subPaths.slice(1), { ...variables });
|
|
11
|
-
}
|
|
12
|
-
//variable path
|
|
13
|
-
const toReturn = [];
|
|
14
|
-
for (const key in routes) {
|
|
15
|
-
if (!key.startsWith(":") || routes[key] === undefined)
|
|
16
|
-
continue;
|
|
17
|
-
const maybeRoute = getPath(routes[key], subPaths.slice(1), {
|
|
18
|
-
...variables,
|
|
19
|
-
[key.slice(1)]: subPaths[0]
|
|
20
|
-
});
|
|
21
|
-
if (maybeRoute instanceof Array)
|
|
22
|
-
toReturn.push(...maybeRoute);
|
|
23
|
-
else if (maybeRoute !== undefined)
|
|
24
|
-
toReturn.push(maybeRoute);
|
|
25
|
-
}
|
|
26
|
-
if (toReturn.length > 0)
|
|
27
|
-
return toReturn;
|
|
28
|
-
}
|
|
5
|
+
const routerSymbol = Symbol("router");
|
|
29
6
|
const default404 = html `404`;
|
|
30
7
|
/**
|
|
31
8
|
* A basic router
|
|
@@ -33,12 +10,15 @@ const default404 = html `404`;
|
|
|
33
10
|
export default class Router {
|
|
34
11
|
routes = {};
|
|
35
12
|
route404;
|
|
13
|
+
transformBeforeFetch;
|
|
36
14
|
/**
|
|
37
15
|
* Creates a router
|
|
38
16
|
* @param route404 The template to render if no other path was found. Defaults to "404" text
|
|
17
|
+
* @param transformBeforeFetch An optional function that can transform the path before it's fetched (either in {@link getPath} or {@link getPathNo404}
|
|
39
18
|
*/
|
|
40
|
-
constructor(route404 = default404) {
|
|
19
|
+
constructor(route404 = default404, transformBeforeFetch) {
|
|
41
20
|
this.route404 = route404;
|
|
21
|
+
this.transformBeforeFetch = transformBeforeFetch || (template => template);
|
|
42
22
|
}
|
|
43
23
|
/**
|
|
44
24
|
* Adds a route to this router
|
|
@@ -57,13 +37,23 @@ export default class Router {
|
|
|
57
37
|
addRoute(path, renderTemplate) {
|
|
58
38
|
const subPaths = path.split("/");
|
|
59
39
|
let position = this.routes;
|
|
60
|
-
for (
|
|
61
|
-
|
|
40
|
+
for (let i = 0; i < subPaths.length; i++) {
|
|
41
|
+
const nextPos = subPaths[i];
|
|
42
|
+
if (position[nextPos] !== undefined && position[nextPos][routerSymbol] instanceof Router && i !== subPaths.length - 1)
|
|
43
|
+
throw new Error(`Cannot create route "${path}", there is a router in the way`);
|
|
44
|
+
if (position[nextPos] !== undefined && i !== subPaths.length - 1 && !(renderTemplate instanceof Router))
|
|
62
45
|
position = position[nextPos];
|
|
63
|
-
else
|
|
64
|
-
|
|
46
|
+
else {
|
|
47
|
+
if (i === subPaths.length - 1 && renderTemplate instanceof Router) {
|
|
48
|
+
position[nextPos] ||= {};
|
|
49
|
+
position[nextPos][routerSymbol] = renderTemplate;
|
|
50
|
+
}
|
|
51
|
+
else
|
|
52
|
+
position = position[nextPos] = {};
|
|
53
|
+
}
|
|
65
54
|
}
|
|
66
|
-
|
|
55
|
+
if (!(renderTemplate instanceof Router))
|
|
56
|
+
position[getRouteSymbol] = renderTemplate;
|
|
67
57
|
return this;
|
|
68
58
|
}
|
|
69
59
|
/**
|
|
@@ -78,75 +68,119 @@ export default class Router {
|
|
|
78
68
|
* @param location The location to fetch
|
|
79
69
|
*/
|
|
80
70
|
getPathNo404(location) {
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
71
|
+
const vars = {};
|
|
72
|
+
const pathOptions = this.getPathInternal(this.routes, location.split("/"), vars);
|
|
73
|
+
if (pathOptions === undefined || pathOptions.length === 0 || pathOptions[0] === undefined)
|
|
74
|
+
return undefined;
|
|
75
|
+
return this.transformBeforeFetch(pathOptions[0], vars);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* @return this router's 404 route
|
|
79
|
+
*/
|
|
80
|
+
get404() { return this.route404; }
|
|
81
|
+
/**
|
|
82
|
+
* @return `this.routes`. If you want just a single route, try {@link getPath}
|
|
83
|
+
*/
|
|
84
|
+
accessRoutes() { return this.routes; }
|
|
85
|
+
getPathInternal(routes, subPaths, variables) {
|
|
86
|
+
if (subPaths.length === 0 && routes[getRouteSymbol] !== undefined)
|
|
87
|
+
return [routes[getRouteSymbol](variables)];
|
|
88
|
+
//regular path
|
|
89
|
+
if (routes[subPaths[0]] !== undefined) {
|
|
90
|
+
if (routes[subPaths[0]] !== undefined) {
|
|
91
|
+
const next = routes[subPaths[0]];
|
|
92
|
+
if (next[routerSymbol] instanceof Router && subPaths.length > 1) {
|
|
93
|
+
return (next[routerSymbol].getPathInternal(next[routerSymbol].accessRoutes(), subPaths.slice(1), { ...variables }) ?? [])
|
|
94
|
+
.map(template => next[routerSymbol].transformBeforeFetch(template, { ...variables }));
|
|
95
|
+
}
|
|
96
|
+
else
|
|
97
|
+
return this.getPathInternal(next, subPaths.slice(1), { ...variables });
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
//variable path
|
|
101
|
+
const toReturn = [];
|
|
102
|
+
for (const key in routes) {
|
|
103
|
+
if (!key.startsWith(":") || routes[key] === undefined)
|
|
104
|
+
continue;
|
|
105
|
+
const maybeRoute = (routes[key][routerSymbol] instanceof Router && subPaths.length > 1) ?
|
|
106
|
+
(routes[key][routerSymbol].getPathInternal(routes[key][routerSymbol].accessRoutes(), subPaths.slice(1), {
|
|
107
|
+
...variables,
|
|
108
|
+
[key.slice(1)]: subPaths[0]
|
|
109
|
+
}) ?? []).map(template => routes[key][routerSymbol].transformBeforeFetch(template, {
|
|
110
|
+
...variables,
|
|
111
|
+
[key.slice(1)]: subPaths[0]
|
|
112
|
+
})) :
|
|
113
|
+
this.getPathInternal(routes[key], subPaths.slice(1), {
|
|
114
|
+
...variables,
|
|
115
|
+
[key.slice(1)]: subPaths[0]
|
|
116
|
+
});
|
|
117
|
+
if (maybeRoute !== undefined)
|
|
118
|
+
toReturn.push(...maybeRoute);
|
|
88
119
|
}
|
|
89
|
-
|
|
90
|
-
return
|
|
120
|
+
if (toReturn.length > 0)
|
|
121
|
+
return toReturn;
|
|
91
122
|
}
|
|
92
123
|
}
|
|
93
|
-
const
|
|
124
|
+
const hrefResolver = document.createElement("a");
|
|
94
125
|
/**
|
|
95
126
|
* A router that can manages the web page based on the page's url
|
|
96
127
|
*/
|
|
97
128
|
export class PageAttachedRouter extends Router {
|
|
98
129
|
rootElement;
|
|
99
130
|
location = ref([]);
|
|
100
|
-
transformBeforeRender;
|
|
101
131
|
/**
|
|
102
132
|
* Creates a page attached router
|
|
103
133
|
* @param attachTo The dom element to attach this router to. Defaults to `document.body`
|
|
104
134
|
* @param route404 The template to render if no other path was found. Defaults to "404" text
|
|
105
|
-
* @param
|
|
135
|
+
* @param transformBeforeFetch An optional function that can transform the path before it's {@link rerender}ed
|
|
106
136
|
*/
|
|
107
|
-
constructor(attachTo, route404,
|
|
108
|
-
super(route404);
|
|
137
|
+
constructor(attachTo, route404, transformBeforeFetch) {
|
|
138
|
+
super(route404, transformBeforeFetch);
|
|
109
139
|
this.rootElement = attachTo;
|
|
110
|
-
this.transformBeforeRender = transformBeforeRender || (template => template);
|
|
111
140
|
this.location.$on(() => this.rerender());
|
|
112
141
|
window.addEventListener("popstate", e => {
|
|
113
|
-
|
|
114
|
-
|
|
142
|
+
this.redirect(window.location.pathname);
|
|
143
|
+
e.preventDefault();
|
|
115
144
|
}); //back button handling
|
|
116
145
|
}
|
|
117
146
|
/**
|
|
118
|
-
* Rerenders the page
|
|
147
|
+
* Rerenders the page
|
|
148
|
+
* @return this for chaining
|
|
119
149
|
*/
|
|
120
150
|
rerender() {
|
|
121
151
|
const path = this.getPath(this.location.value.join("/"));
|
|
122
152
|
if (this.rootElement !== undefined) {
|
|
123
153
|
this.rootElement.replaceChildren();
|
|
124
|
-
|
|
154
|
+
path(this.rootElement);
|
|
125
155
|
}
|
|
156
|
+
return this;
|
|
126
157
|
}
|
|
127
158
|
/**
|
|
128
159
|
* Updates the window's `location` and rerenders the page
|
|
129
160
|
* @param newLocation The new url
|
|
130
161
|
* @param replace Whether this new url should replace the current url in history or be a new entry
|
|
131
|
-
* @return
|
|
162
|
+
* @return this for chaining
|
|
132
163
|
*/
|
|
133
164
|
redirect(newLocation = window.location.pathname, replace) {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
this.location.value = this.location.value.concat(newLocation.split("/"));
|
|
140
|
-
// modalContents.val=undefined;
|
|
141
|
-
const newPath = newLocation.split("/");
|
|
142
|
-
if (newPath[0] === "") {
|
|
143
|
-
this.location.value = newPath.slice(1);
|
|
144
|
-
}
|
|
145
|
-
else {
|
|
146
|
-
this.location.value = this.location.value.concat(newPath);
|
|
165
|
+
hrefResolver.href = newLocation;
|
|
166
|
+
const url = URL.parse(hrefResolver.href);
|
|
167
|
+
if (url.host !== window.location.host) {
|
|
168
|
+
window.location.href = url.href + url.search + url.hash;
|
|
169
|
+
return this;
|
|
147
170
|
}
|
|
148
|
-
|
|
149
|
-
|
|
171
|
+
this.location.value = url.pathname.split("/").slice(1);
|
|
172
|
+
window.history[replace ? "replaceState" : "pushState"](null, "", "/" + this.location.value.join("/") + url.search + url.hash);
|
|
173
|
+
return this;
|
|
150
174
|
}
|
|
175
|
+
/**
|
|
176
|
+
* An ArrowTemplateGenerator that creates links that work with this router
|
|
177
|
+
*/
|
|
178
|
+
link = createGenerator("a", { href: "#" }, (href, attrs) => {
|
|
179
|
+
attrs["@click"] = (e) => {
|
|
180
|
+
e.preventDefault();
|
|
181
|
+
this.redirect(href);
|
|
182
|
+
};
|
|
183
|
+
attrs.href = href;
|
|
184
|
+
});
|
|
151
185
|
}
|
|
152
186
|
//# sourceMappingURL=Router.js.map
|
package/dist/Router.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Router.js","sourceRoot":"","sources":["../src/Router.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,IAAI,
|
|
1
|
+
{"version":3,"file":"Router.js","sourceRoot":"","sources":["../src/Router.ts"],"names":[],"mappings":"AA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