@highstate/designer 0.4.2 → 0.4.4

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.
Files changed (119) hide show
  1. package/.output/nitro.json +15 -0
  2. package/.output/public/_nuxt/B-YqONwZ.js +1 -0
  3. package/.output/public/_nuxt/COXQCz2I.js +1 -0
  4. package/.output/public/_nuxt/DNF_Kfc9.js +1 -0
  5. package/.output/public/_nuxt/DYyPqv2f.js +164 -0
  6. package/.output/public/_nuxt/builds/latest.json +1 -0
  7. package/.output/public/_nuxt/builds/meta/c81be379-d98f-426f-8eac-c45f3b97a743.json +1 -0
  8. package/.output/public/_nuxt/entry.BSAdMt6G.css +5 -0
  9. package/.output/public/_nuxt/error-404.BJkSn6RI.css +1 -0
  10. package/.output/public/_nuxt/error-500.TOCKLquH.css +1 -0
  11. package/.output/public/favicon.ico +0 -0
  12. package/.output/public/robots.txt +1 -0
  13. package/.output/server/index.mjs +12266 -0
  14. package/.output/server/index.mjs.map +1 -0
  15. package/.output/server/node_modules/@babel/parser/lib/index.js +14183 -0
  16. package/.output/server/node_modules/@babel/parser/package.json +50 -0
  17. package/.output/server/node_modules/@trpc/server/dist/http.mjs +7 -0
  18. package/.output/server/node_modules/@trpc/server/dist/index.mjs +11 -0
  19. package/.output/server/node_modules/@trpc/server/dist/observable/observable.mjs +175 -0
  20. package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/createProxy.mjs +73 -0
  21. package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/error/TRPCError.mjs +78 -0
  22. package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/error/formatter.mjs +5 -0
  23. package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/error/getErrorShape.mjs +29 -0
  24. package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/http/contentType.mjs +224 -0
  25. package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/http/contentTypeParsers.mjs +12 -0
  26. package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/http/getHTTPStatusCode.mjs +76 -0
  27. package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/http/isAbortError.mjs +7 -0
  28. package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/http/parseConnectionParams.mjs +39 -0
  29. package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/http/resolveResponse.mjs +569 -0
  30. package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/initTRPC.mjs +80 -0
  31. package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/middleware.mjs +90 -0
  32. package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/parser.mjs +40 -0
  33. package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/procedureBuilder.mjs +194 -0
  34. package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/rootConfig.mjs +6 -0
  35. package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/router.mjs +176 -0
  36. package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/rpc/codes.mjs +54 -0
  37. package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/stream/jsonl.mjs +597 -0
  38. package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/stream/sse.mjs +359 -0
  39. package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/stream/tracked.mjs +25 -0
  40. package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/stream/utils/asyncIterable.mjs +167 -0
  41. package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/stream/utils/createDeferred.mjs +15 -0
  42. package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/stream/utils/disposable.mjs +41 -0
  43. package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/stream/utils/mergeAsyncIterables.mjs +239 -0
  44. package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/stream/utils/readableStreamFrom.mjs +23 -0
  45. package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/stream/utils/timerResource.mjs +23 -0
  46. package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/stream/utils/withPing.mjs +127 -0
  47. package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/transformer.mjs +101 -0
  48. package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/utils.mjs +83 -0
  49. package/.output/server/node_modules/@trpc/server/dist/vendor/unpromise/unpromise.mjs +289 -0
  50. package/.output/server/node_modules/@trpc/server/package.json +156 -0
  51. package/.output/server/node_modules/@unhead/dom/dist/index.mjs +197 -0
  52. package/.output/server/node_modules/@unhead/dom/package.json +40 -0
  53. package/.output/server/node_modules/@unhead/shared/dist/index.mjs +641 -0
  54. package/.output/server/node_modules/@unhead/shared/package.json +45 -0
  55. package/.output/server/node_modules/@unhead/ssr/dist/index.mjs +95 -0
  56. package/.output/server/node_modules/@unhead/ssr/package.json +40 -0
  57. package/.output/server/node_modules/@vue/compiler-core/dist/compiler-core.cjs.prod.js +6690 -0
  58. package/.output/server/node_modules/@vue/compiler-core/package.json +58 -0
  59. package/.output/server/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js +686 -0
  60. package/.output/server/node_modules/@vue/compiler-dom/package.json +57 -0
  61. package/.output/server/node_modules/@vue/compiler-ssr/dist/compiler-ssr.cjs.js +1404 -0
  62. package/.output/server/node_modules/@vue/compiler-ssr/package.json +34 -0
  63. package/.output/server/node_modules/@vue/reactivity/dist/reactivity.cjs.prod.js +1789 -0
  64. package/.output/server/node_modules/@vue/reactivity/package.json +55 -0
  65. package/.output/server/node_modules/@vue/runtime-core/dist/runtime-core.cjs.prod.js +6654 -0
  66. package/.output/server/node_modules/@vue/runtime-core/package.json +52 -0
  67. package/.output/server/node_modules/@vue/runtime-dom/dist/runtime-dom.cjs.prod.js +1669 -0
  68. package/.output/server/node_modules/@vue/runtime-dom/package.json +60 -0
  69. package/.output/server/node_modules/@vue/server-renderer/dist/server-renderer.cjs.prod.js +857 -0
  70. package/.output/server/node_modules/@vue/server-renderer/package.json +55 -0
  71. package/.output/server/node_modules/@vue/shared/dist/shared.cjs.prod.js +594 -0
  72. package/.output/server/node_modules/@vue/shared/package.json +47 -0
  73. package/.output/server/node_modules/devalue/index.js +3 -0
  74. package/.output/server/node_modules/devalue/package.json +34 -0
  75. package/.output/server/node_modules/devalue/src/base64.js +110 -0
  76. package/.output/server/node_modules/devalue/src/constants.js +6 -0
  77. package/.output/server/node_modules/devalue/src/parse.js +160 -0
  78. package/.output/server/node_modules/devalue/src/stringify.js +232 -0
  79. package/.output/server/node_modules/devalue/src/uneval.js +351 -0
  80. package/.output/server/node_modules/devalue/src/utils.js +113 -0
  81. package/.output/server/node_modules/entities/lib/decode.js +536 -0
  82. package/.output/server/node_modules/entities/lib/decode_codepoint.js +76 -0
  83. package/.output/server/node_modules/entities/lib/generated/decode-data-html.js +9 -0
  84. package/.output/server/node_modules/entities/lib/generated/decode-data-xml.js +9 -0
  85. package/.output/server/node_modules/entities/package.json +90 -0
  86. package/.output/server/node_modules/estree-walker/dist/umd/estree-walker.js +344 -0
  87. package/.output/server/node_modules/estree-walker/package.json +37 -0
  88. package/.output/server/node_modules/hookable/dist/index.mjs +290 -0
  89. package/.output/server/node_modules/hookable/package.json +49 -0
  90. package/.output/server/node_modules/packrup/dist/index.mjs +108 -0
  91. package/.output/server/node_modules/packrup/package.json +58 -0
  92. package/.output/server/node_modules/source-map-js/lib/array-set.js +121 -0
  93. package/.output/server/node_modules/source-map-js/lib/base64-vlq.js +140 -0
  94. package/.output/server/node_modules/source-map-js/lib/base64.js +67 -0
  95. package/.output/server/node_modules/source-map-js/lib/binary-search.js +111 -0
  96. package/.output/server/node_modules/source-map-js/lib/mapping-list.js +79 -0
  97. package/.output/server/node_modules/source-map-js/lib/quick-sort.js +132 -0
  98. package/.output/server/node_modules/source-map-js/lib/source-map-consumer.js +1188 -0
  99. package/.output/server/node_modules/source-map-js/lib/source-map-generator.js +444 -0
  100. package/.output/server/node_modules/source-map-js/lib/source-node.js +413 -0
  101. package/.output/server/node_modules/source-map-js/lib/util.js +594 -0
  102. package/.output/server/node_modules/source-map-js/package.json +71 -0
  103. package/.output/server/node_modules/source-map-js/source-map.js +8 -0
  104. package/.output/server/node_modules/ufo/dist/index.mjs +630 -0
  105. package/.output/server/node_modules/ufo/package.json +47 -0
  106. package/.output/server/node_modules/unhead/dist/index.mjs +748 -0
  107. package/.output/server/node_modules/unhead/package.json +46 -0
  108. package/.output/server/node_modules/vue/dist/vue.cjs.js +80 -0
  109. package/.output/server/node_modules/vue/dist/vue.cjs.prod.js +66 -0
  110. package/.output/server/node_modules/vue/index.js +7 -0
  111. package/.output/server/node_modules/vue/index.mjs +1 -0
  112. package/.output/server/node_modules/vue/package.json +112 -0
  113. package/.output/server/node_modules/vue/server-renderer/index.mjs +1 -0
  114. package/.output/server/node_modules/vue-bundle-renderer/dist/runtime.mjs +196 -0
  115. package/.output/server/node_modules/vue-bundle-renderer/package.json +50 -0
  116. package/.output/server/node_modules/zod/lib/index.mjs +4382 -0
  117. package/.output/server/node_modules/zod/package.json +122 -0
  118. package/.output/server/package.json +1 -0
  119. package/package.json +4 -4
