@sealcode/sealgen 0.14.14 → 0.14.15
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/@types/src/forms/controls/multiple-photos.d.ts +3 -3
- package/@types/src/forms/controls/photo.d.ts +3 -3
- package/dist/forms/controls/multiple-photos.js +2 -3
- package/dist/forms/controls/photo.js +3 -4
- package/package.json +2 -2
- package/src/forms/controls/multiple-photos.ts +4 -5
- package/src/forms/controls/photo.ts +5 -6
|
@@ -2,11 +2,11 @@ import { File as SealiousFile, CollectionItem } from "sealious";
|
|
|
2
2
|
import { FlatTemplatable } from "tempstream";
|
|
3
3
|
import { MultipleFiles, MultipleFilesOptions } from "./multiple-files.js";
|
|
4
4
|
import { MultipleFiles as MultipleFilesField } from "../fields/multiple-files.js";
|
|
5
|
-
import
|
|
5
|
+
import { KoaResponsiveImageRouter } from "koa-responsive-image-router";
|
|
6
6
|
export declare class MultiplePhotos extends MultipleFiles {
|
|
7
7
|
field: MultipleFilesField;
|
|
8
|
-
imageRouter: KoaResponsiveImageRouter
|
|
9
|
-
constructor(field: MultipleFilesField, imageRouter: KoaResponsiveImageRouter
|
|
8
|
+
imageRouter: KoaResponsiveImageRouter;
|
|
9
|
+
constructor(field: MultipleFilesField, imageRouter: KoaResponsiveImageRouter, options?: Partial<MultipleFilesOptions>);
|
|
10
10
|
getClassModifiers(): string[];
|
|
11
11
|
getInputAttributes(): {
|
|
12
12
|
accept: string;
|
|
@@ -4,12 +4,12 @@ import { File } from "./file.js";
|
|
|
4
4
|
import { FormField } from "../fields/field.js";
|
|
5
5
|
import { SimpleInputOptions } from "./simple-input.js";
|
|
6
6
|
import { FormControlContext } from "./form-control.js";
|
|
7
|
-
import * as KoaResponsiveImageRouter from "koa-responsive-image-router";
|
|
8
7
|
import { FileContainer } from "../fields/file.js";
|
|
8
|
+
import { KoaResponsiveImageRouter } from "koa-responsive-image-router";
|
|
9
9
|
export declare class Photo extends File {
|
|
10
10
|
field: FormField<boolean, FileContainer>;
|
|
11
|
-
imageRouter: KoaResponsiveImageRouter
|
|
12
|
-
constructor(field: FormField<boolean, FileContainer>, imageRouter: KoaResponsiveImageRouter
|
|
11
|
+
imageRouter: KoaResponsiveImageRouter;
|
|
12
|
+
constructor(field: FormField<boolean, FileContainer>, imageRouter: KoaResponsiveImageRouter, options?: SimpleInputOptions);
|
|
13
13
|
getImgStyle(): Promise<string>;
|
|
14
14
|
renderFilePreview(ctx: Context, file_data: {
|
|
15
15
|
id?: string;
|
|
@@ -19,10 +19,9 @@ class MultiplePhotos extends MultipleFiles {
|
|
|
19
19
|
}
|
|
20
20
|
return tempstream`<li>
|
|
21
21
|
<a href="${file.getURL()}" data-turbo="false">
|
|
22
|
-
${this.imageRouter.image({
|
|
23
|
-
path,
|
|
22
|
+
${this.imageRouter.image(path, {
|
|
24
23
|
resolutions: [150, 300],
|
|
25
|
-
|
|
24
|
+
sizesAttr: "150px"
|
|
26
25
|
})}
|
|
27
26
|
</a>
|
|
28
27
|
<span class="filename"> ${file.filename || "no filename"}</span>
|
|
@@ -22,11 +22,10 @@ class Photo extends File {
|
|
|
22
22
|
}
|
|
23
23
|
const file = await SealiousFile.fromID(ctx.$app, id);
|
|
24
24
|
return tempstream`<div class="${class_name}">
|
|
25
|
-
${this.imageRouter.image({
|
|
25
|
+
${this.imageRouter.image(file.getDataPath(), {
|
|
26
26
|
resolutions: [100],
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
img_style: await this.getImgStyle()
|
|
27
|
+
sizesAttr: "100px",
|
|
28
|
+
imgStyle: await this.getImgStyle()
|
|
30
29
|
})}
|
|
31
30
|
</div>`;
|
|
32
31
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sealcode/sealgen",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.15",
|
|
4
4
|
"description": "Module to automate adding routes and collections to a sealious application",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|
|
72
72
|
"koa": "^2.13.0",
|
|
73
|
-
"koa-responsive-image-router": "^0.2.
|
|
73
|
+
"koa-responsive-image-router": "^0.2.24",
|
|
74
74
|
"sealious": "^0.18.1"
|
|
75
75
|
}
|
|
76
76
|
}
|
|
@@ -2,12 +2,12 @@ import { File as SealiousFile, CollectionItem } from "sealious";
|
|
|
2
2
|
import { FlatTemplatable, tempstream } from "tempstream";
|
|
3
3
|
import { MultipleFiles, MultipleFilesOptions } from "./multiple-files.js";
|
|
4
4
|
import { MultipleFiles as MultipleFilesField } from "../fields/multiple-files.js";
|
|
5
|
-
import
|
|
5
|
+
import { KoaResponsiveImageRouter } from "koa-responsive-image-router";
|
|
6
6
|
|
|
7
7
|
export class MultiplePhotos extends MultipleFiles {
|
|
8
8
|
constructor(
|
|
9
9
|
public field: MultipleFilesField,
|
|
10
|
-
public imageRouter: KoaResponsiveImageRouter
|
|
10
|
+
public imageRouter: KoaResponsiveImageRouter,
|
|
11
11
|
options?: Partial<MultipleFilesOptions>
|
|
12
12
|
) {
|
|
13
13
|
super(field, options);
|
|
@@ -31,10 +31,9 @@ export class MultiplePhotos extends MultipleFiles {
|
|
|
31
31
|
}
|
|
32
32
|
return tempstream/* HTML */ `<li>
|
|
33
33
|
<a href="${file.getURL()}" data-turbo="false">
|
|
34
|
-
${this.imageRouter.image({
|
|
35
|
-
path,
|
|
34
|
+
${this.imageRouter.image(path, {
|
|
36
35
|
resolutions: [150, 300],
|
|
37
|
-
|
|
36
|
+
sizesAttr: "150px",
|
|
38
37
|
})}
|
|
39
38
|
</a>
|
|
40
39
|
<span class="filename"> ${file.filename || "no filename"}</span>
|
|
@@ -5,13 +5,13 @@ import { File as SealiousFile } from "sealious";
|
|
|
5
5
|
import { FormField } from "../fields/field.js";
|
|
6
6
|
import { SimpleInputOptions } from "./simple-input.js";
|
|
7
7
|
import { FormControlContext } from "./form-control.js";
|
|
8
|
-
import * as KoaResponsiveImageRouter from "koa-responsive-image-router";
|
|
9
8
|
import { FileContainer } from "../fields/file.js";
|
|
9
|
+
import { KoaResponsiveImageRouter } from "koa-responsive-image-router";
|
|
10
10
|
|
|
11
11
|
export class Photo extends File {
|
|
12
12
|
constructor(
|
|
13
13
|
public field: FormField<boolean, FileContainer>,
|
|
14
|
-
public imageRouter: KoaResponsiveImageRouter
|
|
14
|
+
public imageRouter: KoaResponsiveImageRouter,
|
|
15
15
|
options?: SimpleInputOptions
|
|
16
16
|
) {
|
|
17
17
|
super(field, options);
|
|
@@ -36,11 +36,10 @@ export class Photo extends File {
|
|
|
36
36
|
}
|
|
37
37
|
const file = await SealiousFile.fromID(ctx.$app, id);
|
|
38
38
|
return tempstream/* HTML */ `<div class="${class_name}">
|
|
39
|
-
${this.imageRouter.image({
|
|
39
|
+
${this.imageRouter.image(file.getDataPath(), {
|
|
40
40
|
resolutions: [100],
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
img_style: await this.getImgStyle(),
|
|
41
|
+
sizesAttr: "100px",
|
|
42
|
+
imgStyle: await this.getImgStyle(),
|
|
44
43
|
})}
|
|
45
44
|
</div>`;
|
|
46
45
|
}
|