@monkeyplus/flow 6.0.27 → 6.0.28

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monkeyplus/flow",
3
- "version": "6.0.27",
3
+ "version": "6.0.28",
4
4
  "description": "@monkeyplus/flow package-first runtime with Vite, Nitro, Vue and a workspace playground.",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -1,5 +1,6 @@
1
1
  export type { ContentDirectoryNode, ContentEntry, ContentFileNode, ContentTreeNode, } from '../../modules/content/query.ts';
2
2
  export type { FlowBootPayload } from '../runtime/boot.ts';
3
+ export { useContext, useGlobal, useLocale, usePage, useSeo, useSharedContext, useUtils, useView, } from '../runtime/composables.ts';
3
4
  export { defineFlowConfig, defineFlowModule, resolveFlowConfig } from '../runtime/config.ts';
4
5
  export type { FlowConfig, UserFlowConfig, } from '../runtime/config.ts';
5
6
  export { useSchemaOrg } from '../runtime/head.ts';
@@ -1,3 +1,13 @@
1
+ export {
2
+ useContext,
3
+ useGlobal,
4
+ useLocale,
5
+ usePage,
6
+ useSeo,
7
+ useSharedContext,
8
+ useUtils,
9
+ useView
10
+ } from "../runtime/composables.mjs";
1
11
  export { defineFlowConfig, defineFlowModule, resolveFlowConfig } from "../runtime/config.mjs";
2
12
  export { useSchemaOrg } from "../runtime/head.mjs";
3
13
  export { defineLayoutContext } from "../runtime/layout-context.mjs";
@@ -369,7 +369,20 @@ export function createFlowViteConfig(options = {}) {
369
369
  dts: resolve(projectRoot, ".flow/types/auto-imports.d.ts"),
370
370
  imports: [
371
371
  {
372
- "@monkeyplus/flow": ["definePage", "defineLayoutContext", "queryContent", "useSchemaOrg"],
372
+ "@monkeyplus/flow": [
373
+ "definePage",
374
+ "defineLayoutContext",
375
+ "queryContent",
376
+ "useSchemaOrg",
377
+ "useContext",
378
+ "useSeo",
379
+ "useUtils",
380
+ "useSharedContext",
381
+ "useGlobal",
382
+ "useLocale",
383
+ "usePage",
384
+ "useView"
385
+ ],
373
386
  ...mappedNitroImports
374
387
  },
375
388
  ...Array.isArray(schemaOrgImports) ? schemaOrgImports : [],
@@ -0,0 +1,9 @@
1
+ import type { FlowLocale, PageContextUtils, PageDefinition } from './pages.ts';
2
+ export declare function useContext<T = any>(): T;
3
+ export declare function useSeo<T = any>(): T;
4
+ export declare function useUtils(): PageContextUtils;
5
+ export declare function useSharedContext<T = any>(): T;
6
+ export declare function useGlobal<T = any>(): T;
7
+ export declare function useLocale(): FlowLocale;
8
+ export declare function usePage(): PageDefinition;
9
+ export declare function useView(): PageDefinition['view'];
@@ -0,0 +1,34 @@
1
+ import { inject } from "vue";
2
+ export function useContext() {
3
+ const ctx = inject("context", {});
4
+ return {
5
+ ...ctx.context?.layout || {},
6
+ ...ctx.context || {}
7
+ };
8
+ }
9
+ export function useSeo() {
10
+ const ctx = inject("context", {});
11
+ return ctx.seo || {};
12
+ }
13
+ export function useUtils() {
14
+ return inject("utils", {});
15
+ }
16
+ export function useSharedContext() {
17
+ return inject("sharedContext", {});
18
+ }
19
+ export function useGlobal() {
20
+ console.warn('deprecated change to "useSharedContext"');
21
+ return useSharedContext();
22
+ }
23
+ export function useLocale() {
24
+ const ctx = inject("context", {});
25
+ return { ...ctx.locale || {} };
26
+ }
27
+ export function usePage() {
28
+ const ctx = inject("context", {});
29
+ return { ...ctx.page || {} };
30
+ }
31
+ export function useView() {
32
+ const ctx = inject("context", {});
33
+ return { ...ctx.page?.view || {} };
34
+ }