@monkeyplus/flow 6.0.17 → 6.0.18
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/README.md +2 -0
- package/cms/server/database/schema.d.ts +648 -0
- package/cms/server/database/schema.mjs +43 -0
- package/cms/server/routes/api/auth/[...auth].d.ts +2 -0
- package/cms/server/routes/api/auth/[...auth].mjs +5 -0
- package/cms/server/routes/api/draft.d.ts +3 -0
- package/cms/server/routes/api/draft.mjs +26 -0
- package/cms/server/routes/api/repos/remote/[repo]/blobs/[file]/index.d.ts +2 -0
- package/cms/server/routes/api/repos/remote/[repo]/blobs/[file]/index.mjs +20 -0
- package/cms/server/routes/api/repos/remote/[repo]/blobs/index.post.d.ts +2 -0
- package/cms/server/routes/api/repos/remote/[repo]/blobs/index.post.mjs +8 -0
- package/cms/server/routes/api/repos/remote/[repo]/branches/[branch]/index.d.ts +2 -0
- package/cms/server/routes/api/repos/remote/[repo]/branches/[branch]/index.mjs +8 -0
- package/cms/server/routes/api/repos/remote/[repo]/commits/index.post.d.ts +2 -0
- package/cms/server/routes/api/repos/remote/[repo]/commits/index.post.mjs +8 -0
- package/cms/server/routes/api/repos/remote/[repo]/files/[branch]/index.d.ts +2 -0
- package/cms/server/routes/api/repos/remote/[repo]/files/[branch]/index.mjs +38 -0
- package/cms/server/routes/api/repos/remote/[repo]/files/index.post.d.ts +2 -0
- package/cms/server/routes/api/repos/remote/[repo]/files/index.post.mjs +8 -0
- package/cms/server/routes/api/repos/remote/[repo]/refs/heads/[branch]/index.patch.d.ts +2 -0
- package/cms/server/routes/api/repos/remote/[repo]/refs/heads/[branch]/index.patch.mjs +9 -0
- package/cms/server/utils/auth.d.ts +3 -0
- package/cms/server/utils/auth.mjs +16 -0
- package/cms/server/utils/db.d.ts +3 -0
- package/cms/server/utils/db.mjs +5 -0
- package/cms/server/utils/github.d.ts +15 -0
- package/cms/server/utils/github.mjs +160 -0
- package/cms/server/utils/github_token.d.ts +71 -0
- package/cms/server/utils/github_token.mjs +377 -0
- package/modules/cms/module.d.ts +11 -0
- package/modules/cms/module.mjs +163 -0
- package/modules/cms/server/api/admin.d.ts +2 -0
- package/modules/cms/server/api/admin.mjs +18 -0
- package/modules/cms/server/api/config.d.ts +2 -0
- package/modules/cms/server/api/config.mjs +88 -0
- package/modules/cms/server/api/localFs.d.ts +2 -0
- package/modules/cms/server/api/localFs.mjs +88 -0
- package/modules/cms/server/api/meta.d.ts +2 -0
- package/modules/cms/server/api/meta.mjs +12 -0
- package/modules/cms/server/lib/composables.d.ts +116 -0
- package/modules/cms/server/lib/composables.mjs +82 -0
- package/modules/cms/server/lib/fs.d.ts +1 -0
- package/modules/cms/server/lib/fs.mjs +18 -0
- package/modules/cms/server/lib/helpers.d.ts +14 -0
- package/modules/cms/server/lib/helpers.mjs +78 -0
- package/modules/cms/server/lib/types.d.ts +120 -0
- package/modules/cms/server/lib/types.mjs +0 -0
- package/modules/cms/server/lib/widgets.d.ts +82 -0
- package/modules/cms/server/lib/widgets.mjs +200 -0
- package/modules/cms/server/trial.d.ts +2 -0
- package/modules/cms/server/trial.mjs +8 -0
- package/modules/content/query.mjs +31 -3
- package/modules/images/ipx.mjs +4 -2
- package/modules/images/module.d.ts +0 -1
- package/modules/images/module.mjs +5 -3
- package/modules/images/runtime/build.mjs +12 -0
- package/modules/images/runtime/image.mjs +4 -3
- package/modules/images/runtime/renames.mjs +59 -8
- package/modules/images/runtime/types.d.ts +27 -4
- package/modules/images/watermark.d.ts +1 -0
- package/modules/images/watermark.mjs +113 -0
- package/modules/netlify-cms/handler.mjs +2 -1
- package/modules/netlify-cms/module.mjs +1 -1
- package/modules/netlify-cms/server/api/config.mjs +25 -1
- package/modules/netlify-cms/server/api/local-fs.d.ts +51 -0
- package/modules/netlify-cms/server/api/local-fs.mjs +81 -77
- package/modules/netlify-cms/server/lib/cms/handler.d.ts +1 -1
- package/modules/netlify-cms/server/lib/cms/handlerV1.d.ts +1 -1
- package/modules/netlify-cms/server/lib/composables.d.ts +8 -0
- package/modules/netlify-cms/server/lib/composables.mjs +2 -1
- package/package.json +2 -2
- package/server/lib/context.d.ts +3 -0
- package/server/lib/context.mjs +5 -0
- package/server/lib/handler.mjs +58 -23
- package/server/lib/pages.d.ts +2 -2
- package/server/lib/pages.mjs +8 -6
- package/server/lib/render.mjs +20 -4
- package/server/plugins/00.lifecycle.mjs +2 -1
- package/src/public/index.d.ts +1 -0
- package/src/public/index.mjs +1 -0
- package/src/public/nitro.mjs +2 -0
- package/src/public/query-content.mjs +9 -2
- package/src/public/shared.d.ts +1 -0
- package/src/public/shared.mjs +3 -0
- package/src/public/vite.mjs +63 -8
- package/src/runtime/components/FlowIsland.mjs +31 -4
- package/src/runtime/components/MkImage.d.ts +100 -22
- package/src/runtime/components/MkImage.mjs +20 -12
- package/src/runtime/components/MkLink.d.ts +8 -5
- package/src/runtime/components/MkLink.mjs +9 -3
- package/src/runtime/components/MkPicture.d.ts +92 -7
- package/src/runtime/components/MkPicture.mjs +8 -2
- package/src/runtime/components/image-shared.d.ts +0 -1
- package/src/runtime/components/image-shared.mjs +9 -18
- package/src/runtime/config.d.ts +6 -15
- package/src/runtime/head.d.ts +2 -1
- package/src/runtime/head.mjs +5 -2
- package/src/runtime/islands.mjs +20 -2
- package/src/runtime/page-discovery.mjs +9 -1
- package/src/runtime/pages.d.ts +14 -13
- package/src/runtime/virtual-pages.mjs +2 -2
package/src/public/shared.mjs
CHANGED
|
@@ -16,3 +16,6 @@ export function resolvePackageFile(...candidates) {
|
|
|
16
16
|
}
|
|
17
17
|
return resolvePackagePath(candidates[0] || "");
|
|
18
18
|
}
|
|
19
|
+
export function resolvePath(projectRoot, pathRaw) {
|
|
20
|
+
return projectRoot === resolvePackagePath() ? resolve(projectRoot, `${pathRaw}.ts`) : resolvePackageFile(`${pathRaw}.ts`, `${pathRaw}.mjs`, `${pathRaw}.js`);
|
|
21
|
+
}
|
package/src/public/vite.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { relative, resolve } from "node:path";
|
|
3
|
+
import process from "node:process";
|
|
3
4
|
import ui from "@nuxt/ui/vite";
|
|
4
5
|
import Vue from "@vitejs/plugin-vue";
|
|
5
6
|
import { nitro } from "nitro/vite";
|
|
@@ -20,6 +21,15 @@ import {
|
|
|
20
21
|
createVirtualServerStylesModule,
|
|
21
22
|
createVirtualTemplatesModule
|
|
22
23
|
} from "../runtime/virtual-pages.mjs";
|
|
24
|
+
import { createFlowNitroConfig } from "./nitro.mjs";
|
|
25
|
+
let schemaOrgImports = {};
|
|
26
|
+
try {
|
|
27
|
+
const pkg = await import("@unhead/schema-org-vue");
|
|
28
|
+
schemaOrgImports = pkg.schemaOrgAutoImports || {};
|
|
29
|
+
console.log("--- SCHEMA ORG IMPORTS LOADED ---", typeof schemaOrgImports, Array.isArray(schemaOrgImports));
|
|
30
|
+
} catch (e) {
|
|
31
|
+
console.log("--- SCHEMA ORG IMPORTS FAILED ---", e);
|
|
32
|
+
}
|
|
23
33
|
const flowRestartPatterns = [
|
|
24
34
|
/^flow\.config\.ts$/,
|
|
25
35
|
/^nitro\.config\.ts$/,
|
|
@@ -150,8 +160,13 @@ function createFlowHotReload(projectRoot, extraWatchPaths = []) {
|
|
|
150
160
|
invalidateFileModules(server, filePath, event);
|
|
151
161
|
invalidateVirtualModules(server, projectPath);
|
|
152
162
|
if (matchesAny(flowRestartPatterns, projectPath)) {
|
|
153
|
-
|
|
154
|
-
|
|
163
|
+
const isTemplateOrLayout = projectPath.startsWith("views/templates/") || projectPath.startsWith("views/layouts/");
|
|
164
|
+
const isPageDef = projectPath.startsWith("pages/");
|
|
165
|
+
if (event === "change" && (isTemplateOrLayout || isPageDef)) {
|
|
166
|
+
} else {
|
|
167
|
+
scheduleRestart(server);
|
|
168
|
+
return true;
|
|
169
|
+
}
|
|
155
170
|
}
|
|
156
171
|
const shouldReload = event === "change" ? matchesAny(flowFullReloadPatterns, projectPath) : matchesAny(flowStructureReloadPatterns, projectPath);
|
|
157
172
|
if (!shouldReload) {
|
|
@@ -240,6 +255,27 @@ function createFlowVirtualClientPages(projectRoot) {
|
|
|
240
255
|
}
|
|
241
256
|
};
|
|
242
257
|
}
|
|
258
|
+
function createFlowEmptyFileFallback() {
|
|
259
|
+
return {
|
|
260
|
+
name: "flow:empty-file-fallback",
|
|
261
|
+
enforce: "pre",
|
|
262
|
+
transform(code, id) {
|
|
263
|
+
const normalizedId = id.split("?")[0];
|
|
264
|
+
if (normalizedId.endsWith(".vue") && code.trim() === "") {
|
|
265
|
+
return {
|
|
266
|
+
code: "<template><div></div></template>",
|
|
267
|
+
map: null
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
if (normalizedId.endsWith(".ts") && normalizedId.includes("/pages/") && code.trim() === "") {
|
|
271
|
+
return {
|
|
272
|
+
code: "export default {};",
|
|
273
|
+
map: null
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
};
|
|
278
|
+
}
|
|
243
279
|
function FlowComponentsResolver() {
|
|
244
280
|
return {
|
|
245
281
|
type: "component",
|
|
@@ -257,9 +293,13 @@ export function createFlowViteConfig(options = {}) {
|
|
|
257
293
|
const projectRoot = resolve(options.projectRoot || process.cwd());
|
|
258
294
|
const flowConfig = resolveFlowConfig(options.userFlowConfig || {});
|
|
259
295
|
const flowModules = loadFlowModules(projectRoot, flowConfig);
|
|
296
|
+
const baseNitroConfig = createFlowNitroConfig({
|
|
297
|
+
projectRoot: options.projectRoot,
|
|
298
|
+
userFlowConfig: options.userFlowConfig
|
|
299
|
+
});
|
|
260
300
|
const flowNitroConfig = {
|
|
261
|
-
|
|
262
|
-
...
|
|
301
|
+
...baseNitroConfig,
|
|
302
|
+
typescript: { generateTsConfig: true, ...baseNitroConfig.typescript || {} }
|
|
263
303
|
};
|
|
264
304
|
const flowNitroHooks = flowNitroConfig.hooks || {};
|
|
265
305
|
const flowPackagePattern = /^@monkeyplus\/flow(?:\/.*)?$/;
|
|
@@ -288,7 +328,8 @@ export function createFlowViteConfig(options = {}) {
|
|
|
288
328
|
const mappedNitroImports = {};
|
|
289
329
|
if (flowModules.nitro.imports?.imports && Array.isArray(flowModules.nitro.imports.imports)) {
|
|
290
330
|
for (const item of flowModules.nitro.imports.imports) {
|
|
291
|
-
if (!item.from || !item.name)
|
|
331
|
+
if (!item.from || !item.name)
|
|
332
|
+
continue;
|
|
292
333
|
if (!mappedNitroImports[item.from]) {
|
|
293
334
|
mappedNitroImports[item.from] = [];
|
|
294
335
|
}
|
|
@@ -299,6 +340,7 @@ export function createFlowViteConfig(options = {}) {
|
|
|
299
340
|
}
|
|
300
341
|
}
|
|
301
342
|
}
|
|
343
|
+
const { imports: userImports, ...userAutoImport } = options.userFlowConfig?.autoImport || {};
|
|
302
344
|
return defineConfig({
|
|
303
345
|
plugins: [
|
|
304
346
|
createFlowVirtualServerModules(projectRoot, flowConfig),
|
|
@@ -309,6 +351,7 @@ export function createFlowViteConfig(options = {}) {
|
|
|
309
351
|
autoInstall: true,
|
|
310
352
|
compiler: "vue3"
|
|
311
353
|
}),
|
|
354
|
+
createFlowEmptyFileFallback(),
|
|
312
355
|
Vue(),
|
|
313
356
|
ui({
|
|
314
357
|
router: false,
|
|
@@ -321,16 +364,19 @@ export function createFlowViteConfig(options = {}) {
|
|
|
321
364
|
...options.userFlowConfig?.components?.resolvers || []
|
|
322
365
|
]
|
|
323
366
|
},
|
|
367
|
+
prose: true,
|
|
324
368
|
autoImport: {
|
|
325
369
|
dts: resolve(projectRoot, ".flow/types/auto-imports.d.ts"),
|
|
326
370
|
imports: [
|
|
327
371
|
{
|
|
328
|
-
"@monkeyplus/flow": ["definePage", "defineLayoutContext", "queryContent"],
|
|
372
|
+
"@monkeyplus/flow": ["definePage", "defineLayoutContext", "queryContent", "useSchemaOrg"],
|
|
329
373
|
...mappedNitroImports
|
|
330
374
|
},
|
|
331
|
-
...
|
|
375
|
+
...Array.isArray(schemaOrgImports) ? schemaOrgImports : [],
|
|
376
|
+
"vue",
|
|
377
|
+
...userImports || []
|
|
332
378
|
],
|
|
333
|
-
...
|
|
379
|
+
...userAutoImport
|
|
334
380
|
}
|
|
335
381
|
}),
|
|
336
382
|
nitro({
|
|
@@ -368,6 +414,15 @@ export function createFlowViteConfig(options = {}) {
|
|
|
368
414
|
}
|
|
369
415
|
}
|
|
370
416
|
},
|
|
417
|
+
optimizeDeps: {
|
|
418
|
+
include: [
|
|
419
|
+
"@nuxt/ui > prosemirror-state",
|
|
420
|
+
"@nuxt/ui > prosemirror-transform",
|
|
421
|
+
"@nuxt/ui > prosemirror-model",
|
|
422
|
+
"@nuxt/ui > prosemirror-view",
|
|
423
|
+
"@nuxt/ui > prosemirror-gapcursor"
|
|
424
|
+
]
|
|
425
|
+
},
|
|
371
426
|
resolve: {
|
|
372
427
|
alias: {
|
|
373
428
|
"@": resolve(projectRoot, "src"),
|
|
@@ -25,11 +25,38 @@ export default defineComponent({
|
|
|
25
25
|
},
|
|
26
26
|
setup(props, { slots }) {
|
|
27
27
|
const attrs = useAttrs();
|
|
28
|
-
|
|
28
|
+
const wrappedSlots = {};
|
|
29
|
+
const slotNames = Object.keys(slots);
|
|
30
|
+
if (slotNames.length > 0) {
|
|
31
|
+
for (const [name, slotFn] of Object.entries(slots)) {
|
|
32
|
+
if (slotFn) {
|
|
33
|
+
wrappedSlots[name] = (slotProps) => {
|
|
34
|
+
return h("div", { "data-flow-slot": name, style: "display: contents;" }, slotFn(slotProps));
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
const islandAttrs = {
|
|
29
40
|
"data-flow-island": props.name.toLowerCase(),
|
|
30
41
|
"data-flow-props": serializeIslandProps(props.props)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
42
|
+
};
|
|
43
|
+
if (slotNames.length > 0) {
|
|
44
|
+
islandAttrs["data-flow-slots"] = slotNames.join(",");
|
|
45
|
+
}
|
|
46
|
+
return () => {
|
|
47
|
+
const children = [
|
|
48
|
+
h(props.component, props.props, slotNames.length > 0 ? wrappedSlots : slots)
|
|
49
|
+
];
|
|
50
|
+
if (slotNames.length > 0) {
|
|
51
|
+
children.push(
|
|
52
|
+
h(
|
|
53
|
+
"div",
|
|
54
|
+
{ style: "display: none;", "data-flow-slot-templates": true },
|
|
55
|
+
slotNames.map((name) => h("div", { "data-flow-slot-template": name }, slots[name] ? slots[name]() : null))
|
|
56
|
+
)
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
return h(props.tag, mergeProps(attrs, islandAttrs), children);
|
|
60
|
+
};
|
|
34
61
|
}
|
|
35
62
|
});
|
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
import type { PropType } from 'vue';
|
|
2
|
+
import type { WatermarkOptions } from '../../../modules/images/runtime/types.ts';
|
|
3
|
+
/**
|
|
4
|
+
* MkImage
|
|
5
|
+
*
|
|
6
|
+
* A powerful image component that integrates with IPX for automatic optimization,
|
|
7
|
+
* resizing, and format conversion. Supports native lazy loading and 'blur-up'
|
|
8
|
+
* low quality image placeholders (LQIP) via lazysizes.
|
|
9
|
+
*
|
|
10
|
+
* Supports standard IPX modifiers for dynamic image processing:
|
|
11
|
+
* - width / height: resize the image
|
|
12
|
+
* - quality: set the JPEG/WEBP compression quality (0-100)
|
|
13
|
+
* - format: convert format (auto, webp, avif, png, jpeg, gif)
|
|
14
|
+
* - fit: contain, cover, fill, inside, outside
|
|
15
|
+
* - position: crop position (top, right top, center, etc.)
|
|
16
|
+
* - background: set background color (hex)
|
|
17
|
+
* - blur: apply gaussian blur
|
|
18
|
+
* - grayscale: convert to grayscale
|
|
19
|
+
* - rotate: rotate image in degrees
|
|
20
|
+
* - trim: trim borders
|
|
21
|
+
* - watermark: add watermark composite to the image
|
|
22
|
+
*/
|
|
1
23
|
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
2
24
|
src: {
|
|
3
25
|
type: StringConstructor;
|
|
@@ -7,14 +29,11 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
7
29
|
eWidth: (StringConstructor | NumberConstructor)[];
|
|
8
30
|
eHeight: (StringConstructor | NumberConstructor)[];
|
|
9
31
|
sync: BooleanConstructor;
|
|
32
|
+
aspect: StringConstructor;
|
|
10
33
|
strappi: BooleanConstructor;
|
|
11
34
|
thumb: (StringConstructor | BooleanConstructor)[];
|
|
12
|
-
thumbnail: {
|
|
13
|
-
type: (StringConstructor | BooleanConstructor)[];
|
|
14
|
-
default: undefined;
|
|
15
|
-
};
|
|
16
35
|
format: {
|
|
17
|
-
type:
|
|
36
|
+
type: PropType<"auto" | "webp" | "jpeg" | "png" | "avif" | "gif">;
|
|
18
37
|
default: undefined;
|
|
19
38
|
};
|
|
20
39
|
quality: {
|
|
@@ -26,9 +45,37 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
26
45
|
default: undefined;
|
|
27
46
|
};
|
|
28
47
|
fit: {
|
|
48
|
+
type: PropType<"contain" | "cover" | "fill" | "inside" | "outside">;
|
|
49
|
+
default: undefined;
|
|
50
|
+
};
|
|
51
|
+
blur: {
|
|
52
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
53
|
+
default: undefined;
|
|
54
|
+
};
|
|
55
|
+
trim: {
|
|
56
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
57
|
+
default: undefined;
|
|
58
|
+
};
|
|
59
|
+
position: {
|
|
60
|
+
type: PropType<"top" | "right top" | "right" | "right bottom" | "bottom" | "left bottom" | "left" | "left top" | "center">;
|
|
61
|
+
default: undefined;
|
|
62
|
+
};
|
|
63
|
+
grayscale: {
|
|
64
|
+
type: (StringConstructor | BooleanConstructor)[];
|
|
65
|
+
default: undefined;
|
|
66
|
+
};
|
|
67
|
+
rotate: {
|
|
68
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
69
|
+
default: undefined;
|
|
70
|
+
};
|
|
71
|
+
size: {
|
|
29
72
|
type: StringConstructor;
|
|
30
73
|
default: undefined;
|
|
31
74
|
};
|
|
75
|
+
watermark: {
|
|
76
|
+
type: PropType<boolean | string | WatermarkOptions>;
|
|
77
|
+
default: undefined;
|
|
78
|
+
};
|
|
32
79
|
modifiers: {
|
|
33
80
|
type: () => Record<string, any>;
|
|
34
81
|
default: undefined;
|
|
@@ -62,7 +109,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
62
109
|
default: undefined;
|
|
63
110
|
};
|
|
64
111
|
referrerpolicy: {
|
|
65
|
-
type:
|
|
112
|
+
type: PropType<"no-referrer" | "no-referrer-when-downgrade" | "origin" | "origin-when-cross-origin" | "same-origin" | "strict-origin" | "strict-origin-when-cross-origin" | "unsafe-url">;
|
|
66
113
|
default: undefined;
|
|
67
114
|
};
|
|
68
115
|
usemap: {
|
|
@@ -78,7 +125,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
78
125
|
default: undefined;
|
|
79
126
|
};
|
|
80
127
|
loading: {
|
|
81
|
-
type:
|
|
128
|
+
type: PropType<"lazy" | "eager">;
|
|
82
129
|
default: undefined;
|
|
83
130
|
};
|
|
84
131
|
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
@@ -92,14 +139,11 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
92
139
|
eWidth: (StringConstructor | NumberConstructor)[];
|
|
93
140
|
eHeight: (StringConstructor | NumberConstructor)[];
|
|
94
141
|
sync: BooleanConstructor;
|
|
142
|
+
aspect: StringConstructor;
|
|
95
143
|
strappi: BooleanConstructor;
|
|
96
144
|
thumb: (StringConstructor | BooleanConstructor)[];
|
|
97
|
-
thumbnail: {
|
|
98
|
-
type: (StringConstructor | BooleanConstructor)[];
|
|
99
|
-
default: undefined;
|
|
100
|
-
};
|
|
101
145
|
format: {
|
|
102
|
-
type:
|
|
146
|
+
type: PropType<"auto" | "webp" | "jpeg" | "png" | "avif" | "gif">;
|
|
103
147
|
default: undefined;
|
|
104
148
|
};
|
|
105
149
|
quality: {
|
|
@@ -111,9 +155,37 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
111
155
|
default: undefined;
|
|
112
156
|
};
|
|
113
157
|
fit: {
|
|
158
|
+
type: PropType<"contain" | "cover" | "fill" | "inside" | "outside">;
|
|
159
|
+
default: undefined;
|
|
160
|
+
};
|
|
161
|
+
blur: {
|
|
162
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
163
|
+
default: undefined;
|
|
164
|
+
};
|
|
165
|
+
trim: {
|
|
166
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
167
|
+
default: undefined;
|
|
168
|
+
};
|
|
169
|
+
position: {
|
|
170
|
+
type: PropType<"top" | "right top" | "right" | "right bottom" | "bottom" | "left bottom" | "left" | "left top" | "center">;
|
|
171
|
+
default: undefined;
|
|
172
|
+
};
|
|
173
|
+
grayscale: {
|
|
174
|
+
type: (StringConstructor | BooleanConstructor)[];
|
|
175
|
+
default: undefined;
|
|
176
|
+
};
|
|
177
|
+
rotate: {
|
|
178
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
179
|
+
default: undefined;
|
|
180
|
+
};
|
|
181
|
+
size: {
|
|
114
182
|
type: StringConstructor;
|
|
115
183
|
default: undefined;
|
|
116
184
|
};
|
|
185
|
+
watermark: {
|
|
186
|
+
type: PropType<boolean | string | WatermarkOptions>;
|
|
187
|
+
default: undefined;
|
|
188
|
+
};
|
|
117
189
|
modifiers: {
|
|
118
190
|
type: () => Record<string, any>;
|
|
119
191
|
default: undefined;
|
|
@@ -147,7 +219,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
147
219
|
default: undefined;
|
|
148
220
|
};
|
|
149
221
|
referrerpolicy: {
|
|
150
|
-
type:
|
|
222
|
+
type: PropType<"no-referrer" | "no-referrer-when-downgrade" | "origin" | "origin-when-cross-origin" | "same-origin" | "strict-origin" | "strict-origin-when-cross-origin" | "unsafe-url">;
|
|
151
223
|
default: undefined;
|
|
152
224
|
};
|
|
153
225
|
usemap: {
|
|
@@ -163,29 +235,35 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
163
235
|
default: undefined;
|
|
164
236
|
};
|
|
165
237
|
loading: {
|
|
166
|
-
type:
|
|
238
|
+
type: PropType<"lazy" | "eager">;
|
|
167
239
|
default: undefined;
|
|
168
240
|
};
|
|
169
241
|
}>> & Readonly<{}>, {
|
|
170
242
|
width: string | number;
|
|
171
243
|
height: string | number;
|
|
172
|
-
fit:
|
|
173
|
-
format:
|
|
244
|
+
fit: "contain" | "cover" | "fill" | "inside" | "outside";
|
|
245
|
+
format: "auto" | "webp" | "jpeg" | "png" | "avif" | "gif";
|
|
246
|
+
quality: string | number;
|
|
247
|
+
background: string;
|
|
248
|
+
blur: string | number;
|
|
249
|
+
trim: string | number;
|
|
250
|
+
position: "top" | "right top" | "right" | "right bottom" | "bottom" | "left bottom" | "left" | "left top" | "center";
|
|
251
|
+
grayscale: string | boolean;
|
|
252
|
+
rotate: string | number;
|
|
253
|
+
size: string;
|
|
254
|
+
watermark: string | boolean | WatermarkOptions;
|
|
174
255
|
provider: string;
|
|
175
256
|
preset: string;
|
|
176
257
|
modifiers: Record<string, any>;
|
|
177
258
|
sizes: string | Record<string, any>;
|
|
178
|
-
background: string;
|
|
179
|
-
quality: string | number;
|
|
180
259
|
strappi: boolean;
|
|
181
260
|
alt: string;
|
|
182
|
-
referrerpolicy:
|
|
261
|
+
referrerpolicy: "no-referrer" | "no-referrer-when-downgrade" | "origin" | "origin-when-cross-origin" | "same-origin" | "strict-origin" | "strict-origin-when-cross-origin" | "unsafe-url";
|
|
183
262
|
usemap: string;
|
|
184
263
|
longdesc: string;
|
|
185
264
|
ismap: boolean;
|
|
186
|
-
loading:
|
|
187
|
-
sync: boolean;
|
|
188
|
-
thumbnail: string | boolean;
|
|
265
|
+
loading: "lazy" | "eager";
|
|
189
266
|
title: string;
|
|
267
|
+
sync: boolean;
|
|
190
268
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
191
269
|
export default _default;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { computed, defineComponent, h } from "vue";
|
|
2
2
|
import { parseSize } from "../../../modules/images/runtime/helpers.mjs";
|
|
3
|
-
import { useImage
|
|
3
|
+
import { useImage } from "./image-shared.mjs";
|
|
4
4
|
function resolveImageSource(value, fallback) {
|
|
5
5
|
if (typeof value === "string" && value.length) {
|
|
6
6
|
return value;
|
|
@@ -17,9 +17,6 @@ function isRuntimeLambda() {
|
|
|
17
17
|
const runtimeProcess = typeof globalThis === "object" ? Reflect.get(globalThis, "process") : void 0;
|
|
18
18
|
return !!(runtimeProcess?.env?.LAMBDA_TASK_ROOT || runtimeProcess?.env?.AWS_LAMBDA_FUNCTION_VERSION);
|
|
19
19
|
}
|
|
20
|
-
function resolveThumbnailValue(value, fallback) {
|
|
21
|
-
return value !== void 0 ? value : fallback;
|
|
22
|
-
}
|
|
23
20
|
export default defineComponent({
|
|
24
21
|
name: "MkImage",
|
|
25
22
|
inheritAttrs: false,
|
|
@@ -32,13 +29,21 @@ export default defineComponent({
|
|
|
32
29
|
eWidth: [String, Number],
|
|
33
30
|
eHeight: [String, Number],
|
|
34
31
|
sync: Boolean,
|
|
32
|
+
aspect: String,
|
|
35
33
|
strappi: Boolean,
|
|
36
34
|
thumb: [Boolean, String],
|
|
37
|
-
thumbnail: { type: [Boolean, String], default:
|
|
35
|
+
// thumbnail: { type: [Boolean, String], default: undefined },
|
|
38
36
|
format: { type: String, default: void 0 },
|
|
39
37
|
quality: { type: [Number, String], default: void 0 },
|
|
40
38
|
background: { type: String, default: void 0 },
|
|
41
39
|
fit: { type: String, default: void 0 },
|
|
40
|
+
blur: { type: [Number, String], default: void 0 },
|
|
41
|
+
trim: { type: [Number, String], default: void 0 },
|
|
42
|
+
position: { type: String, default: void 0 },
|
|
43
|
+
grayscale: { type: [Boolean, String], default: void 0 },
|
|
44
|
+
rotate: { type: [Number, String], default: void 0 },
|
|
45
|
+
size: { type: String, default: void 0 },
|
|
46
|
+
watermark: { type: [Boolean, String, Object], default: void 0 },
|
|
42
47
|
modifiers: {
|
|
43
48
|
type: Object,
|
|
44
49
|
default: void 0
|
|
@@ -101,9 +106,9 @@ export default defineComponent({
|
|
|
101
106
|
imageUtils.getImage?.(resolvedSrc.value, nModifiers.value, nOption.value),
|
|
102
107
|
resolvedSrc.value
|
|
103
108
|
);
|
|
104
|
-
const thumb =
|
|
109
|
+
const thumb = props.thumb;
|
|
105
110
|
const thumbnail = typeof thumb === "string" ? thumb : thumb ? resolveImageSource(
|
|
106
|
-
imageUtils.getImage?.(resolvedSrc.value, { quality:
|
|
111
|
+
imageUtils.getImage?.(resolvedSrc.value, { quality: 30, width: 80 }, nOption.value),
|
|
107
112
|
resolvedSrc.value
|
|
108
113
|
) : void 0;
|
|
109
114
|
return {
|
|
@@ -111,7 +116,6 @@ export default defineComponent({
|
|
|
111
116
|
thumbnail
|
|
112
117
|
};
|
|
113
118
|
});
|
|
114
|
-
useLazySizes(() => !isRuntimeLambda() && !!nSrc.value.thumbnail);
|
|
115
119
|
return () => {
|
|
116
120
|
const compatibilityThumb = !isRuntimeLambda() && nSrc.value.thumbnail;
|
|
117
121
|
return h("img", {
|
|
@@ -119,13 +123,17 @@ export default defineComponent({
|
|
|
119
123
|
...nAttrs.value,
|
|
120
124
|
"src": isRuntimeLambda() ? resolvedSrc.value : compatibilityThumb || nSrc.value.normal,
|
|
121
125
|
"data-src": compatibilityThumb ? nSrc.value.normal : void 0,
|
|
122
|
-
"data-thumb": compatibilityThumb,
|
|
123
126
|
"alt": props.alt || image.value.alt,
|
|
124
127
|
"title": props.title || image.value.title,
|
|
125
128
|
"class": compatibilityThumb ? [attrs.class, "lazyload"] : attrs.class,
|
|
126
|
-
"width": props.eWidth || nAttrs.value.width,
|
|
127
|
-
"height": props.eHeight || nAttrs.value.height,
|
|
128
|
-
"x-src": getLocalSource(resolvedSrc.value)
|
|
129
|
+
"width": props.aspect ? "100%" : props.eWidth || nAttrs.value.width,
|
|
130
|
+
"height": props.aspect ? "auto" : props.eHeight || nAttrs.value.height,
|
|
131
|
+
"x-src": getLocalSource(resolvedSrc.value),
|
|
132
|
+
"style": {
|
|
133
|
+
aspectRatio: props.aspect,
|
|
134
|
+
objectFit: props.aspect ? "cover" : void 0,
|
|
135
|
+
objectPosition: props.aspect ? "center" : void 0
|
|
136
|
+
}
|
|
129
137
|
});
|
|
130
138
|
};
|
|
131
139
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import type { PropType } from 'vue';
|
|
1
2
|
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
2
|
-
|
|
3
|
+
as: {
|
|
4
|
+
type: PropType<"a" | "slot">;
|
|
5
|
+
};
|
|
3
6
|
to: {
|
|
4
7
|
type: StringConstructor;
|
|
5
8
|
required: true;
|
|
@@ -10,13 +13,13 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
10
13
|
}> | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
11
14
|
[key: string]: any;
|
|
12
15
|
}>[] | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
13
|
-
|
|
16
|
+
as: {
|
|
17
|
+
type: PropType<"a" | "slot">;
|
|
18
|
+
};
|
|
14
19
|
to: {
|
|
15
20
|
type: StringConstructor;
|
|
16
21
|
required: true;
|
|
17
22
|
};
|
|
18
23
|
locale: StringConstructor;
|
|
19
|
-
}>> & Readonly<{}>, {
|
|
20
|
-
isSlot: boolean;
|
|
21
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
24
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
22
25
|
export default _default;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { consola } from "consola";
|
|
1
2
|
import { defineComponent, h, inject, onServerPrefetch, ref, watch } from "vue";
|
|
2
3
|
const flowUtilsKey = "utils";
|
|
3
4
|
function isExternalTarget(value) {
|
|
@@ -23,7 +24,9 @@ function normalizeNamedTarget(value, localeCode, lang, loc) {
|
|
|
23
24
|
export default defineComponent({
|
|
24
25
|
name: "MkLink",
|
|
25
26
|
props: {
|
|
26
|
-
|
|
27
|
+
as: {
|
|
28
|
+
type: String
|
|
29
|
+
},
|
|
27
30
|
to: {
|
|
28
31
|
type: String,
|
|
29
32
|
required: true
|
|
@@ -54,7 +57,10 @@ export default defineComponent({
|
|
|
54
57
|
href.value = namedTarget;
|
|
55
58
|
return;
|
|
56
59
|
}
|
|
57
|
-
href.value = await utils.getUrl(namedTarget, props.locale) ||
|
|
60
|
+
href.value = await utils.getUrl(namedTarget, props.locale) || "/404";
|
|
61
|
+
if (href.value === "/404") {
|
|
62
|
+
consola.warn(`[MkLink] No se encontro la ruta para ${namedTarget}`);
|
|
63
|
+
}
|
|
58
64
|
};
|
|
59
65
|
onServerPrefetch(updateHref);
|
|
60
66
|
if (isClient) {
|
|
@@ -63,7 +69,7 @@ export default defineComponent({
|
|
|
63
69
|
}, { immediate: true });
|
|
64
70
|
}
|
|
65
71
|
return () => {
|
|
66
|
-
if (props.
|
|
72
|
+
if (props.as === "slot") {
|
|
67
73
|
return slots.default?.({ href: href.value }) || null;
|
|
68
74
|
}
|
|
69
75
|
return h("a", { href: href.value }, slots.default ? slots.default() : href.value);
|