Spaces:
Running
Running
File size: 10,252 Bytes
979bf48 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 | "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
AppleWebAppMeta: null,
BasicMeta: null,
FacebookMeta: null,
FormatDetectionMeta: null,
ItunesMeta: null,
PinterestMeta: null,
VerificationMeta: null,
ViewportMeta: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
AppleWebAppMeta: function() {
return AppleWebAppMeta;
},
BasicMeta: function() {
return BasicMeta;
},
FacebookMeta: function() {
return FacebookMeta;
},
FormatDetectionMeta: function() {
return FormatDetectionMeta;
},
ItunesMeta: function() {
return ItunesMeta;
},
PinterestMeta: function() {
return PinterestMeta;
},
VerificationMeta: function() {
return VerificationMeta;
},
ViewportMeta: function() {
return ViewportMeta;
}
});
const _jsxruntime = require("react/jsx-runtime");
const _meta = require("./meta");
const _constants = require("../constants");
const _utils = require("./utils");
// convert viewport object to string for viewport meta tag
function resolveViewportLayout(viewport) {
let resolved = null;
if (viewport && typeof viewport === 'object') {
resolved = '';
for(const viewportKey_ in _constants.ViewportMetaKeys){
const viewportKey = viewportKey_;
if (viewportKey in viewport) {
let value = viewport[viewportKey];
if (typeof value === 'boolean') {
value = value ? 'yes' : 'no';
} else if (!value && viewportKey === 'initialScale') {
value = undefined;
}
if (value) {
if (resolved) resolved += ', ';
resolved += `${_constants.ViewportMetaKeys[viewportKey]}=${value}`;
}
}
}
}
return resolved;
}
function ViewportMeta({ viewport }) {
return (0, _meta.MetaFilter)([
/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", {
charSet: "utf-8"
}),
(0, _meta.Meta)({
name: 'viewport',
content: resolveViewportLayout(viewport)
}),
...viewport.themeColor ? viewport.themeColor.map((themeColor)=>(0, _meta.Meta)({
name: 'theme-color',
content: themeColor.color,
media: themeColor.media
})) : [],
(0, _meta.Meta)({
name: 'color-scheme',
content: viewport.colorScheme
})
]);
}
function BasicMeta({ metadata }) {
var _metadata_keywords, _metadata_robots, _metadata_robots1;
const manifestOrigin = metadata.manifest ? (0, _utils.getOrigin)(metadata.manifest) : undefined;
return (0, _meta.MetaFilter)([
metadata.title !== null && metadata.title.absolute ? /*#__PURE__*/ (0, _jsxruntime.jsx)("title", {
children: metadata.title.absolute
}) : null,
(0, _meta.Meta)({
name: 'description',
content: metadata.description
}),
(0, _meta.Meta)({
name: 'application-name',
content: metadata.applicationName
}),
...metadata.authors ? metadata.authors.map((author)=>[
author.url ? /*#__PURE__*/ (0, _jsxruntime.jsx)("link", {
rel: "author",
href: author.url.toString()
}) : null,
(0, _meta.Meta)({
name: 'author',
content: author.name
})
]) : [],
metadata.manifest ? /*#__PURE__*/ (0, _jsxruntime.jsx)("link", {
rel: "manifest",
href: metadata.manifest.toString(),
// If it's same origin, and it's a preview deployment,
// including credentials for manifest request.
crossOrigin: !manifestOrigin && process.env.VERCEL_ENV === 'preview' ? 'use-credentials' : undefined
}) : null,
(0, _meta.Meta)({
name: 'generator',
content: metadata.generator
}),
(0, _meta.Meta)({
name: 'keywords',
content: (_metadata_keywords = metadata.keywords) == null ? void 0 : _metadata_keywords.join(',')
}),
(0, _meta.Meta)({
name: 'referrer',
content: metadata.referrer
}),
(0, _meta.Meta)({
name: 'creator',
content: metadata.creator
}),
(0, _meta.Meta)({
name: 'publisher',
content: metadata.publisher
}),
(0, _meta.Meta)({
name: 'robots',
content: (_metadata_robots = metadata.robots) == null ? void 0 : _metadata_robots.basic
}),
(0, _meta.Meta)({
name: 'googlebot',
content: (_metadata_robots1 = metadata.robots) == null ? void 0 : _metadata_robots1.googleBot
}),
(0, _meta.Meta)({
name: 'abstract',
content: metadata.abstract
}),
...metadata.archives ? metadata.archives.map((archive)=>/*#__PURE__*/ (0, _jsxruntime.jsx)("link", {
rel: "archives",
href: archive
})) : [],
...metadata.assets ? metadata.assets.map((asset)=>/*#__PURE__*/ (0, _jsxruntime.jsx)("link", {
rel: "assets",
href: asset
})) : [],
...metadata.bookmarks ? metadata.bookmarks.map((bookmark)=>/*#__PURE__*/ (0, _jsxruntime.jsx)("link", {
rel: "bookmarks",
href: bookmark
})) : [],
...metadata.pagination ? [
metadata.pagination.previous ? /*#__PURE__*/ (0, _jsxruntime.jsx)("link", {
rel: "prev",
href: metadata.pagination.previous
}) : null,
metadata.pagination.next ? /*#__PURE__*/ (0, _jsxruntime.jsx)("link", {
rel: "next",
href: metadata.pagination.next
}) : null
] : [],
(0, _meta.Meta)({
name: 'category',
content: metadata.category
}),
(0, _meta.Meta)({
name: 'classification',
content: metadata.classification
}),
...metadata.other ? Object.entries(metadata.other).map(([name, content])=>{
if (Array.isArray(content)) {
return content.map((contentItem)=>(0, _meta.Meta)({
name,
content: contentItem
}));
} else {
return (0, _meta.Meta)({
name,
content
});
}
}) : []
]);
}
function ItunesMeta({ itunes }) {
if (!itunes) return null;
const { appId, appArgument } = itunes;
let content = `app-id=${appId}`;
if (appArgument) {
content += `, app-argument=${appArgument}`;
}
return /*#__PURE__*/ (0, _jsxruntime.jsx)("meta", {
name: "apple-itunes-app",
content: content
});
}
function FacebookMeta({ facebook }) {
if (!facebook) return null;
const { appId, admins } = facebook;
return (0, _meta.MetaFilter)([
appId ? /*#__PURE__*/ (0, _jsxruntime.jsx)("meta", {
property: "fb:app_id",
content: appId
}) : null,
...admins ? admins.map((admin)=>/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", {
property: "fb:admins",
content: admin
})) : []
]);
}
function PinterestMeta({ pinterest }) {
if (!pinterest || pinterest.richPin === undefined) return null;
const { richPin } = pinterest;
return /*#__PURE__*/ (0, _jsxruntime.jsx)("meta", {
property: "pinterest-rich-pin",
content: richPin.toString()
});
}
const formatDetectionKeys = [
'telephone',
'date',
'address',
'email',
'url'
];
function FormatDetectionMeta({ formatDetection }) {
if (!formatDetection) return null;
let content = '';
for (const key of formatDetectionKeys){
if (formatDetection[key] === false) {
if (content) content += ', ';
content += `${key}=no`;
}
}
return content ? /*#__PURE__*/ (0, _jsxruntime.jsx)("meta", {
name: "format-detection",
content: content
}) : null;
}
function AppleWebAppMeta({ appleWebApp }) {
if (!appleWebApp) return null;
const { capable, title, startupImage, statusBarStyle } = appleWebApp;
return (0, _meta.MetaFilter)([
capable ? (0, _meta.Meta)({
name: 'mobile-web-app-capable',
content: 'yes'
}) : null,
(0, _meta.Meta)({
name: 'apple-mobile-web-app-title',
content: title
}),
startupImage ? startupImage.map((image)=>/*#__PURE__*/ (0, _jsxruntime.jsx)("link", {
href: image.url,
media: image.media,
rel: "apple-touch-startup-image"
})) : null,
statusBarStyle ? (0, _meta.Meta)({
name: 'apple-mobile-web-app-status-bar-style',
content: statusBarStyle
}) : null
]);
}
function VerificationMeta({ verification }) {
if (!verification) return null;
return (0, _meta.MetaFilter)([
(0, _meta.MultiMeta)({
namePrefix: 'google-site-verification',
contents: verification.google
}),
(0, _meta.MultiMeta)({
namePrefix: 'y_key',
contents: verification.yahoo
}),
(0, _meta.MultiMeta)({
namePrefix: 'yandex-verification',
contents: verification.yandex
}),
(0, _meta.MultiMeta)({
namePrefix: 'me',
contents: verification.me
}),
...verification.other ? Object.entries(verification.other).map(([key, value])=>(0, _meta.MultiMeta)({
namePrefix: key,
contents: value
})) : []
]);
}
//# sourceMappingURL=basic.js.map |