@plasmicpkgs/plasmic-cms 0.0.7
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 +1 -0
- package/dist/api.d.ts +24 -0
- package/dist/components.d.ts +53 -0
- package/dist/context.d.ts +31 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +8 -0
- package/dist/plasmic-cms.cjs.development.js +1779 -0
- package/dist/plasmic-cms.cjs.development.js.map +1 -0
- package/dist/plasmic-cms.cjs.production.min.js +2 -0
- package/dist/plasmic-cms.cjs.production.min.js.map +1 -0
- package/dist/plasmic-cms.esm.js +1773 -0
- package/dist/plasmic-cms.esm.js.map +1 -0
- package/dist/schema.d.ts +58 -0
- package/dist/util.d.ts +8 -0
- package/package.json +47 -0
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Plasmic CMS components
|
package/dist/api.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ApiCmsRow, ApiCmsTable } from "./schema";
|
|
2
|
+
export interface DatabaseConfig {
|
|
3
|
+
host: string;
|
|
4
|
+
projectId: string;
|
|
5
|
+
projectApiToken: string;
|
|
6
|
+
databaseId: string;
|
|
7
|
+
}
|
|
8
|
+
export interface QueryParams {
|
|
9
|
+
useDraft: boolean;
|
|
10
|
+
where: {};
|
|
11
|
+
orderBy: string;
|
|
12
|
+
desc: boolean;
|
|
13
|
+
limit: number;
|
|
14
|
+
}
|
|
15
|
+
declare class API {
|
|
16
|
+
private config;
|
|
17
|
+
constructor(config: DatabaseConfig);
|
|
18
|
+
get(endpoint: string, params?: {}): Promise<any>;
|
|
19
|
+
fetchTables(): Promise<ApiCmsTable[]>;
|
|
20
|
+
query(table: string, params: QueryParams): Promise<ApiCmsRow[]>;
|
|
21
|
+
fetchRow(table: string, row: string, useDraft: boolean): Promise<ApiCmsRow>;
|
|
22
|
+
}
|
|
23
|
+
export declare function mkApi(config: DatabaseConfig | undefined): API;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { ComponentMeta } from "@plasmicapp/host";
|
|
2
|
+
import { CanvasComponentProps } from "@plasmicapp/host/registerComponent";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { DatabaseConfig, QueryParams } from "./api";
|
|
5
|
+
import { ApiCmsTable } from "./schema";
|
|
6
|
+
interface CmsDataProviderProps extends DatabaseConfig {
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export declare const cmsDataProviderMeta: ComponentMeta<CmsDataProviderProps>;
|
|
10
|
+
export declare function CmsDataProvider({ children, ...config }: CmsDataProviderProps): JSX.Element;
|
|
11
|
+
declare type TablesContextData = {
|
|
12
|
+
tables: ApiCmsTable[];
|
|
13
|
+
};
|
|
14
|
+
interface CmsQueryLoaderProps extends QueryParams, CanvasComponentProps<TablesContextData> {
|
|
15
|
+
children?: React.ReactNode;
|
|
16
|
+
table?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare const cmsQueryLoaderMeta: ComponentMeta<CmsQueryLoaderProps>;
|
|
19
|
+
export declare function CmsQueryLoader({ table, children, setControlContextData, ...params }: CmsQueryLoaderProps): JSX.Element;
|
|
20
|
+
interface CmsRowRepeaterProps extends CanvasComponentProps<TablesContextData> {
|
|
21
|
+
children?: React.ReactNode;
|
|
22
|
+
table?: string;
|
|
23
|
+
}
|
|
24
|
+
export declare const cmsRowRepeaterMeta: ComponentMeta<CmsRowRepeaterProps>;
|
|
25
|
+
export declare function CmsRowRepeater({ table, children, setControlContextData, }: CmsRowRepeaterProps): JSX.Element;
|
|
26
|
+
interface CmsRowFieldProps extends CanvasComponentProps<TablesContextData & {
|
|
27
|
+
table: string;
|
|
28
|
+
}> {
|
|
29
|
+
table?: string;
|
|
30
|
+
field?: string;
|
|
31
|
+
className?: string;
|
|
32
|
+
}
|
|
33
|
+
export declare const cmsRowFieldMeta: ComponentMeta<CmsRowFieldProps>;
|
|
34
|
+
export declare function CmsRowField({ className, table, field, setControlContextData, }: CmsRowFieldProps): JSX.Element | null;
|
|
35
|
+
interface CmsRowLinkProps extends CanvasComponentProps<TablesContextData & {
|
|
36
|
+
table: string;
|
|
37
|
+
}> {
|
|
38
|
+
table: string;
|
|
39
|
+
field: string;
|
|
40
|
+
hrefProp: string;
|
|
41
|
+
children: React.ReactNode;
|
|
42
|
+
}
|
|
43
|
+
export declare const cmsRowLinkMeta: ComponentMeta<CmsRowLinkProps>;
|
|
44
|
+
export declare function CmsRowLink({ table, field, hrefProp, children, setControlContextData, }: CmsRowLinkProps): JSX.Element;
|
|
45
|
+
interface CmsRowLoaderProps extends CanvasComponentProps<TablesContextData> {
|
|
46
|
+
table: string;
|
|
47
|
+
row: string;
|
|
48
|
+
children: React.ReactNode;
|
|
49
|
+
useDraft: boolean;
|
|
50
|
+
}
|
|
51
|
+
export declare const cmsRowLoaderMeta: ComponentMeta<CmsRowLoaderProps>;
|
|
52
|
+
export declare function CmsRowLoader({ table, row, children, useDraft, setControlContextData, }: CmsRowLoaderProps): JSX.Element;
|
|
53
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { DatabaseConfig } from "./api";
|
|
3
|
+
import { ApiCmsRow, ApiCmsTable } from "./schema";
|
|
4
|
+
export declare function useDatabase(): DatabaseConfig | undefined;
|
|
5
|
+
export declare function DatabaseProvider({ config, children, }: {
|
|
6
|
+
config: DatabaseConfig;
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
}): JSX.Element;
|
|
9
|
+
export declare function useTables(): ApiCmsTable[] | undefined;
|
|
10
|
+
export declare function TablesProvider({ children, tables, }: {
|
|
11
|
+
children?: React.ReactNode;
|
|
12
|
+
tables: ApiCmsTable[];
|
|
13
|
+
}): JSX.Element;
|
|
14
|
+
export declare function useQueryResults(table?: string): {
|
|
15
|
+
table: string;
|
|
16
|
+
rows: ApiCmsRow[];
|
|
17
|
+
} | undefined;
|
|
18
|
+
export declare function QueryResultProvider({ children, table, rows, }: {
|
|
19
|
+
children?: React.ReactNode;
|
|
20
|
+
table: string;
|
|
21
|
+
rows: ApiCmsRow[];
|
|
22
|
+
}): JSX.Element;
|
|
23
|
+
export declare function useRow(table?: string): {
|
|
24
|
+
table: string;
|
|
25
|
+
row: ApiCmsRow | undefined;
|
|
26
|
+
} | undefined;
|
|
27
|
+
export declare function RowProvider({ children, table, row, }: {
|
|
28
|
+
children?: React.ReactNode;
|
|
29
|
+
table: string;
|
|
30
|
+
row: ApiCmsRow;
|
|
31
|
+
}): JSX.Element;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { registerComponent as hostRegisterComponent, registerContext as hostRegisterContext } from "@plasmicapp/host";
|
|
2
|
+
export declare function registerAll(loader?: {
|
|
3
|
+
registerComponent: typeof hostRegisterComponent;
|
|
4
|
+
registerContext: typeof hostRegisterContext;
|
|
5
|
+
}): void;
|