PageSourceSearch

https://vanillaos.org/node_modules/.vite/deps/@vueuse_head.js?v=6d0dd766

js vanillaos.org collected 2026-09-25 20:30:09 UTC 12,797 bytes, 445 lines download raw bytes

1import {
2  SelfClosingTags,
3  TagsWithInnerContent,
4  composableNames,
5  createHead,
6  createHeadCore,
7  debouncedRenderDOMHead,
8  defineHeadPlugin,
9  getActiveHead,
10  renderDOMHead,
11  unpackMeta,
12  whitelistSafeInput
13} from "/node_modules/.vite/deps/chunk-TGOKYCKZ.js?v=6d0dd766";
14import {
15  defineComponent,
16  getCurrentInstance,
17  inject,
18  nextTick,
19  onActivated,
20  onBeforeUnmount,
21  onDeactivated,
22  ref,
23  unref,
24  version,
25  watch,
26  watchEffect
27} from "/node_modules/.vite/deps/chunk-HXAKAOMG.js?v=6d0dd766";
28import "/node_modules/.vite/deps/chunk-SNAQBZPT.js?v=6d0dd766";
29
vendor: 2,095 bytes, lines 30-93
30// node_modules/.pnpm/@[email protected][email protected][email protected]_/node_modules/@unhead/vue/dist/shared/vue.cf295fb1.mjs
31var Vue3 = version.startsWith("3");
32function resolveUnref(r) {
33  return typeof r === "function" ? r() : unref(r);
34}
35function resolveUnrefHeadInput(ref2, lastKey = "") {
36  if (ref2 instanceof Promise)
37    return ref2;
38  const root = resolveUnref(ref2);
39  if (!ref2 || !root)
40    return root;
41  if (Array.isArray(root))
42    return root.map((r) => resolveUnrefHeadInput(r, lastKey));
43  if (typeof root === "object") {
44    return Object.fromEntries(
45      Object.entries(root).map(([k, v]) => {
46        if (k === "titleTemplate" || k.startsWith("on"))
47          return [k, unref(v)];
48        return [k, resolveUnrefHeadInput(v, k)];
49      })
50    );
51  }
52  return root;
53}
54var VueReactivityPlugin = defineHeadPlugin({
55  hooks: {
56    "entries:resolve": function(ctx) {
57      for (const entry of ctx.entries)
58        entry.resolvedInput = resolveUnrefHeadInput(entry.input);
59    }
60  }
61});
62var headSymbol = "usehead";
63function vueInstall(head) {
64  const plugin = {
65    install(app) {
66      if (Vue3) {
67        app.config.globalProperties.$unhead = head;
68        app.config.globalProperties.$head = head;
69        app.provide(headSymbol, head);
70      }
71    }
72  };
73  return plugin.install;
74}
75function createHead2(options = {}) {
76  options.domDelayFn = options.domDelayFn || ((fn) => nextTick(() => setTimeout(() => fn(), 0)));
77  const head = createHead(options);
78  head.use(VueReactivityPlugin);
79  head.install = vueInstall(head);
80  return head;
81}
82var _global = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
83var globalKey = "__unhead_injection_handler__";
84function injectHead() {
85  if (globalKey in _global) {
86    return _global[globalKey]();
87  }
88  const head = inject(headSymbol);
89  if (!head && true)
90    console.warn("Unhead is missing Vue context, falling back to shared context. This may have unexpected results.");
91  return head || getActiveHead();
92}
93
vendor: 939 bytes, lines 94-127
94// node_modules/.pnpm/@[email protected][email protected][email protected]_/node_modules/@unhead/vue/dist/shared/vue.f36acd1f.mjs
95function useHead(input, options = {}) {
96  const head = options.head || injectHead();
97  if (head) {
98    if (!head.ssr)
99      return clientUseHead(head, input, options);
100    return head.push(input, options);
101  }
102}
103function clientUseHead(head, input, options = {}) {
104  const deactivated = ref(false);
105  const resolvedInput = ref({});
106  watchEffect(() => {
107    resolvedInput.value = deactivated.value ? {} : resolveUnrefHeadInput(input);
108  });
109  const entry = head.push(resolvedInput.value, options);
110  watch(resolvedInput, (e) => {
111    entry.patch(e);
112  });
113  const vm = getCurrentInstance();
114  if (vm) {
115    onBeforeUnmount(() => {
116      entry.dispose();
117    });
118    onDeactivated(() => {
119      deactivated.value = true;
120    });
121    onActivated(() => {
122      deactivated.value = false;
123    });
124  }
125  return entry;
126}
127
vendor: 2,291 bytes, lines 128-209
128// node_modules/.pnpm/@[email protected][email protected][email protected]_/node_modules/@unhead/vue/dist/index.mjs
129var VueHeadMixin = {
130  created() {
131    let source = false;
132    if (Vue3) {
133      const instance = getCurrentInstance();
134      if (!instance)
135        return;
136      const options = instance.type;
137      if (!options || !("head" in options))
138        return;
139      source = typeof options.head === "function" ? () => options.head.call(instance.proxy) : options.head;
140    } else {
141      const head = this.$options.head;
142      if (head) {
143        source = typeof head === "function" ? () => head.call(this) : head;
144      }
145    }
146    source && useHead(source);
147  }
148};
149var Vue2ProvideUnheadPlugin = function(_Vue, head) {
150  _Vue.mixin({
151    beforeCreate() {
152      const options = this.$options;
153      const origProvide = options.provide;
154      options.provide = function() {
155        let origProvideResult;
156        if (typeof origProvide === "function")
157          origProvideResult = origProvide.call(this);
158        else
159          origProvideResult = origProvide || {};
160        return {
161          ...origProvideResult,
162          [headSymbol]: head
163        };
164      };
165    }
166  });
167};
168var coreComposableNames = [
169  "injectHead"
170];
171var unheadVueComposablesImports = {
172  "@unhead/vue": [...coreComposableNames, ...composableNames]
173};
174function useHeadSafe(input, options = {}) {
175  return useHead(input, { ...options, transform: whitelistSafeInput });
176}
177function useSeoMeta(input, options) {
178  const { title, titleTemplate, ...meta } = input;
179  return useHead({
180    title,
181    titleTemplate,
182    // @ts-expect-error runtime type
183    _flatMeta: meta
184  }, {
185    ...options,
186    transform(t) {
187      const meta2 = unpackMeta({ ...t._flatMeta });
188      delete t._flatMeta;
189      return {
190        // @ts-expect-error runtime type
191        ...t,
192        meta: meta2
193      };
194    }
195  });
196}
197function useServerHead(input, options = {}) {
198  const head = options.head || injectHead();
199  delete options.head;
200  if (head)
201    return head.push(input, { ...options, mode: "server" });
202}
203function useServerHeadSafe(input, options = {}) {
204  return useHeadSafe(input, { ...options, mode: "server" });
205}
206function useServerSeoMeta(input, options) {
207  return useSeoMeta(input, { ...options || {}, mode: "server" });
208}
209
vendor: 2,652 bytes, lines 210-289
210// node_modules/.pnpm/@[email protected]/node_modules/@unhead/ssr/dist/index.mjs
211function encodeAttribute(value) {
212  return String(value).replace(/"/g, """);
213}
214function propsToString(props) {
215  const attrs = [];
216  for (const [key, value] of Object.entries(props)) {
217    if (value !== false && value !== null)
218      attrs.push(value === true ? key : `${key}="${encodeAttribute(value)}"`);
219  }
220  return `${attrs.length > 0 ? " " : ""}${attrs.join(" ")}`;
221}
222function escapeHtml(str) {
223  return str.replace(/[&<>"'/]/g, (char) => {
224    switch (char) {
225      case "&":
226        return "&amp;";
227      case "<":
228        return "&lt;";
229      case ">":
230        return "&gt;";
231      case '"':
232        return "&quot;";
233      case "'":
234        return "&#x27;";
235      case "/":
236        return "&#x2F;";
237      default:
238        return char;
239    }
240  });
241}
242function tagToString(tag) {
243  const attrs = propsToString(tag.props);
244  const openTag = `<${tag.tag}${attrs}>`;
245  if (!TagsWithInnerContent.includes(tag.tag))
246    return SelfClosingTags.includes(tag.tag) ? openTag : `${openTag}</${tag.tag}>`;
247  let content = String(tag.innerHTML || "");
248  if (tag.textContent)
249    content = escapeHtml(String(tag.textContent));
250  return SelfClosingTags.includes(tag.tag) ? openTag : `${openTag}${content}</${tag.tag}>`;
251}
252function ssrRenderTags(tags, options) {
253  const schema = { htmlAttrs: {}, bodyAttrs: {}, tags: { head: [], bodyClose: [], bodyOpen: [] } };
254  for (const tag of tags) {
255    if (tag.tag === "htmlAttrs" || tag.tag === "bodyAttrs") {
256      schema[tag.tag] = { ...schema[tag.tag], ...tag.props };
257      continue;
258    }
259    schema.tags[tag.tagPosition || "head"].push(tagToString(tag));
260  }
261  const lineBreaks = !(options == null ? void 0 : options.omitLineBreaks) ? "\n" : "";
262  return {
263    headTags: schema.tags.head.join(lineBreaks),
264    bodyTags: schema.tags.bodyClose.join(lineBreaks),
265    bodyTagsOpen: schema.tags.bodyOpen.join(lineBreaks),
266    htmlAttrs: propsToString(schema.htmlAttrs),
267    bodyAttrs: propsToString(schema.bodyAttrs)
268  };
269}
270async function renderSSRHead(head, options) {
271  const beforeRenderCtx = { shouldRender: true };
272  await head.hooks.callHook("ssr:beforeRender", beforeRenderCtx);
273  if (!beforeRenderCtx.shouldRender) {
274    return {
275      headTags: "",
276      bodyTags: "",
277      bodyTagsOpen: "",
278      htmlAttrs: "",
279      bodyAttrs: ""
280    };
281  }
282  const ctx = { tags: await head.resolveTags() };
283  await head.hooks.callHook("ssr:render", ctx);
284  const html = ssrRenderTags(ctx.tags, options);
285  const renderCtx = { tags: ctx.tags, html };
286  await head.hooks.callHook("ssr:rendered", renderCtx);
287  return renderCtx.html;
288}
289
vendor: 4,236 bytes, lines 290-445
290// node_modules/.pnpm/@[email protected][email protected][email protected]_/node_modules/@vueuse/head/dist/index.mjs
291function createHead3(initHeadObject, options) {
292  const unhead = createHead2(options || {});
293  const legacyHead = {
294    unhead,
295    install(app) {
296      if (version.startsWith("3")) {
297        app.config.globalProperties.$head = unhead;
298        app.provide("usehead", unhead);
299      }
300    },
301    use(plugin) {
302      unhead.use(plugin);
303    },
304    resolveTags() {
305      return unhead.resolveTags();
306    },
307    headEntries() {
308      return unhead.headEntries();
309    },
310    headTags() {
311      return unhead.resolveTags();
312    },
313    push(input, options2) {
314      return unhead.push(input, options2);
315    },
316    addEntry(input, options2) {
317      return unhead.push(input, options2);
318    },
319    addHeadObjs(input, options2) {
320      return unhead.push(input, options2);
321    },
322    addReactiveEntry(input, options2) {
323      const api = useHead(input, options2);
324      if (typeof api !== "undefined")
325        return api.dispose;
326      return () => {
327      };
328    },
329    removeHeadObjs() {
330    },
331    updateDOM(document, force) {
332      if (force)
333        renderDOMHead(unhead, { document });
334      else
335        debouncedRenderDOMHead(unhead, { delayFn: (fn) => setTimeout(() => fn(), 50), document });
336    },
337    internalHooks: unhead.hooks,
338    hooks: {
339      "before:dom": [],
340      "resolved:tags": [],
341      "resolved:entries": []
342    }
343  };
344  unhead.addHeadObjs = legacyHead.addHeadObjs;
345  unhead.updateDOM = legacyHead.updateDOM;
346  unhead.hooks.hook("dom:beforeRender", (ctx) => {
347    for (const hook of legacyHead.hooks["before:dom"]) {
348      if (hook() === false)
349        ctx.shouldRender = false;
350    }
351  });
352  if (initHeadObject)
353    legacyHead.addHeadObjs(initHeadObject);
354  return legacyHead;
355}
356var HeadVuePlugin = Vue2ProvideUnheadPlugin;
357var renderHeadToString = (head) => renderSSRHead(head.unhead);
358var Vue2 = version.startsWith("2.");
359var IsBrowser = typeof window !== "undefined";
360var addVNodeToHeadObj = (node, obj) => {
361  const nodeType = Vue2 ? node.tag : node.type;
362  const type = nodeType === "html" ? "htmlAttrs" : nodeType === "body" ? "bodyAttrs" : nodeType;
363  if (typeof type !== "string" || !(type in obj))
364    return;
365  const nodeData = Vue2 ? node.data : node;
366  const props = (Vue2 ? nodeData.attrs : node.props) || {};
367  if (Vue2) {
368    if (nodeData.staticClass)
369      props.class = nodeData.staticClass;
370    if (nodeData.staticStyle)
371      props.style = Object.entries(nodeData.staticStyle).map(([key, value]) => `${key}:${value}`).join(";");
372  }
373  if (node.children) {
374    const childrenAttr = Vue2 ? "text" : "children";
375    props.children = Array.isArray(node.children) ? node.children[0][childrenAttr] : node[childrenAttr];
376  }
377  if (Array.isArray(obj[type]))
378    obj[type].push(props);
379  else if (type === "title")
380    obj.title = props.children;
381  else
382    obj[type] = props;
383};
384var vnodesToHeadObj = (nodes) => {
385  const obj = {
386    title: void 0,
387    htmlAttrs: void 0,
388    bodyAttrs: void 0,
389    base: void 0,
390    meta: [],
391    link: [],
392    style: [],
393    script: [],
394    noscript: []
395  };
396  for (const node of nodes) {
397    if (typeof node.type === "symbol" && Array.isArray(node.children)) {
398      for (const childNode of node.children)
399        addVNodeToHeadObj(childNode, obj);
400    } else {
401      addVNodeToHeadObj(node, obj);
402    }
403  }
404  return obj;
405};
406var Head = defineComponent({
407  // eslint-disable-next-line vue/no-reserved-component-names
408  name: "Head",
409  setup(_, { slots }) {
410    const head = injectHead();
411    const obj = ref({});
412    const entry = head.push(obj);
413    if (IsBrowser) {
414      onBeforeUnmount(() => {
415        entry.dispose();
416      });
417    }
418    return () => {
419      watchEffect(() => {
420        if (!slots.default)
421          return;
422        entry.patch(vnodesToHeadObj(slots.default()));
423      });
424      return null;
425    };
426  }
427});
428export {
429  Head,
430  HeadVuePlugin,
431  Vue2ProvideUnheadPlugin,
432  VueHeadMixin,
433  createHead3 as createHead,
434  createHeadCore,
435  injectHead,
436  renderHeadToString,
437  unheadVueComposablesImports,
438  useHead,
439  useHeadSafe,
440  useSeoMeta,
441  useServerHead,
442  useServerHeadSafe,
443  useServerSeoMeta
444};
445//# sourceMappingURL=@vueuse_head.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.