@griddo/core 12.12.1 → 12.13.0-rc.0
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/dist/autotypes.mjs +2 -1
- package/dist/autotypes.mjs.map +1 -1
- package/dist/bin-tools/autotypes/index.d.ts +1 -0
- package/dist/bin-tools/autotypes/misc/utils.d.ts +6 -3
- package/dist/bin-tools/autotypes/parser/index.d.ts +1 -1
- package/dist/bin-tools/sync-schemas/index.d.ts +2 -0
- package/dist/bin-tools/sync-schemas/utils.d.ts +76 -0
- package/dist/components/CloudinaryImage/index.d.ts +1 -2
- package/dist/components/GriddoImage/index.d.ts +0 -1
- package/dist/components/GriddoImageExp/utils.d.ts +1 -1
- package/dist/components/GriddoLink/index.d.ts +1 -1
- package/dist/components/Page/index.d.ts +1 -1
- package/dist/contexts/Form/index.d.ts +1 -1
- package/dist/contexts/Navigation/index.d.ts +1 -1
- package/dist/contexts/Site/index.d.ts +1 -1
- package/dist/functions/index.d.ts +2 -2
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/useAiAnswers.d.ts +2 -2
- package/dist/hooks/useAiSearch.d.ts +2 -2
- package/dist/hooks/useReceiveInterests.d.ts +1 -1
- package/dist/index.d.ts +7 -7
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/sync-schemas.mjs +3 -0
- package/dist/sync-schemas.mjs.map +1 -0
- package/dist/types/api-response-fields/index.d.ts +1 -1
- package/dist/types/core/index.d.ts +1 -1
- package/dist/types/global.d.ts +1 -1
- package/dist/types/schema-fields/page-content-type-fields.d.ts +1 -1
- package/dist/types/schema-fields/props.d.ts +1 -1
- package/dist/types/schemas/ContentType.d.ts +1 -1
- package/dist/types/schemas/HeaderFooter.d.ts +1 -1
- package/dist/types/schemas/Menu.d.ts +1 -1
- package/dist/types/schemas/PageContentType.d.ts +2 -2
- package/dist/types/schemas/SimpleContentType.d.ts +2 -2
- package/dist/types/schemas/UI.d.ts +3 -3
- package/dist/types/schemas/base.d.ts +1 -1
- package/dist/types/schemas/props.d.ts +1 -1
- package/dist/types/theme/index.d.ts +1 -1
- package/dist/types/utilities.d.ts +1 -1
- package/dist/utils/index.d.ts +7 -1
- package/dist/vendor/react-aspect-ratio/index.d.ts +15 -0
- package/package.json +41 -78
- package/dist/autotypes.js +0 -2
- package/dist/autotypes.js.map +0 -1
- package/dist/components/GriddoImageExp/GriddoImageExp.stories.d.ts +0 -25
- package/dist/components/GriddoImageExp/GriddoImageExp.test.d.ts +0 -1
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { FieldReturnTypes, Fields, KindSchema, SchemaFieldTypes, SchemaTypeWithComponentProp } from "./types";
|
|
2
1
|
import type { Core, Schema } from "../../..";
|
|
3
2
|
import type { PageContentTypeFields } from "../../../types/schema-fields/page-content-type-fields";
|
|
4
3
|
import type { SimpleContentTypeFields } from "../../../types/schema-fields/simple-content-type-fields";
|
|
@@ -7,6 +6,7 @@ import type { UIFormFields } from "../../../types/schema-fields/ui-form-fields";
|
|
|
7
6
|
import type { UIFormTemplateFields } from "../../../types/schema-fields/ui-form-template-fields";
|
|
8
7
|
import type { UITemplateFields } from "../../../types/schema-fields/ui-template-fields";
|
|
9
8
|
import type { Module } from "../../../types/schemas";
|
|
9
|
+
import type { FieldReturnTypes, Fields, KindSchema, SchemaFieldTypes, SchemaTypeWithComponentProp } from "./types";
|
|
10
10
|
/**
|
|
11
11
|
* Return a string separated by the pipe char "|" using the `value` from object array.
|
|
12
12
|
*/
|
|
@@ -48,9 +48,12 @@ type GetInterfacePropTypeOptions = {
|
|
|
48
48
|
declare function getGriddoFieldPropType(field: Fields, options?: GetInterfacePropTypeOptions): string;
|
|
49
49
|
declare function prettify(input: string): Promise<string>;
|
|
50
50
|
/**
|
|
51
|
-
* Returns the instance
|
|
51
|
+
* Returns the instance path: the closest directory, from the cwd upwards, that
|
|
52
|
+
* has a `griddo.config.ts`.
|
|
52
53
|
*
|
|
53
|
-
*
|
|
54
|
+
* It starts from where the command runs, not from where @griddo/core is
|
|
55
|
+
* installed, so it does not depend on the package manager's layout (hoisted,
|
|
56
|
+
* pnpm's `.pnpm`, PnP, a client monorepo...).
|
|
54
57
|
*/
|
|
55
58
|
declare function resolveInstancePath(): string;
|
|
56
59
|
declare function extractMergedSchemas(structuredData: any): {
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { Core } from "../..";
|
|
2
|
+
/**
|
|
3
|
+
* Returns the instance root, the closest directory from `cwd` upwards that has
|
|
4
|
+
* a `griddo.config.js|ts`, and that file.
|
|
5
|
+
*
|
|
6
|
+
* Like `griddo-autotypes`, it starts from where the command runs, not from
|
|
7
|
+
* where @griddo/core is installed, so it does not depend on the package
|
|
8
|
+
* manager's layout.
|
|
9
|
+
*/
|
|
10
|
+
declare function findInstance(cwd: string): {
|
|
11
|
+
root: string;
|
|
12
|
+
configFile: string;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Loads the closest `.env` from `cwd` upwards. The variables that are already
|
|
16
|
+
* set win over the file.
|
|
17
|
+
*/
|
|
18
|
+
declare function loadDotEnv(cwd: string): void;
|
|
19
|
+
/**
|
|
20
|
+
* Returns the API URL from `GRIDDO_API_URL`. Its old names, `API_URL` and
|
|
21
|
+
* `REACT_APP_API_ENDPOINT`, still work, with a deprecation warning.
|
|
22
|
+
*/
|
|
23
|
+
declare function getApiUrl(env: NodeJS.ProcessEnv): string;
|
|
24
|
+
/**
|
|
25
|
+
* Bundles the instance config with esbuild and runs it. As webpack did in the
|
|
26
|
+
* old sync of @griddo/ax, the `paths` of the instance tsconfig/jsconfig are
|
|
27
|
+
* resolved and the images imported by the schemas are left empty.
|
|
28
|
+
*
|
|
29
|
+
* Not loaded with tsx, as autotypes does: tsx adds `__name()` calls inside the
|
|
30
|
+
* functions, and the `computed` functions are sent as text that AX evaluates
|
|
31
|
+
* on its own, where `__name` does not exist.
|
|
32
|
+
*/
|
|
33
|
+
declare function loadGriddoConfig(configFile: string): Promise<Core.Config>;
|
|
34
|
+
/**
|
|
35
|
+
* The body of `PUT /schemas`: the instance version and its schemas.
|
|
36
|
+
*
|
|
37
|
+
* @mutates the `computed` functions of the structured data become text, or
|
|
38
|
+
* they would be lost in the JSON.
|
|
39
|
+
*/
|
|
40
|
+
declare function buildPayload(config: Core.Config, version: string): {
|
|
41
|
+
config: {
|
|
42
|
+
languages: import("../../types/schemas").Languages;
|
|
43
|
+
menus: import("../../types/schemas").Menu;
|
|
44
|
+
menuItems: import("../../types/schemas").MenuItem;
|
|
45
|
+
richTextConfig?: import("../../types/schemas").RichTextConfig;
|
|
46
|
+
moduleCategories?: import("../../types/schemas").ModuleCategories;
|
|
47
|
+
themes: import("../../types/schemas").Themes;
|
|
48
|
+
subthemes?: Array<string>;
|
|
49
|
+
socials?: import("../../types/schemas").Socials;
|
|
50
|
+
llms?: Core.LlmsConfig;
|
|
51
|
+
};
|
|
52
|
+
ui: {
|
|
53
|
+
components: Record<string, import("../../types/schemas").Component>;
|
|
54
|
+
modules: Record<string, import("../../types/schemas").Module>;
|
|
55
|
+
templates: Record<string, import("../../types/schemas").Template>;
|
|
56
|
+
};
|
|
57
|
+
contentTypes: {
|
|
58
|
+
dataPacks: Record<string, import("../../types/schemas").DataPack>;
|
|
59
|
+
dataPacksCategories: Record<string, import("../../types/schemas").DataPackCategory>;
|
|
60
|
+
structuredData: Record<string, import("../../types/schemas").CategoryContentType | import("../../types/schemas").PageContentType | import("../../types/schemas").SimpleContentType>;
|
|
61
|
+
};
|
|
62
|
+
forms: {
|
|
63
|
+
templates: Record<string, import("../../types/schemas").FormTemplate>;
|
|
64
|
+
fields: Record<string, import("../../types/schemas").FormField>;
|
|
65
|
+
categories?: import("../../types/schemas").FormCategories;
|
|
66
|
+
templateCategories?: import("../../types/schemas").FormTemplateCategories;
|
|
67
|
+
} | {
|
|
68
|
+
templates: {};
|
|
69
|
+
fields: {};
|
|
70
|
+
categories: never[];
|
|
71
|
+
};
|
|
72
|
+
version: string;
|
|
73
|
+
};
|
|
74
|
+
/** Sends the schemas to the API. Throws with the API message if it rejects them. */
|
|
75
|
+
declare function putSchemas(apiUrl: string, developerKey: string | undefined, payload: object): Promise<void>;
|
|
76
|
+
export { buildPayload, findInstance, getApiUrl, loadDotEnv, loadGriddoConfig, putSchemas, };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
+
import type { CSSProperties } from "react";
|
|
1
2
|
import type { CloudinaryImageCrop, CloudinaryImageFormat, CloudinaryResponsiveImageProps } from "../../hooks/useImage";
|
|
2
3
|
import type { ImageDecoding, ImageLoading } from "../../types/core";
|
|
3
|
-
import type { CSSProperties } from "react";
|
|
4
4
|
import * as React from "react";
|
|
5
|
-
import "react-aspect-ratio/aspect-ratio.css";
|
|
6
5
|
export declare const internalDefaults: {
|
|
7
6
|
domain: string;
|
|
8
7
|
uploadFolder: string;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { FetchPriority, ImageCropType, ImageDecoding, ImageLoading, ImagePosition, ImageTransform, ResponsiveImageProps } from "../../types/core";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import "react-aspect-ratio/aspect-ratio.css";
|
|
4
3
|
import "./styles.css";
|
|
5
4
|
/**
|
|
6
5
|
* Renders an image from the **Griddo** cdn.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Source } from "./types";
|
|
2
1
|
import type { Core, Fields } from "../..";
|
|
3
2
|
import type { GriddoDamDefaults, ImageCropType, ImageDecoding, ImageFormats, ImageLoading, ImagePosition, ImageTransform } from "../../types/core";
|
|
3
|
+
import type { Source } from "./types";
|
|
4
4
|
interface GetGriddoArtDirectionImage {
|
|
5
5
|
sources: Array<Source>;
|
|
6
6
|
width?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Url } from "../../types/api-response-fields";
|
|
2
1
|
import type { ComponentPropsWithoutRef, CSSProperties, MouseEvent, ReactNode, Ref } from "react";
|
|
2
|
+
import type { Url } from "../../types/api-response-fields";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
/**
|
|
5
5
|
* Renders a router component from internal/external Griddo link.
|
|
@@ -7,4 +7,4 @@ interface NavigationProviderProps {
|
|
|
7
7
|
}
|
|
8
8
|
declare const NavigationContext: React.Context<NavigationContextProps | null>;
|
|
9
9
|
declare function NavigationProvider(props: NavigationProviderProps): React.JSX.Element;
|
|
10
|
-
export { NavigationContext,
|
|
10
|
+
export { NavigationContext, type NavigationContextProps, NavigationProvider };
|
|
@@ -26,4 +26,4 @@ interface SiteContextProps extends Site {
|
|
|
26
26
|
interface SiteProviderProps extends Site {
|
|
27
27
|
children: JSX.Element;
|
|
28
28
|
}
|
|
29
|
-
export { SiteContext,
|
|
29
|
+
export { SiteContext, type SiteContextProps, SiteProvider, type SiteProviderProps, };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type GriddoAlertRegisterProps, griddoAlertRegister } from "./alerts";
|
|
2
2
|
import { formatLocaleDate } from "./localeDate";
|
|
3
|
-
export { formatLocaleDate,
|
|
3
|
+
export { formatLocaleDate, type GriddoAlertRegisterProps, griddoAlertRegister };
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -31,4 +31,4 @@ import { useSendInterests } from "./useSendInterests";
|
|
|
31
31
|
import { useSession } from "./useSession";
|
|
32
32
|
import { useSite } from "./useSite";
|
|
33
33
|
import { useSSR } from "./useSSR";
|
|
34
|
-
export {
|
|
34
|
+
export { useAIReferenceField, useAiAnswers, useAiSearch, useContentType, useContentTypeNavigation, useDataFilters, useFetch, useForm, useGlobalTheme, useGriddoImage, useGriddoImageExp, useI18n, useImage, useIsClient, useIsFirstRender, useLink, useList, useListWithDefaultStaticPage, useLocaleDate, useNavigation, usePage, usePageRelatedContent, useReceiveInterests, useReferenceFieldData as useDistributorData, useReferenceFieldData, useScript, useSendInterests, useSession, useSite, useSSR, useTheme, useThemeColors, useThemeFont, useThemePrimitives, };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { PickRename } from "../types/global";
|
|
2
1
|
import type __AT__ from "@/autotypes";
|
|
2
|
+
import type { PickRename } from "../types/global";
|
|
3
3
|
import { type UseFetchStateProps } from "./useFetch";
|
|
4
4
|
interface AiAnswersResponse {
|
|
5
5
|
status: "ok" | "noResponse";
|
|
@@ -22,4 +22,4 @@ type UseAiAnswersReturn = [
|
|
|
22
22
|
];
|
|
23
23
|
type UseAiAnswersState = PickRename<UseFetchStateProps<AiAnswersResponse>, "data", "query">;
|
|
24
24
|
export declare function useAiAnswers(): UseAiAnswersReturn;
|
|
25
|
-
export { UseAiAnswersReturn, UseAiAnswersSetBodyAction, UseAiAnswersSetQuery, UseAiAnswersState,
|
|
25
|
+
export type { AiAnswersResponse, UseAiAnswersReturn, UseAiAnswersSetBodyAction, UseAiAnswersSetQuery, UseAiAnswersState, };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { PickRename } from "../types/global";
|
|
2
1
|
import type __AT__ from "@/autotypes";
|
|
2
|
+
import type { PickRename } from "../types/global";
|
|
3
3
|
import { type UseFetchStateProps } from "./useFetch";
|
|
4
4
|
interface AiSearchResponse {
|
|
5
5
|
page: number;
|
|
@@ -34,4 +34,4 @@ type UseAiSearchReturn = [
|
|
|
34
34
|
];
|
|
35
35
|
type UseAiSearchState = PickRename<UseFetchStateProps<AiSearchResponse>, "data", "query">;
|
|
36
36
|
export declare function useAiSearch(): UseAiSearchReturn;
|
|
37
|
-
export { UseAiSearchReturn, UseAiSearchSetBodyAction, UseAiSearchSetQuery, UseAiSearchState,
|
|
37
|
+
export type { AiSearchResponse, UseAiSearchReturn, UseAiSearchSetBodyAction, UseAiSearchSetQuery, UseAiSearchState, };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,26 +2,24 @@ import { CloudinaryBackgroundImage, CloudinaryImage, Component, GriddoBackground
|
|
|
2
2
|
import { CloudinaryImageProps } from "./components/CloudinaryImage";
|
|
3
3
|
import { ComponentProps, getComponent } from "./components/Component";
|
|
4
4
|
import { GriddoImageCommonProps, GriddoImageGif, GriddoImageJpgWebpAvif, GriddoImageProps, GriddoImageSvg } from "./components/GriddoImage";
|
|
5
|
+
import { GriddoImageCommonPropsExperimental, GriddoImageGifExperimental, GriddoImageJpgWebpAvifExperimental, GriddoImagePropsExperimental, GriddoImageSvgExperimental } from "./components/GriddoImageExp/types";
|
|
5
6
|
import { GriddoLinkProps, HLocation, LinkGetProps, WindowLocation } from "./components/GriddoLink";
|
|
6
7
|
import { ModulePreviewProps } from "./components/ModulePreview";
|
|
7
8
|
import { PageProps } from "./components/Page";
|
|
8
9
|
import { PreviewProps } from "./components/Preview";
|
|
9
10
|
import { PageContext, PageProvider, SessionContext, SessionProvider, SiteContext, SiteProvider } from "./contexts";
|
|
10
11
|
import { SiteProviderProps } from "./contexts/Site";
|
|
11
|
-
import {
|
|
12
|
+
import { formatLocaleDate, GriddoAlertRegisterProps, griddoAlertRegister } from "./functions";
|
|
13
|
+
import { useAIReferenceField, useAiAnswers, useAiSearch, useContentType, useContentTypeNavigation, useDataFilters, useGlobalTheme, useGriddoImage, useGriddoImageExp, useI18n, useImage, useIsClient, useIsFirstRender, useLink, useList, useListWithDefaultStaticPage, useLocaleDate, useNavigation, usePage, usePageRelatedContent, useReceiveInterests, useReferenceFieldData, useScript, useSendInterests, useSession, useSite, useSSR, useTheme, useThemeColors, useThemeFont, useThemePrimitives } from "./hooks";
|
|
12
14
|
import { UseDataFilterSetUrlAction, UseDataFiltersReturn, UseDataFiltersSetQueryProps, UseDataFiltersState } from "./hooks/useDataFilters";
|
|
13
15
|
import { GenerateImageChunkProps, ImageChunk, ImageConfig, UseGriddoImageProps, UseGriddoImageReturn } from "./hooks/useGriddoImage";
|
|
14
16
|
import { GenerateImageChunkPropsExperimental, ImageChunkExperimental, ImageConfigExperimental, UseGriddoImagePropsExperimental, UseGriddoImageReturnExperimental } from "./hooks/useGriddoImageExp";
|
|
15
|
-
import { getLangFromLocalStorage, getSiteID, getToken } from "./utils";
|
|
16
17
|
import { UseI18nProps } from "./hooks/useI18n";
|
|
17
18
|
import { CloudinaryImageCrop, CloudinaryImageFormat, CloudinaryResponsiveImageProps, UseImageProps } from "./hooks/useImage";
|
|
18
19
|
import { UseListSetQueryProps, UseListSetUrlAction } from "./hooks/useList";
|
|
19
|
-
import { FiltersDataApiQueryResponseProps, HTMLHeadingTag, Hideable, ListApiQueryResponseProps, PickRename, Pretty, SetQueryProps } from "./types/global";
|
|
20
|
-
import { NonEmptyArray } from "./types/utilities";
|
|
21
|
-
import { GriddoImageCommonPropsExperimental, GriddoImageGifExperimental, GriddoImageJpgWebpAvifExperimental, GriddoImagePropsExperimental, GriddoImageSvgExperimental } from "./components/GriddoImageExp/types";
|
|
22
|
-
import { GriddoAlertRegisterProps, formatLocaleDate, griddoAlertRegister } from "./functions";
|
|
23
20
|
import * as Fields from "./types/api-response-fields";
|
|
24
21
|
import * as Core from "./types/core";
|
|
22
|
+
import { FiltersDataApiQueryResponseProps, Hideable, HTMLHeadingTag, ListApiQueryResponseProps, PickRename, Pretty, SetQueryProps } from "./types/global";
|
|
25
23
|
import * as PageContentTypeFields from "./types/schema-fields/page-content-type-fields";
|
|
26
24
|
import * as SimpleContentTypeFields from "./types/schema-fields/simple-content-type-fields";
|
|
27
25
|
import * as UIFields from "./types/schema-fields/ui-fields";
|
|
@@ -29,4 +27,6 @@ import * as UIFormFields from "./types/schema-fields/ui-form-fields";
|
|
|
29
27
|
import * as UITemplateFields from "./types/schema-fields/ui-template-fields";
|
|
30
28
|
import * as Schema from "./types/schemas";
|
|
31
29
|
import * as Theme from "./types/theme";
|
|
32
|
-
|
|
30
|
+
import { NonEmptyArray } from "./types/utilities";
|
|
31
|
+
import { getLangFromLocalStorage, getSiteID, getToken } from "./utils";
|
|
32
|
+
export { CloudinaryBackgroundImage, CloudinaryImage, CloudinaryImageCrop, CloudinaryImageFormat, CloudinaryImageProps, CloudinaryResponsiveImageProps, Component, ComponentProps, Core, Fields, FiltersDataApiQueryResponseProps, formatLocaleDate, GenerateImageChunkProps, GenerateImageChunkPropsExperimental, GriddoAlertRegisterProps, GriddoBackgroundImage, GriddoImage, GriddoImageCommonProps, GriddoImageCommonPropsExperimental, GriddoImageExp, GriddoImageGif, GriddoImageGifExperimental, GriddoImageJpgWebpAvif, GriddoImageJpgWebpAvifExperimental, GriddoImageProps, GriddoImagePropsExperimental, GriddoImageSvg, GriddoImageSvgExperimental, GriddoLink, GriddoLinkProps, getComponent, getLangFromLocalStorage, getSiteID, getToken, griddoAlertRegister, Hideable, HLocation, HTMLHeadingTag, ImageChunk, ImageChunkExperimental, ImageConfig, ImageConfigExperimental, LdJson, Link, LinkGetProps, ListApiQueryResponseProps, ModulePreviewProps, NonEmptyArray, Page, PageContentTypeFields, PageContext, PageProps, PageProvider, PickRename, Pretty, Preview, PreviewProps, Schema, SessionContext, SessionProvider, SetQueryProps, SimpleContentTypeFields, SiteContext, SiteProvider, SiteProviderProps, Theme, UIFields, UIFormFields, UITemplateFields, UseDataFilterSetUrlAction, UseDataFiltersReturn, UseDataFiltersSetQueryProps, UseDataFiltersState, UseGriddoImageProps, UseGriddoImagePropsExperimental, UseGriddoImageReturn, UseGriddoImageReturnExperimental, UseI18nProps, UseImageProps, UseListSetQueryProps, UseListSetUrlAction, useAIReferenceField, useAiAnswers, useAiAnswers as useAIAnswers, useAiSearch, useAiSearch as useAISearch, useContentType, useContentTypeNavigation, useDataFilters, useGlobalTheme, useGriddoImage, useGriddoImageExp, useI18n, useImage, useIsClient, useIsFirstRender, useLink, useList, useListWithDefaultStaticPage, useLocaleDate, useNavigation, usePage, usePageRelatedContent, useReceiveInterests, useReferenceFieldData as useDistributorData, useReferenceFieldData as useReferenceField, useReferenceFieldData, useScript, useSendInterests, useSession, useSite, useSSR, useTheme, useThemeColors, useThemeFont, useThemePrimitives, WindowLocation, };
|