@@ -0,0 +1,641 @@
1
+ import { unpackToString, unpackToArray, packArray } from 'packrup';
2
+
3
+ function asArray(value) {
4
+ return Array.isArray(value) ? value : [value];
5
+ }
6
+
7
+ const SelfClosingTags = /* @__PURE__ */ new Set(["meta", "link", "base"]);
8
+ const TagsWithInnerContent = /* @__PURE__ */ new Set(["title", "titleTemplate", "script", "style", "noscript"]);
9
+ const HasElementTags = /* @__PURE__ */ new Set([
10
+ "base",
11
+ "meta",
12
+ "link",
13
+ "style",
14
+ "script",
15
+ "noscript"
16
+ ]);
17
+ const ValidHeadTags = /* @__PURE__ */ new Set([
18
+ "title",
19
+ "titleTemplate",
20
+ "templateParams",
21
+ "base",
22
+ "htmlAttrs",
23
+ "bodyAttrs",
24
+ "meta",
25
+ "link",
26
+ "style",
27
+ "script",
28
+ "noscript"
29
+ ]);
30
+ const UniqueTags = /* @__PURE__ */ new Set(["base", "title", "titleTemplate", "bodyAttrs", "htmlAttrs", "templateParams"]);
31
+ const TagConfigKeys = /* @__PURE__ */ new Set(["tagPosition", "tagPriority", "tagDuplicateStrategy", "children", "innerHTML", "textContent", "processTemplateParams"]);
32
+ const IsBrowser = typeof window !== "undefined";
33
+ const composableNames = [
34
+ "getActiveHead",
35
+ "useHead",
36
+ "useSeoMeta",
37
+ "useHeadSafe",
38
+ "useServerHead",
39
+ "useServerSeoMeta",
40
+ "useServerHeadSafe"
41
+ ];
42
+
43
+ function defineHeadPlugin(plugin) {
44
+ return plugin;
45
+ }
46
+
47
+ function hashCode(s) {
48
+ let h = 9;
49
+ for (let i = 0; i < s.length; )
50
+ h = Math.imul(h ^ s.charCodeAt(i++), 9 ** 9);
51
+ return ((h ^ h >>> 9) + 65536).toString(16).substring(1, 8).toLowerCase();
52
+ }
53
+ function hashTag(tag) {
54
+ if (tag._h) {
55
+ return tag._h;
56
+ }
57
+ if (tag._d) {
58
+ return hashCode(tag._d);
59
+ }
60
+ let content = `${tag.tag}:${tag.textContent || tag.innerHTML || ""}:`;
61
+ for (const key in tag.props) {
62
+ content += `${key}:${String(tag.props[key])},`;
63
+ }
64
+ return hashCode(content);
65
+ }
66
+
67
+ const p = (p2) => ({ keyValue: p2, metaKey: "property" });
68
+ const k = (p2) => ({ keyValue: p2 });
69
+ const MetaPackingSchema = {
70
+ appleItunesApp: {
71
+ unpack: {
72
+ entrySeparator: ", ",
73
+ resolve({ key, value }) {
74
+ return `${fixKeyCase(key)}=${value}`;
75
+ }
76
+ }
77
+ },
78
+ articleExpirationTime: p("article:expiration_time"),
79
+ articleModifiedTime: p("article:modified_time"),
80
+ articlePublishedTime: p("article:published_time"),
81
+ bookReleaseDate: p("book:release_date"),
82
+ charset: {
83
+ metaKey: "charset"
84
+ },
85
+ contentSecurityPolicy: {
86
+ unpack: {
87
+ entrySeparator: "; ",
88
+ resolve({ key, value }) {
89
+ return `${fixKeyCase(key)} ${value}`;
90
+ }
91
+ },
92
+ metaKey: "http-equiv"
93
+ },
94
+ contentType: {
95
+ metaKey: "http-equiv"
96
+ },
97
+ defaultStyle: {
98
+ metaKey: "http-equiv"
99
+ },
100
+ fbAppId: p("fb:app_id"),
101
+ msapplicationConfig: k("msapplication-Config"),
102
+ msapplicationTileColor: k("msapplication-TileColor"),
103
+ msapplicationTileImage: k("msapplication-TileImage"),
104
+ ogAudioSecureUrl: p("og:audio:secure_url"),
105
+ ogAudioUrl: p("og:audio"),
106
+ ogImageSecureUrl: p("og:image:secure_url"),
107
+ ogImageUrl: p("og:image"),
108
+ ogSiteName: p("og:site_name"),
109
+ ogVideoSecureUrl: p("og:video:secure_url"),
110
+ ogVideoUrl: p("og:video"),
111
+ profileFirstName: p("profile:first_name"),
112
+ profileLastName: p("profile:last_name"),
113
+ profileUsername: p("profile:username"),
114
+ refresh: {
115
+ metaKey: "http-equiv",
116
+ unpack: {
117
+ entrySeparator: ";",
118
+ resolve({ key, value }) {
119
+ if (key === "seconds")
120
+ return `${value}`;
121
+ }
122
+ }
123
+ },
124
+ robots: {
125
+ unpack: {
126
+ entrySeparator: ", ",
127
+ resolve({ key, value }) {
128
+ if (typeof value === "boolean")
129
+ return `${fixKeyCase(key)}`;
130
+ else
131
+ return `${fixKeyCase(key)}:${value}`;
132
+ }
133
+ }
134
+ },
135
+ xUaCompatible: {
136
+ metaKey: "http-equiv"
137
+ }
138
+ };
139
+ const openGraphNamespaces = /* @__PURE__ */ new Set([
140
+ "og",
141
+ "book",
142
+ "article",
143
+ "profile"
144
+ ]);
145
+ function resolveMetaKeyType(key) {
146
+ const fKey = fixKeyCase(key);
147
+ const prefixIndex = fKey.indexOf(":");
148
+ if (openGraphNamespaces.has(fKey.substring(0, prefixIndex)))
149
+ return "property";
150
+ return MetaPackingSchema[key]?.metaKey || "name";
151
+ }
152
+ function resolveMetaKeyValue(key) {
153
+ return MetaPackingSchema[key]?.keyValue || fixKeyCase(key);
154
+ }
155
+ function fixKeyCase(key) {
156
+ const updated = key.replace(/([A-Z])/g, "-$1").toLowerCase();
157
+ const prefixIndex = updated.indexOf("-");
158
+ const fKey = updated.substring(0, prefixIndex);
159
+ if (fKey === "twitter" || openGraphNamespaces.has(fKey))
160
+ return key.replace(/([A-Z])/g, ":$1").toLowerCase();
161
+ return updated;
162
+ }
163
+ function changeKeyCasingDeep(input) {
164
+ if (Array.isArray(input)) {
165
+ return input.map((entry) => changeKeyCasingDeep(entry));
166
+ }
167
+ if (typeof input !== "object" || Array.isArray(input))
168
+ return input;
169
+ const output = {};
170
+ for (const key in input) {
171
+ if (!Object.prototype.hasOwnProperty.call(input, key)) {
172
+ continue;
173
+ }
174
+ output[fixKeyCase(key)] = changeKeyCasingDeep(input[key]);
175
+ }
176
+ return output;
177
+ }
178
+ function resolvePackedMetaObjectValue(value, key) {
179
+ const definition = MetaPackingSchema[key];
180
+ if (key === "refresh")
181
+ return `${value.seconds};url=${value.url}`;
182
+ return unpackToString(
183
+ changeKeyCasingDeep(value),
184
+ {
185
+ keyValueSeparator: "=",
186
+ entrySeparator: ", ",
187
+ resolve({ value: value2, key: key2 }) {
188
+ if (value2 === null)
189
+ return "";
190
+ if (typeof value2 === "boolean")
191
+ return `${key2}`;
192
+ },
193
+ ...definition?.unpack
194
+ }
195
+ );
196
+ }
197
+ const ObjectArrayEntries = /* @__PURE__ */ new Set(["og:image", "og:video", "og:audio", "twitter:image"]);
198
+ function sanitize(input) {
199
+ const out = {};
200
+ for (const k2 in input) {
201
+ if (!Object.prototype.hasOwnProperty.call(input, k2)) {
202
+ continue;
203
+ }
204
+ const v = input[k2];
205
+ if (String(v) !== "false" && k2)
206
+ out[k2] = v;
207
+ }
208
+ return out;
209
+ }
210
+ function handleObjectEntry(key, v) {
211
+ const value = sanitize(v);
212
+ const fKey = fixKeyCase(key);
213
+ const attr = resolveMetaKeyType(fKey);
214
+ if (ObjectArrayEntries.has(fKey)) {
215
+ const input = {};
216
+ for (const k2 in value) {
217
+ if (!Object.prototype.hasOwnProperty.call(value, k2)) {
218
+ continue;
219
+ }
220
+ input[`${key}${k2 === "url" ? "" : `${k2[0].toUpperCase()}${k2.slice(1)}`}`] = value[k2];
221
+ }
222
+ return unpackMeta(input).sort((a, b) => (a[attr]?.length || 0) - (b[attr]?.length || 0));
223
+ }
224
+ return [{ [attr]: fKey, ...value }];
225
+ }
226
+ function unpackMeta(input) {
227
+ const extras = [];
228
+ const primitives = {};
229
+ for (const key in input) {
230
+ if (!Object.prototype.hasOwnProperty.call(input, key)) {
231
+ continue;
232
+ }
233
+ const value = input[key];
234
+ if (!Array.isArray(value)) {
235
+ if (typeof value === "object" && value) {
236
+ if (ObjectArrayEntries.has(fixKeyCase(key))) {
237
+ extras.push(...handleObjectEntry(key, value));
238
+ continue;
239
+ }
240
+ primitives[key] = sanitize(value);
241
+ } else {
242
+ primitives[key] = value;
243
+ }
244
+ continue;
245
+ }
246
+ for (const v of value) {
247
+ extras.push(...typeof v === "string" ? unpackMeta({ [key]: v }) : handleObjectEntry(key, v));
248
+ }
249
+ }
250
+ const meta = unpackToArray(primitives, {
251
+ key({ key }) {
252
+ return resolveMetaKeyType(key);
253
+ },
254
+ value({ key }) {
255
+ return key === "charset" ? "charset" : "content";
256
+ },
257
+ resolveKeyData({ key }) {
258
+ return resolveMetaKeyValue(key);
259
+ },
260
+ resolveValueData({ value, key }) {
261
+ if (value === null)
262
+ return "_null";
263
+ if (typeof value === "object")
264
+ return resolvePackedMetaObjectValue(value, key);
265
+ return typeof value === "number" ? value.toString() : value;
266
+ }
267
+ });
268
+ return [...extras, ...meta].map((m) => {
269
+ if (m.content === "_null")
270
+ m.content = null;
271
+ return m;
272
+ });
273
+ }
274
+ function packMeta(inputs) {
275
+ const mappedPackingSchema = Object.entries(MetaPackingSchema).map(([key, value]) => [key, value.keyValue]);
276
+ return packArray(inputs, {
277
+ key: ["name", "property", "httpEquiv", "http-equiv", "charset"],
278
+ value: ["content", "charset"],
279
+ resolveKey(k2) {
280
+ let key = mappedPackingSchema.filter((sk) => sk[1] === k2)?.[0]?.[0] || k2;
281
+ const replacer = (_, letter) => letter?.toUpperCase();
282
+ key = key.replace(/:([a-z])/g, replacer).replace(/-([a-z])/g, replacer);
283
+ return key;
284
+ }
285
+ });
286
+ }
287
+
288
+ function thenable(val, thenFn) {
289
+ if (val instanceof Promise) {
290
+ return val.then(thenFn);
291
+ }
292
+ return thenFn(val);
293
+ }
294
+
295
+ function normaliseTag(tagName, input, e, normalizedProps) {
296
+ const props = normalizedProps || normaliseProps(
297
+ // explicitly check for an object
298
+ // @ts-expect-error untyped
299
+ typeof input === "object" && typeof input !== "function" && !(input instanceof Promise) ? { ...input } : { [tagName === "script" || tagName === "noscript" || tagName === "style" ? "innerHTML" : "textContent"]: input },
300
+ tagName === "templateParams" || tagName === "titleTemplate"
301
+ );
302
+ if (props instanceof Promise) {
303
+ return props.then((val) => normaliseTag(tagName, input, e, val));
304
+ }
305
+ const tag = {
306
+ tag: tagName,
307
+ props
308
+ };
309
+ for (const k of TagConfigKeys) {
310
+ const val = tag.props[k] !== void 0 ? tag.props[k] : e[k];
311
+ if (val !== void 0) {
312
+ if (!(k === "innerHTML" || k === "textContent" || k === "children") || TagsWithInnerContent.has(tag.tag)) {
313
+ tag[k === "children" ? "innerHTML" : k] = val;
314
+ }
315
+ delete tag.props[k];
316
+ }
317
+ }
318
+ if (tag.props.body) {
319
+ tag.tagPosition = "bodyClose";
320
+ delete tag.props.body;
321
+ }
322
+ if (tag.tag === "script") {
323
+ if (typeof tag.innerHTML === "object") {
324
+ tag.innerHTML = JSON.stringify(tag.innerHTML);
325
+ tag.props.type = tag.props.type || "application/json";
326
+ }
327
+ }
328
+ return Array.isArray(tag.props.content) ? tag.props.content.map((v) => ({ ...tag, props: { ...tag.props, content: v } })) : tag;
329
+ }
330
+ function normaliseStyleClassProps(key, v) {
331
+ const sep = key === "class" ? " " : ";";
332
+ if (v && typeof v === "object" && !Array.isArray(v)) {
333
+ v = Object.entries(v).filter(([, v2]) => v2).map(([k, v2]) => key === "style" ? `${k}:${v2}` : k);
334
+ }
335
+ return String(Array.isArray(v) ? v.join(sep) : v)?.split(sep).filter((c) => Boolean(c.trim())).join(sep);
336
+ }
337
+ function nestedNormaliseProps(props, virtual, keys, startIndex) {
338
+ for (let i = startIndex; i < keys.length; i += 1) {
339
+ const k = keys[i];
340
+ if (k === "class" || k === "style") {
341
+ props[k] = normaliseStyleClassProps(k, props[k]);
342
+ continue;
343
+ }
344
+ if (props[k] instanceof Promise) {
345
+ return props[k].then((val) => {
346
+ props[k] = val;
347
+ return nestedNormaliseProps(props, virtual, keys, i);
348
+ });
349
+ }
350
+ if (!virtual && !TagConfigKeys.has(k)) {
351
+ const v = String(props[k]);
352
+ const isDataKey = k.startsWith("data-");
353
+ if (v === "true" || v === "") {
354
+ props[k] = isDataKey ? "true" : true;
355
+ } else if (!props[k]) {
356
+ if (isDataKey && v === "false")
357
+ props[k] = "false";
358
+ else
359
+ delete props[k];
360
+ }
361
+ }
362
+ }
363
+ }
364
+ function normaliseProps(props, virtual = false) {
365
+ const resolvedProps = nestedNormaliseProps(props, virtual, Object.keys(props), 0);
366
+ if (resolvedProps instanceof Promise) {
367
+ return resolvedProps.then(() => props);
368
+ }
369
+ return props;
370
+ }
371
+ const TagEntityBits = 10;
372
+ function nestedNormaliseEntryTags(headTags, tagPromises, startIndex) {
373
+ for (let i = startIndex; i < tagPromises.length; i += 1) {
374
+ const tags = tagPromises[i];
375
+ if (tags instanceof Promise) {
376
+ return tags.then((val) => {
377
+ tagPromises[i] = val;
378
+ return nestedNormaliseEntryTags(headTags, tagPromises, i);
379
+ });
380
+ }
381
+ if (Array.isArray(tags)) {
382
+ headTags.push(...tags);
383
+ } else {
384
+ headTags.push(tags);
385
+ }
386
+ }
387
+ }
388
+ function normaliseEntryTags(e) {
389
+ const tagPromises = [];
390
+ const input = e.resolvedInput;
391
+ for (const k in input) {
392
+ if (!Object.prototype.hasOwnProperty.call(input, k)) {
393
+ continue;
394
+ }
395
+ const v = input[k];
396
+ if (v === void 0 || !ValidHeadTags.has(k)) {
397
+ continue;
398
+ }
399
+ if (Array.isArray(v)) {
400
+ for (const props of v) {
401
+ tagPromises.push(normaliseTag(k, props, e));
402
+ }
403
+ continue;
404
+ }
405
+ tagPromises.push(normaliseTag(k, v, e));
406
+ }
407
+ if (tagPromises.length === 0) {
408
+ return [];
409
+ }
410
+ const headTags = [];
411
+ return thenable(nestedNormaliseEntryTags(headTags, tagPromises, 0), () => headTags.map((t, i) => {
412
+ t._e = e._i;
413
+ e.mode && (t._m = e.mode);
414
+ t._p = (e._i << TagEntityBits) + i;
415
+ return t;
416
+ }));
417
+ }
418
+
419
+ const WhitelistAttributes = {
420
+ htmlAttrs: ["id", "class", "lang", "dir"],
421
+ bodyAttrs: ["id", "class"],
422
+ meta: ["id", "name", "property", "charset", "content"],
423
+ noscript: ["id", "textContent"],
424
+ script: ["id", "type", "textContent"],
425
+ link: ["id", "color", "crossorigin", "fetchpriority", "href", "hreflang", "imagesrcset", "imagesizes", "integrity", "media", "referrerpolicy", "rel", "sizes", "type"]
426
+ };
427
+ function acceptDataAttrs(value) {
428
+ const filtered = {};
429
+ Object.keys(value || {}).filter((a) => a.startsWith("data-")).forEach((a) => {
430
+ filtered[a] = value[a];
431
+ });
432
+ return filtered;
433
+ }
434
+ function whitelistSafeInput(input) {
435
+ const filtered = {};
436
+ Object.keys(input).forEach((key) => {
437
+ const tagValue = input[key];
438
+ if (!tagValue)
439
+ return;
440
+ switch (key) {
441
+ // always safe
442
+ case "title":
443
+ case "titleTemplate":
444
+ case "templateParams":
445
+ filtered[key] = tagValue;
446
+ break;
447
+ case "htmlAttrs":
448
+ case "bodyAttrs":
449
+ filtered[key] = acceptDataAttrs(tagValue);
450
+ WhitelistAttributes[key].forEach((a) => {
451
+ if (tagValue[a])
452
+ filtered[key][a] = tagValue[a];
453
+ });
454
+ break;
455
+ // meta is safe, except for http-equiv
456
+ case "meta":
457
+ if (Array.isArray(tagValue)) {
458
+ filtered[key] = tagValue.map((meta) => {
459
+ const safeMeta = acceptDataAttrs(meta);
460
+ WhitelistAttributes.meta.forEach((key2) => {
461
+ if (meta[key2])
462
+ safeMeta[key2] = meta[key2];
463
+ });
464
+ return safeMeta;
465
+ }).filter((meta) => Object.keys(meta).length > 0);
466
+ }
467
+ break;
468
+ // link tags we don't allow stylesheets, scripts, preloading, prerendering, prefetching, etc
469
+ case "link":
470
+ if (Array.isArray(tagValue)) {
471
+ filtered[key] = tagValue.map((meta) => {
472
+ const link = acceptDataAttrs(meta);
473
+ WhitelistAttributes.link.forEach((key2) => {
474
+ const val = meta[key2];
475
+ if (key2 === "rel" && (val === "stylesheet" || val === "canonical" || val === "modulepreload" || val === "prerender" || val === "preload" || val === "prefetch"))
476
+ return;
477
+ if (key2 === "href") {
478
+ if (val.includes("javascript:") || val.includes("data:"))
479
+ return;
480
+ link[key2] = val;
481
+ } else if (val) {
482
+ link[key2] = val;
483
+ }
484
+ });
485
+ return link;
486
+ }).filter((link) => Object.keys(link).length > 1 && !!link.rel);
487
+ }
488
+ break;
489
+ case "noscript":
490
+ if (Array.isArray(tagValue)) {
491
+ filtered[key] = tagValue.map((meta) => {
492
+ const noscript = acceptDataAttrs(meta);
493
+ WhitelistAttributes.noscript.forEach((key2) => {
494
+ if (meta[key2])
495
+ noscript[key2] = meta[key2];
496
+ });
497
+ return noscript;
498
+ }).filter((meta) => Object.keys(meta).length > 0);
499
+ }
500
+ break;
501
+ // we only allow JSON in scripts
502
+ case "script":
503
+ if (Array.isArray(tagValue)) {
504
+ filtered[key] = tagValue.map((script) => {
505
+ const safeScript = acceptDataAttrs(script);
506
+ WhitelistAttributes.script.forEach((s) => {
507
+ if (script[s]) {
508
+ if (s === "textContent") {
509
+ try {
510
+ const jsonVal = typeof script[s] === "string" ? JSON.parse(script[s]) : script[s];
511
+ safeScript[s] = JSON.stringify(jsonVal, null, 0);
512
+ } catch (e) {
513
+ }
514
+ } else {
515
+ safeScript[s] = script[s];
516
+ }
517
+ }
518
+ });
519
+ return safeScript;
520
+ }).filter((meta) => Object.keys(meta).length > 0);
521
+ }
522
+ break;
523
+ }
524
+ });
525
+ return filtered;
526
+ }
527
+
528
+ const NetworkEvents = /* @__PURE__ */ new Set(["onload", "onerror", "onabort", "onprogress", "onloadstart"]);
529
+ const ScriptNetworkEvents = /* @__PURE__ */ new Set(["onload", "onerror"]);
530
+
531
+ const TAG_WEIGHTS = {
532
+ // tags
533
+ base: -10,
534
+ title: 10
535
+ };
536
+ const TAG_ALIASES = {
537
+ // relative scores to their default values
538
+ critical: -80,
539
+ high: -10,
540
+ low: 20
541
+ };
542
+ function tagWeight(tag) {
543
+ const priority = tag.tagPriority;
544
+ if (typeof priority === "number")
545
+ return priority;
546
+ let weight = 100;
547
+ if (tag.tag === "meta") {
548
+ if (tag.props["http-equiv"] === "content-security-policy")
549
+ weight = -30;
550
+ else if (tag.props.charset)
551
+ weight = -20;
552
+ else if (tag.props.name === "viewport")
553
+ weight = -15;
554
+ } else if (tag.tag === "link" && tag.props.rel === "preconnect") {
555
+ weight = 20;
556
+ } else if (tag.tag in TAG_WEIGHTS) {
557
+ weight = TAG_WEIGHTS[tag.tag];
558
+ }
559
+ if (priority && priority in TAG_ALIASES) {
560
+ return weight + TAG_ALIASES[priority];
561
+ }
562
+ return weight;
563
+ }
564
+ const SortModifiers = [{ prefix: "before:", offset: -1 }, { prefix: "after:", offset: 1 }];
565
+
566
+ const allowedMetaProperties = ["name", "property", "http-equiv"];
567
+ function tagDedupeKey(tag) {
568
+ const { props, tag: tagName } = tag;
569
+ if (UniqueTags.has(tagName))
570
+ return tagName;
571
+ if (tagName === "link" && props.rel === "canonical")
572
+ return "canonical";
573
+ if (props.charset)
574
+ return "charset";
575
+ if (props.id) {
576
+ return `${tagName}:id:${props.id}`;
577
+ }
578
+ for (const n of allowedMetaProperties) {
579
+ if (props[n] !== void 0) {
580
+ return `${tagName}:${n}:${props[n]}`;
581
+ }
582
+ }
583
+ return false;
584
+ }
585
+
586
+ const sepSub = "%separator";
587
+ function sub(p, token, isJson = false) {
588
+ let val;
589
+ if (token === "s" || token === "pageTitle") {
590
+ val = p.pageTitle;
591
+ } else if (token.includes(".")) {
592
+ const dotIndex = token.indexOf(".");
593
+ val = p[token.substring(0, dotIndex)]?.[token.substring(dotIndex + 1)];
594
+ } else {
595
+ val = p[token];
596
+ }
597
+ if (val !== void 0) {
598
+ return isJson ? (val || "").replace(/"/g, '\\"') : val || "";
599
+ }
600
+ return void 0;
601
+ }
602
+ const sepSubRe = new RegExp(`${sepSub}(?:\\s*${sepSub})*`, "g");
603
+ function processTemplateParams(s, p, sep, isJson = false) {
604
+ if (typeof s !== "string" || !s.includes("%"))
605
+ return s;
606
+ let decoded = s;
607
+ try {
608
+ decoded = decodeURI(s);
609
+ } catch {
610
+ }
611
+ const tokens = decoded.match(/%\w+(?:\.\w+)?/g);
612
+ if (!tokens) {
613
+ return s;
614
+ }
615
+ const hasSepSub = s.includes(sepSub);
616
+ s = s.replace(/%\w+(?:\.\w+)?/g, (token) => {
617
+ if (token === sepSub || !tokens.includes(token)) {
618
+ return token;
619
+ }
620
+ const re = sub(p, token.slice(1), isJson);
621
+ return re !== void 0 ? re : token;
622
+ }).trim();
623
+ if (hasSepSub) {
624
+ if (s.endsWith(sepSub))
625
+ s = s.slice(0, -sepSub.length);
626
+ if (s.startsWith(sepSub))
627
+ s = s.slice(sepSub.length);
628
+ s = s.replace(sepSubRe, sep).trim();
629
+ }
630
+ return s;
631
+ }
632
+
633
+ function resolveTitleTemplate(template, title) {
634
+ if (template == null)
635
+ return title || null;
636
+ if (typeof template === "function")
637
+ return template(title);
638
+ return template;
639
+ }
640
+
641
+ export { HasElementTags, IsBrowser, NetworkEvents, ScriptNetworkEvents, SelfClosingTags, SortModifiers, TAG_ALIASES, TAG_WEIGHTS, TagConfigKeys, TagEntityBits, TagsWithInnerContent, UniqueTags, ValidHeadTags, asArray, composableNames, defineHeadPlugin, hashCode, hashTag, normaliseEntryTags, normaliseProps, normaliseStyleClassProps, normaliseTag, packMeta, processTemplateParams, resolveMetaKeyType, resolveMetaKeyValue, resolvePackedMetaObjectValue, resolveTitleTemplate, tagDedupeKey, tagWeight, thenable, unpackMeta, whitelistSafeInput };
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@unhead/shared",
3
+ "type": "module",
4
+ "version": "1.11.18",
5
+ "author": "Harlan Wilton <harlan@harlanzw.com>",
6
+ "license": "MIT",
7
+ "funding": "https://github.com/sponsors/harlan-zw",
8
+ "homepage": "https://unhead.unjs.io",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/unjs/unhead.git",
12
+ "directory": "packages/schema"
13
+ },
14
+ "bugs": {
15
+ "url": "https://github.com/unjs/unhead/issues"
16
+ },
17
+ "keywords": [
18
+ "head",
19
+ "meta tags",
20
+ "types"
21
+ ],
22
+ "sideEffects": false,
23
+ "exports": {
24
+ ".": {
25
+ "types": "./dist/index.d.ts",
26
+ "import": "./dist/index.mjs",
27
+ "require": "./dist/index.cjs"
28
+ }
29
+ },
30
+ "main": "dist/index.cjs",
31
+ "module": "dist/index.mjs",
32
+ "types": "dist/index.d.ts",
33
+ "files": [
34
+ "dist"
35
+ ],
36
+ "dependencies": {
37
+ "packrup": "^0.1.2",
38
+ "@unhead/schema": "1.11.18"
39
+ },
40
+ "scripts": {
41
+ "build": "unbuild .",
42
+ "stub": "unbuild . --stub",
43
+ "export:sizes": "npx export-size . -r"
44
+ }
45
+ }