@lolyjs/core 0.3.0-alpha.4 → 0.3.0-alpha.6
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 +74 -0
- package/dist/cli.cjs +672 -162
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +672 -162
- package/dist/cli.mjs.map +1 -1
- package/dist/index.cjs +867 -355
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +26 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.mjs +867 -355
- package/dist/index.mjs.map +1 -1
- package/dist/react/components.cjs +122 -5
- package/dist/react/components.cjs.map +1 -1
- package/dist/react/components.d.mts +18 -4
- package/dist/react/components.d.ts +18 -4
- package/dist/react/components.mjs +123 -6
- package/dist/react/components.mjs.map +1 -1
- package/dist/runtime.cjs +118 -116
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.mjs +118 -116
- package/dist/runtime.mjs.map +1 -1
- package/package.json +3 -1
package/dist/runtime.cjs
CHANGED
|
@@ -154,132 +154,134 @@ function getOrCreateLink(rel, href) {
|
|
|
154
154
|
}
|
|
155
155
|
function applyMetadata(md) {
|
|
156
156
|
if (!md) return;
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
if (md.description) {
|
|
161
|
-
const meta = getOrCreateMeta('meta[name="description"]', { name: "description" });
|
|
162
|
-
meta.content = md.description;
|
|
163
|
-
}
|
|
164
|
-
if (md.robots) {
|
|
165
|
-
const meta = getOrCreateMeta('meta[name="robots"]', { name: "robots" });
|
|
166
|
-
meta.content = md.robots;
|
|
167
|
-
}
|
|
168
|
-
if (md.themeColor) {
|
|
169
|
-
const meta = getOrCreateMeta('meta[name="theme-color"]', { name: "theme-color" });
|
|
170
|
-
meta.content = md.themeColor;
|
|
171
|
-
}
|
|
172
|
-
if (md.viewport) {
|
|
173
|
-
const meta = getOrCreateMeta('meta[name="viewport"]', { name: "viewport" });
|
|
174
|
-
meta.content = md.viewport;
|
|
175
|
-
}
|
|
176
|
-
if (md.canonical) {
|
|
177
|
-
getOrCreateLink("canonical", md.canonical);
|
|
178
|
-
}
|
|
179
|
-
if (md.openGraph) {
|
|
180
|
-
const og = md.openGraph;
|
|
181
|
-
if (og.title) {
|
|
182
|
-
const meta = getOrCreateMeta('meta[property="og:title"]', { property: "og:title" });
|
|
183
|
-
meta.content = og.title;
|
|
184
|
-
}
|
|
185
|
-
if (og.description) {
|
|
186
|
-
const meta = getOrCreateMeta('meta[property="og:description"]', { property: "og:description" });
|
|
187
|
-
meta.content = og.description;
|
|
188
|
-
}
|
|
189
|
-
if (og.type) {
|
|
190
|
-
const meta = getOrCreateMeta('meta[property="og:type"]', { property: "og:type" });
|
|
191
|
-
meta.content = og.type;
|
|
192
|
-
}
|
|
193
|
-
if (og.url) {
|
|
194
|
-
const meta = getOrCreateMeta('meta[property="og:url"]', { property: "og:url" });
|
|
195
|
-
meta.content = og.url;
|
|
196
|
-
}
|
|
197
|
-
if (og.image) {
|
|
198
|
-
if (typeof og.image === "string") {
|
|
199
|
-
const meta = getOrCreateMeta('meta[property="og:image"]', { property: "og:image" });
|
|
200
|
-
meta.content = og.image;
|
|
201
|
-
} else {
|
|
202
|
-
const meta = getOrCreateMeta('meta[property="og:image"]', { property: "og:image" });
|
|
203
|
-
meta.content = og.image.url;
|
|
204
|
-
if (og.image.width) {
|
|
205
|
-
const metaWidth = getOrCreateMeta('meta[property="og:image:width"]', { property: "og:image:width" });
|
|
206
|
-
metaWidth.content = String(og.image.width);
|
|
207
|
-
}
|
|
208
|
-
if (og.image.height) {
|
|
209
|
-
const metaHeight = getOrCreateMeta('meta[property="og:image:height"]', { property: "og:image:height" });
|
|
210
|
-
metaHeight.content = String(og.image.height);
|
|
211
|
-
}
|
|
212
|
-
if (og.image.alt) {
|
|
213
|
-
const metaAlt = getOrCreateMeta('meta[property="og:image:alt"]', { property: "og:image:alt" });
|
|
214
|
-
metaAlt.content = og.image.alt;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
157
|
+
requestAnimationFrame(() => {
|
|
158
|
+
if (md.title) {
|
|
159
|
+
document.title = md.title;
|
|
217
160
|
}
|
|
218
|
-
if (
|
|
219
|
-
const meta = getOrCreateMeta('meta[
|
|
220
|
-
meta.content =
|
|
161
|
+
if (md.description) {
|
|
162
|
+
const meta = getOrCreateMeta('meta[name="description"]', { name: "description" });
|
|
163
|
+
meta.content = md.description;
|
|
221
164
|
}
|
|
222
|
-
if (
|
|
223
|
-
const meta = getOrCreateMeta('meta[
|
|
224
|
-
meta.content =
|
|
165
|
+
if (md.robots) {
|
|
166
|
+
const meta = getOrCreateMeta('meta[name="robots"]', { name: "robots" });
|
|
167
|
+
meta.content = md.robots;
|
|
225
168
|
}
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
if (twitter.card) {
|
|
230
|
-
const meta = getOrCreateMeta('meta[name="twitter:card"]', { name: "twitter:card" });
|
|
231
|
-
meta.content = twitter.card;
|
|
169
|
+
if (md.themeColor) {
|
|
170
|
+
const meta = getOrCreateMeta('meta[name="theme-color"]', { name: "theme-color" });
|
|
171
|
+
meta.content = md.themeColor;
|
|
232
172
|
}
|
|
233
|
-
if (
|
|
234
|
-
const meta = getOrCreateMeta('meta[name="
|
|
235
|
-
meta.content =
|
|
173
|
+
if (md.viewport) {
|
|
174
|
+
const meta = getOrCreateMeta('meta[name="viewport"]', { name: "viewport" });
|
|
175
|
+
meta.content = md.viewport;
|
|
236
176
|
}
|
|
237
|
-
if (
|
|
238
|
-
|
|
239
|
-
meta.content = twitter.description;
|
|
177
|
+
if (md.canonical) {
|
|
178
|
+
getOrCreateLink("canonical", md.canonical);
|
|
240
179
|
}
|
|
241
|
-
if (
|
|
242
|
-
const
|
|
243
|
-
|
|
180
|
+
if (md.openGraph) {
|
|
181
|
+
const og = md.openGraph;
|
|
182
|
+
if (og.title) {
|
|
183
|
+
const meta = getOrCreateMeta('meta[property="og:title"]', { property: "og:title" });
|
|
184
|
+
meta.content = og.title;
|
|
185
|
+
}
|
|
186
|
+
if (og.description) {
|
|
187
|
+
const meta = getOrCreateMeta('meta[property="og:description"]', { property: "og:description" });
|
|
188
|
+
meta.content = og.description;
|
|
189
|
+
}
|
|
190
|
+
if (og.type) {
|
|
191
|
+
const meta = getOrCreateMeta('meta[property="og:type"]', { property: "og:type" });
|
|
192
|
+
meta.content = og.type;
|
|
193
|
+
}
|
|
194
|
+
if (og.url) {
|
|
195
|
+
const meta = getOrCreateMeta('meta[property="og:url"]', { property: "og:url" });
|
|
196
|
+
meta.content = og.url;
|
|
197
|
+
}
|
|
198
|
+
if (og.image) {
|
|
199
|
+
if (typeof og.image === "string") {
|
|
200
|
+
const meta = getOrCreateMeta('meta[property="og:image"]', { property: "og:image" });
|
|
201
|
+
meta.content = og.image;
|
|
202
|
+
} else {
|
|
203
|
+
const meta = getOrCreateMeta('meta[property="og:image"]', { property: "og:image" });
|
|
204
|
+
meta.content = og.image.url;
|
|
205
|
+
if (og.image.width) {
|
|
206
|
+
const metaWidth = getOrCreateMeta('meta[property="og:image:width"]', { property: "og:image:width" });
|
|
207
|
+
metaWidth.content = String(og.image.width);
|
|
208
|
+
}
|
|
209
|
+
if (og.image.height) {
|
|
210
|
+
const metaHeight = getOrCreateMeta('meta[property="og:image:height"]', { property: "og:image:height" });
|
|
211
|
+
metaHeight.content = String(og.image.height);
|
|
212
|
+
}
|
|
213
|
+
if (og.image.alt) {
|
|
214
|
+
const metaAlt = getOrCreateMeta('meta[property="og:image:alt"]', { property: "og:image:alt" });
|
|
215
|
+
metaAlt.content = og.image.alt;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
if (og.siteName) {
|
|
220
|
+
const meta = getOrCreateMeta('meta[property="og:site_name"]', { property: "og:site_name" });
|
|
221
|
+
meta.content = og.siteName;
|
|
222
|
+
}
|
|
223
|
+
if (og.locale) {
|
|
224
|
+
const meta = getOrCreateMeta('meta[property="og:locale"]', { property: "og:locale" });
|
|
225
|
+
meta.content = og.locale;
|
|
226
|
+
}
|
|
244
227
|
}
|
|
245
|
-
if (twitter
|
|
246
|
-
const
|
|
247
|
-
|
|
228
|
+
if (md.twitter) {
|
|
229
|
+
const twitter = md.twitter;
|
|
230
|
+
if (twitter.card) {
|
|
231
|
+
const meta = getOrCreateMeta('meta[name="twitter:card"]', { name: "twitter:card" });
|
|
232
|
+
meta.content = twitter.card;
|
|
233
|
+
}
|
|
234
|
+
if (twitter.title) {
|
|
235
|
+
const meta = getOrCreateMeta('meta[name="twitter:title"]', { name: "twitter:title" });
|
|
236
|
+
meta.content = twitter.title;
|
|
237
|
+
}
|
|
238
|
+
if (twitter.description) {
|
|
239
|
+
const meta = getOrCreateMeta('meta[name="twitter:description"]', { name: "twitter:description" });
|
|
240
|
+
meta.content = twitter.description;
|
|
241
|
+
}
|
|
242
|
+
if (twitter.image) {
|
|
243
|
+
const meta = getOrCreateMeta('meta[name="twitter:image"]', { name: "twitter:image" });
|
|
244
|
+
meta.content = twitter.image;
|
|
245
|
+
}
|
|
246
|
+
if (twitter.imageAlt) {
|
|
247
|
+
const meta = getOrCreateMeta('meta[name="twitter:image:alt"]', { name: "twitter:image:alt" });
|
|
248
|
+
meta.content = twitter.imageAlt;
|
|
249
|
+
}
|
|
250
|
+
if (twitter.site) {
|
|
251
|
+
const meta = getOrCreateMeta('meta[name="twitter:site"]', { name: "twitter:site" });
|
|
252
|
+
meta.content = twitter.site;
|
|
253
|
+
}
|
|
254
|
+
if (twitter.creator) {
|
|
255
|
+
const meta = getOrCreateMeta('meta[name="twitter:creator"]', { name: "twitter:creator" });
|
|
256
|
+
meta.content = twitter.creator;
|
|
257
|
+
}
|
|
248
258
|
}
|
|
249
|
-
if (
|
|
250
|
-
|
|
251
|
-
|
|
259
|
+
if (md.metaTags && Array.isArray(md.metaTags)) {
|
|
260
|
+
md.metaTags.forEach((tag) => {
|
|
261
|
+
let selector = "";
|
|
262
|
+
if (tag.name) {
|
|
263
|
+
selector = `meta[name="${tag.name}"]`;
|
|
264
|
+
} else if (tag.property) {
|
|
265
|
+
selector = `meta[property="${tag.property}"]`;
|
|
266
|
+
} else if (tag.httpEquiv) {
|
|
267
|
+
selector = `meta[http-equiv="${tag.httpEquiv}"]`;
|
|
268
|
+
}
|
|
269
|
+
if (selector) {
|
|
270
|
+
const meta = getOrCreateMeta(selector, {
|
|
271
|
+
name: tag.name,
|
|
272
|
+
property: tag.property,
|
|
273
|
+
httpEquiv: tag.httpEquiv
|
|
274
|
+
});
|
|
275
|
+
meta.content = tag.content;
|
|
276
|
+
}
|
|
277
|
+
});
|
|
252
278
|
}
|
|
253
|
-
if (
|
|
254
|
-
|
|
255
|
-
|
|
279
|
+
if (md.links && Array.isArray(md.links)) {
|
|
280
|
+
md.links.forEach((link) => {
|
|
281
|
+
getOrCreateLink(link.rel, link.href);
|
|
282
|
+
});
|
|
256
283
|
}
|
|
257
|
-
}
|
|
258
|
-
if (md.metaTags && Array.isArray(md.metaTags)) {
|
|
259
|
-
md.metaTags.forEach((tag) => {
|
|
260
|
-
let selector = "";
|
|
261
|
-
if (tag.name) {
|
|
262
|
-
selector = `meta[name="${tag.name}"]`;
|
|
263
|
-
} else if (tag.property) {
|
|
264
|
-
selector = `meta[property="${tag.property}"]`;
|
|
265
|
-
} else if (tag.httpEquiv) {
|
|
266
|
-
selector = `meta[http-equiv="${tag.httpEquiv}"]`;
|
|
267
|
-
}
|
|
268
|
-
if (selector) {
|
|
269
|
-
const meta = getOrCreateMeta(selector, {
|
|
270
|
-
name: tag.name,
|
|
271
|
-
property: tag.property,
|
|
272
|
-
httpEquiv: tag.httpEquiv
|
|
273
|
-
});
|
|
274
|
-
meta.content = tag.content;
|
|
275
|
-
}
|
|
276
|
-
});
|
|
277
|
-
}
|
|
278
|
-
if (md.links && Array.isArray(md.links)) {
|
|
279
|
-
md.links.forEach((link) => {
|
|
280
|
-
getOrCreateLink(link.rel, link.href);
|
|
281
|
-
});
|
|
282
|
-
}
|
|
284
|
+
});
|
|
283
285
|
}
|
|
284
286
|
|
|
285
287
|
// modules/runtime/client/AppShell.tsx
|