@blinkk/root-cms 2.5.16 → 2.5.17
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/app.js +1 -1
- package/dist/{chunk-JGLMVZE4.js → chunk-MVSVVVHN.js} +2 -2
- package/dist/{chunk-KDXHFMIH.js → chunk-XLX37FRL.js} +3 -0
- package/dist/cli.js +1 -1
- package/dist/{client-B_oDIGeJ.d.ts → client-lQZoGxLC.d.ts} +1 -1
- package/dist/client.d.ts +2 -2
- package/dist/core.d.ts +3 -3
- package/dist/{generate-types-MHWSSOWV.js → generate-types-SPV7I3A5.js} +1 -1
- package/dist/plugin.d.ts +2 -2
- package/dist/plugin.js +2 -2
- package/dist/project.d.ts +1 -1
- package/dist/richtext.d.ts +25 -18
- package/dist/richtext.js +98 -43
- package/dist/{schema-D7MOj-YC.d.ts → schema-D4-RG0L4.d.ts} +5 -0
- package/dist/ui/signin.css +1 -1
- package/dist/ui/signin.js +2 -2
- package/dist/ui/ui.css +1 -1
- package/dist/ui/ui.js +97 -97
- package/package.json +3 -3
package/dist/app.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// package.json
|
|
2
2
|
var package_default = {
|
|
3
3
|
name: "@blinkk/root-cms",
|
|
4
|
-
version: "2.5.
|
|
4
|
+
version: "2.5.17",
|
|
5
5
|
author: "s@blinkk.com",
|
|
6
6
|
license: "MIT",
|
|
7
7
|
engines: {
|
|
@@ -169,7 +169,7 @@ var package_default = {
|
|
|
169
169
|
yjs: "13.6.27"
|
|
170
170
|
},
|
|
171
171
|
peerDependencies: {
|
|
172
|
-
"@blinkk/root": "2.5.
|
|
172
|
+
"@blinkk/root": "2.5.17",
|
|
173
173
|
"firebase-admin": ">=11",
|
|
174
174
|
"firebase-functions": ">=4",
|
|
175
175
|
preact: ">=10",
|
|
@@ -222,6 +222,9 @@ function fieldType(field, options) {
|
|
|
222
222
|
if (field.type === "multiselect") {
|
|
223
223
|
return dom.type.array(dom.type.string);
|
|
224
224
|
}
|
|
225
|
+
if (field.type === "number") {
|
|
226
|
+
return dom.type.number;
|
|
227
|
+
}
|
|
225
228
|
if (field.type === "oneof") {
|
|
226
229
|
const oneOf = dom.create.namedTypeReference("RootCMSOneOf");
|
|
227
230
|
if (field.types && Array.isArray(field.types)) {
|
package/dist/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RootConfig, Plugin, Request } from '@blinkk/root';
|
|
2
2
|
import { App } from 'firebase-admin/app';
|
|
3
3
|
import { Firestore, WriteBatch, Timestamp, Query } from 'firebase-admin/firestore';
|
|
4
|
-
import { C as Collection } from './schema-
|
|
4
|
+
import { C as Collection } from './schema-D4-RG0L4.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Supported Root AI models. Defaults to 'gemini-3-flash-preview'.
|
package/dist/client.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import '@blinkk/root';
|
|
2
2
|
import 'firebase-admin/app';
|
|
3
3
|
import 'firebase-admin/firestore';
|
|
4
|
-
export { A as Action, r as ArrayObject, F as BatchRequest, B as BatchRequestOptions, y as BatchRequestQuery, z as BatchRequestQueryOptions, I as BatchResponse, C as CronUnit, d as DataSource, c as DataSourceCron, e as DataSourceData, f as DataSourceMode, b as Doc, D as DocMode, j as GetCountOptions, G as GetDocOptions, H as HttpMethod, m as ListActionsOptions, i as ListDocsOptions, L as LoadTranslationsOptions, a as LocaleTranslations, l as Release, R as RootCMSClient, g as SaveDraftOptions, S as SetDocOptions, k as Translation, E as TranslationsDoc, T as TranslationsMap, h as UpdateDraftOptions, U as UserRole, o as getCmsPlugin, n as isRichTextData, s as marshalArray, p as marshalData, q as normalizeData, x as parseDocId, t as toArrayObject, w as translationsForLocale, v as unmarshalArray, u as unmarshalData } from './client-
|
|
5
|
-
import './schema-
|
|
4
|
+
export { A as Action, r as ArrayObject, F as BatchRequest, B as BatchRequestOptions, y as BatchRequestQuery, z as BatchRequestQueryOptions, I as BatchResponse, C as CronUnit, d as DataSource, c as DataSourceCron, e as DataSourceData, f as DataSourceMode, b as Doc, D as DocMode, j as GetCountOptions, G as GetDocOptions, H as HttpMethod, m as ListActionsOptions, i as ListDocsOptions, L as LoadTranslationsOptions, a as LocaleTranslations, l as Release, R as RootCMSClient, g as SaveDraftOptions, S as SetDocOptions, k as Translation, E as TranslationsDoc, T as TranslationsMap, h as UpdateDraftOptions, U as UserRole, o as getCmsPlugin, n as isRichTextData, s as marshalArray, p as marshalData, q as normalizeData, x as parseDocId, t as toArrayObject, w as translationsForLocale, v as unmarshalArray, u as unmarshalData } from './client-lQZoGxLC.js';
|
|
5
|
+
import './schema-D4-RG0L4.js';
|
package/dist/core.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { R as RootCMSClient, D as DocMode, L as LoadTranslationsOptions, T as TranslationsMap, a as LocaleTranslations } from './client-
|
|
2
|
-
export { A as Action, r as ArrayObject, F as BatchRequest, B as BatchRequestOptions, y as BatchRequestQuery, z as BatchRequestQueryOptions, I as BatchResponse, C as CronUnit, d as DataSource, c as DataSourceCron, e as DataSourceData, f as DataSourceMode, b as Doc, j as GetCountOptions, G as GetDocOptions, H as HttpMethod, m as ListActionsOptions, i as ListDocsOptions, J as Locale, Q as MultiLocaleTranslationsMap, l as Release, g as SaveDraftOptions, S as SetDocOptions, V as SingleLocaleTranslationsMap, K as SourceString, M as TranslatedString, k as Translation, E as TranslationsDoc, N as TranslationsDocMode, P as TranslationsLocaleDocEntry, O as TranslationsLocaleDocHashMap, W as TranslationsManager, h as UpdateDraftOptions, U as UserRole, X as buildTranslationsDbPath, Y as buildTranslationsLocaleDocDbPath, o as getCmsPlugin, n as isRichTextData, s as marshalArray, p as marshalData, q as normalizeData, x as parseDocId, t as toArrayObject, w as translationsForLocale, v as unmarshalArray, u as unmarshalData } from './client-
|
|
1
|
+
import { R as RootCMSClient, D as DocMode, L as LoadTranslationsOptions, T as TranslationsMap, a as LocaleTranslations } from './client-lQZoGxLC.js';
|
|
2
|
+
export { A as Action, r as ArrayObject, F as BatchRequest, B as BatchRequestOptions, y as BatchRequestQuery, z as BatchRequestQueryOptions, I as BatchResponse, C as CronUnit, d as DataSource, c as DataSourceCron, e as DataSourceData, f as DataSourceMode, b as Doc, j as GetCountOptions, G as GetDocOptions, H as HttpMethod, m as ListActionsOptions, i as ListDocsOptions, J as Locale, Q as MultiLocaleTranslationsMap, l as Release, g as SaveDraftOptions, S as SetDocOptions, V as SingleLocaleTranslationsMap, K as SourceString, M as TranslatedString, k as Translation, E as TranslationsDoc, N as TranslationsDocMode, P as TranslationsLocaleDocEntry, O as TranslationsLocaleDocHashMap, W as TranslationsManager, h as UpdateDraftOptions, U as UserRole, X as buildTranslationsDbPath, Y as buildTranslationsLocaleDocDbPath, o as getCmsPlugin, n as isRichTextData, s as marshalArray, p as marshalData, q as normalizeData, x as parseDocId, t as toArrayObject, w as translationsForLocale, v as unmarshalArray, u as unmarshalData } from './client-lQZoGxLC.js';
|
|
3
3
|
import { Request, RootConfig, Response, RouteParams, GetStaticProps, GetStaticPaths } from '@blinkk/root';
|
|
4
4
|
import { Query } from 'firebase-admin/firestore';
|
|
5
|
-
export { s as schema } from './schema-
|
|
5
|
+
export { s as schema } from './schema-D4-RG0L4.js';
|
|
6
6
|
import 'firebase-admin/app';
|
|
7
7
|
|
|
8
8
|
/**
|
package/dist/plugin.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import '@blinkk/root';
|
|
2
2
|
import 'firebase-admin/app';
|
|
3
3
|
import 'firebase-admin/firestore';
|
|
4
|
-
export { $ as CMSAIConfig, Z as CMSBuiltInSidebarTool, a4 as CMSCheck, a2 as CMSPlugin, a1 as CMSPluginOptions, a0 as CMSSidebarTool, aa as CMSTranslationService, _ as CMSUser, a6 as CheckContext, a5 as CheckResult, a7 as CheckStatus, ab as TranslationExportResult, ac as TranslationImportResult, ad as TranslationRow, ae as TranslationServiceContext, a9 as TranslationsCheckOptions, a3 as cmsPlugin, a8 as translationsCheck } from './client-
|
|
5
|
-
import './schema-
|
|
4
|
+
export { $ as CMSAIConfig, Z as CMSBuiltInSidebarTool, a4 as CMSCheck, a2 as CMSPlugin, a1 as CMSPluginOptions, a0 as CMSSidebarTool, aa as CMSTranslationService, _ as CMSUser, a6 as CheckContext, a5 as CheckResult, a7 as CheckStatus, ab as TranslationExportResult, ac as TranslationImportResult, ad as TranslationRow, ae as TranslationServiceContext, a9 as TranslationsCheckOptions, a3 as cmsPlugin, a8 as translationsCheck } from './client-lQZoGxLC.js';
|
|
5
|
+
import './schema-D4-RG0L4.js';
|
package/dist/plugin.js
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-T5UK2H24.js";
|
|
5
5
|
import {
|
|
6
6
|
getServerVersion
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-MVSVVVHN.js";
|
|
8
8
|
import {
|
|
9
9
|
runCronJobs
|
|
10
10
|
} from "./chunk-DKM5LHW3.js";
|
|
@@ -1294,7 +1294,7 @@ function cmsPlugin(options) {
|
|
|
1294
1294
|
if (process.env.NODE_ENV === "development" && options.watch !== false) {
|
|
1295
1295
|
plugin.onFileChange = (eventName, filepath) => {
|
|
1296
1296
|
if (filepath.endsWith(".schema.ts")) {
|
|
1297
|
-
import("./generate-types-
|
|
1297
|
+
import("./generate-types-SPV7I3A5.js").then((generateTypesModule) => {
|
|
1298
1298
|
const generateTypes = generateTypesModule.generateTypes;
|
|
1299
1299
|
generateTypes();
|
|
1300
1300
|
});
|
package/dist/project.d.ts
CHANGED
package/dist/richtext.d.ts
CHANGED
|
@@ -7,25 +7,36 @@ interface RichTextBlock {
|
|
|
7
7
|
}
|
|
8
8
|
interface RichTextData {
|
|
9
9
|
[key: string]: any;
|
|
10
|
-
blocks:
|
|
10
|
+
blocks: RichTextBlock[];
|
|
11
11
|
}
|
|
12
|
-
type
|
|
12
|
+
type RichTextComponent = FunctionalComponent<any>;
|
|
13
|
+
type RichTextBlockComponent = RichTextComponent;
|
|
14
|
+
type RichTextInlineComponent = RichTextComponent;
|
|
15
|
+
type RichTextComponentMap = Record<string, RichTextComponent>;
|
|
13
16
|
interface RichTextContextProps {
|
|
14
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Rich text components override for both inline and block level components.
|
|
19
|
+
*/
|
|
20
|
+
components?: RichTextComponentMap;
|
|
21
|
+
/**
|
|
22
|
+
* Translator function override.
|
|
23
|
+
*/
|
|
24
|
+
t?: (msg: string, params?: Record<string, string | number>) => string;
|
|
15
25
|
}
|
|
16
26
|
declare const RichTextContext: preact.Context<RichTextContextProps>;
|
|
17
27
|
declare function useRichTextContext(): RichTextContextProps;
|
|
18
28
|
interface RichTextProps {
|
|
19
|
-
data: RichTextData;
|
|
29
|
+
data: RichTextData | undefined;
|
|
20
30
|
components?: Record<string, RichTextBlockComponent>;
|
|
31
|
+
/** @deprecated */
|
|
32
|
+
translate?: boolean;
|
|
21
33
|
}
|
|
22
34
|
/** Renders data from the "richtext" field. */
|
|
23
|
-
declare function RichText(props: RichTextProps): preact.JSX.Element;
|
|
35
|
+
declare function RichText(props: RichTextProps): preact.JSX.Element | null;
|
|
24
36
|
declare namespace RichText {
|
|
37
|
+
var Block: (props: RichTextBlock) => preact.JSX.Element | null;
|
|
25
38
|
var ParagraphBlock: (props: RichTextParagraphBlockProps) => preact.JSX.Element | null;
|
|
26
|
-
var DelimiterBlock: () => preact.JSX.Element;
|
|
27
39
|
var HeadingBlock: (props: RichTextHeadingBlockProps) => preact.JSX.Element | null;
|
|
28
|
-
var QuoteBlock: (props: RichTextQuoteBlockProps) => preact.JSX.Element | null;
|
|
29
40
|
var ListBlock: (props: RichTextListBlockProps) => preact.JSX.Element | null;
|
|
30
41
|
var ImageBlock: (props: RichTextImageBlockProps) => preact.JSX.Element | null;
|
|
31
42
|
var HtmlBlock: (props: RichTextHtmlBlockProps) => preact.JSX.Element | null;
|
|
@@ -35,12 +46,9 @@ interface RichTextParagraphBlockProps {
|
|
|
35
46
|
type: 'paragraph';
|
|
36
47
|
data?: {
|
|
37
48
|
text?: string;
|
|
49
|
+
components?: Record<string, any>;
|
|
38
50
|
};
|
|
39
51
|
}
|
|
40
|
-
interface RichTextDelimiterBlockProps {
|
|
41
|
-
type: 'delimiter';
|
|
42
|
-
data?: {};
|
|
43
|
-
}
|
|
44
52
|
interface RichTextHeadingBlockProps {
|
|
45
53
|
type: 'heading';
|
|
46
54
|
data?: {
|
|
@@ -48,15 +56,10 @@ interface RichTextHeadingBlockProps {
|
|
|
48
56
|
text?: string;
|
|
49
57
|
};
|
|
50
58
|
}
|
|
51
|
-
interface RichTextQuoteBlockProps {
|
|
52
|
-
type: 'quote';
|
|
53
|
-
data?: {
|
|
54
|
-
text?: string;
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
59
|
interface ListItem {
|
|
58
60
|
content?: string;
|
|
59
61
|
items?: ListItem[];
|
|
62
|
+
components?: Record<string, any>;
|
|
60
63
|
}
|
|
61
64
|
interface RichTextListBlockProps {
|
|
62
65
|
type: 'orderedList' | 'unorderedList';
|
|
@@ -68,6 +71,8 @@ interface RichTextListBlockProps {
|
|
|
68
71
|
interface RichTextImageBlockProps {
|
|
69
72
|
type: 'image';
|
|
70
73
|
data?: {
|
|
74
|
+
/** The caption entered into the CMS Image field. */
|
|
75
|
+
caption?: string;
|
|
71
76
|
file?: {
|
|
72
77
|
url: string;
|
|
73
78
|
width: string | number;
|
|
@@ -93,5 +98,7 @@ interface RichTextTableBlockProps {
|
|
|
93
98
|
}>;
|
|
94
99
|
};
|
|
95
100
|
}
|
|
101
|
+
/** Returns whether the rich text value is truthy. */
|
|
102
|
+
declare function testContent(data: RichTextData): boolean;
|
|
96
103
|
|
|
97
|
-
export { RichText, type RichTextBlock, type RichTextBlockComponent,
|
|
104
|
+
export { RichText, type RichTextBlock, type RichTextBlockComponent, type RichTextComponent, type RichTextComponentMap, RichTextContext, type RichTextContextProps, type RichTextData, type RichTextHeadingBlockProps, type RichTextHtmlBlockProps, type RichTextImageBlockProps, type RichTextInlineComponent, type RichTextListBlockProps, type RichTextParagraphBlockProps, type RichTextProps, type RichTextTableBlockProps, testContent, useRichTextContext };
|
package/dist/richtext.js
CHANGED
|
@@ -1,70 +1,99 @@
|
|
|
1
1
|
import "./chunk-MLKGABMK.js";
|
|
2
2
|
|
|
3
3
|
// core/richtext.tsx
|
|
4
|
-
import { useTranslations } from "@blinkk/root";
|
|
5
|
-
import { createContext } from "preact";
|
|
4
|
+
import { StringParamsProvider, useTranslations } from "@blinkk/root";
|
|
5
|
+
import { Component, createContext } from "preact";
|
|
6
6
|
import { useContext } from "preact/hooks";
|
|
7
|
-
import {
|
|
7
|
+
import { renderToString } from "preact-render-to-string";
|
|
8
|
+
import { jsx, jsxs } from "preact/jsx-runtime";
|
|
8
9
|
var RichTextContext = createContext({});
|
|
9
10
|
function useRichTextContext() {
|
|
10
11
|
return useContext(RichTextContext);
|
|
11
12
|
}
|
|
13
|
+
var RichTextComponentMapContext = createContext({});
|
|
14
|
+
function useRichTextContextComponentMap() {
|
|
15
|
+
return useContext(RichTextComponentMapContext);
|
|
16
|
+
}
|
|
17
|
+
function useRichTextTranslations() {
|
|
18
|
+
const ctx = useRichTextContext();
|
|
19
|
+
if (ctx.t) {
|
|
20
|
+
return ctx.t;
|
|
21
|
+
}
|
|
22
|
+
return useTranslations();
|
|
23
|
+
}
|
|
12
24
|
function RichText(props) {
|
|
25
|
+
const blocks = props.data?.blocks || [];
|
|
26
|
+
if (blocks.length === 0) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
13
29
|
const richTextContext = useRichTextContext();
|
|
14
|
-
const
|
|
15
|
-
delimiter: RichText.DelimiterBlock,
|
|
30
|
+
const componentMap = {
|
|
16
31
|
heading: RichText.HeadingBlock,
|
|
17
32
|
html: RichText.HtmlBlock,
|
|
18
33
|
image: RichText.ImageBlock,
|
|
19
34
|
orderedList: RichText.ListBlock,
|
|
20
35
|
paragraph: RichText.ParagraphBlock,
|
|
21
|
-
quote: RichText.QuoteBlock,
|
|
22
36
|
table: RichText.TableBlock,
|
|
23
37
|
unorderedList: RichText.ListBlock,
|
|
24
38
|
...richTextContext.components,
|
|
25
39
|
...props.components
|
|
26
40
|
};
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return false;
|
|
31
|
-
}
|
|
32
|
-
if (!(blockType in components)) {
|
|
33
|
-
console.warn(`ignoring unknown richtext type: "${blockType}"`);
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
return true;
|
|
37
|
-
});
|
|
38
|
-
return /* @__PURE__ */ jsx(Fragment, { children: blocks.map((block) => {
|
|
39
|
-
const Block = components[block.type];
|
|
40
|
-
return /* @__PURE__ */ jsx(Block, { ...block });
|
|
41
|
-
}) });
|
|
41
|
+
return /* @__PURE__ */ jsx(RichTextComponentMapContext.Provider, { value: componentMap, children: blocks.map((block) => {
|
|
42
|
+
return /* @__PURE__ */ jsx(RichText.Block, { ...block });
|
|
43
|
+
}).filter((value) => !!value) });
|
|
42
44
|
}
|
|
43
|
-
RichText.
|
|
44
|
-
|
|
45
|
+
RichText.Block = (props) => {
|
|
46
|
+
const block = props;
|
|
47
|
+
const blockType = block?.type;
|
|
48
|
+
if (!blockType) {
|
|
45
49
|
return null;
|
|
46
50
|
}
|
|
47
|
-
const
|
|
48
|
-
|
|
51
|
+
const componentMap = useRichTextContextComponentMap();
|
|
52
|
+
const BlockComponent = componentMap[blockType];
|
|
53
|
+
if (!BlockComponent) {
|
|
54
|
+
console.warn(`[RichText] ignoring unknown richtext type: "${blockType}"`);
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
return /* @__PURE__ */ jsx(
|
|
58
|
+
InlineComponentRenderer,
|
|
59
|
+
{
|
|
60
|
+
block,
|
|
61
|
+
componentMap,
|
|
62
|
+
BlockComponent
|
|
63
|
+
}
|
|
64
|
+
);
|
|
49
65
|
};
|
|
50
|
-
|
|
51
|
-
|
|
66
|
+
var InlineComponentRenderer = class extends Component {
|
|
67
|
+
render() {
|
|
68
|
+
const { block, componentMap, BlockComponent } = this.props;
|
|
69
|
+
const stringParams = collectInlineComponentParams(
|
|
70
|
+
block,
|
|
71
|
+
componentMap,
|
|
72
|
+
this.context
|
|
73
|
+
);
|
|
74
|
+
if (stringParams) {
|
|
75
|
+
return /* @__PURE__ */ jsx(StringParamsProvider, { value: stringParams, children: /* @__PURE__ */ jsx(BlockComponent, { ...block }) });
|
|
76
|
+
}
|
|
77
|
+
return /* @__PURE__ */ jsx(BlockComponent, { ...block });
|
|
78
|
+
}
|
|
52
79
|
};
|
|
53
|
-
RichText.
|
|
80
|
+
RichText.ParagraphBlock = (props) => {
|
|
54
81
|
if (!props.data?.text) {
|
|
55
82
|
return null;
|
|
56
83
|
}
|
|
57
|
-
const t =
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
return /* @__PURE__ */ jsx(Component, { dangerouslySetInnerHTML: { __html: t(props.data.text) } });
|
|
84
|
+
const t = useRichTextTranslations();
|
|
85
|
+
const html = t(props.data.text);
|
|
86
|
+
return /* @__PURE__ */ jsx("p", { dangerouslySetInnerHTML: { __html: html } });
|
|
61
87
|
};
|
|
62
|
-
RichText.
|
|
88
|
+
RichText.HeadingBlock = (props) => {
|
|
63
89
|
if (!props.data?.text) {
|
|
64
90
|
return null;
|
|
65
91
|
}
|
|
66
|
-
const t =
|
|
67
|
-
|
|
92
|
+
const t = useRichTextTranslations();
|
|
93
|
+
const level = props.data.level || 2;
|
|
94
|
+
const Component2 = `h${level}`;
|
|
95
|
+
const html = t(props.data.text);
|
|
96
|
+
return /* @__PURE__ */ jsx(Component2, { dangerouslySetInnerHTML: { __html: html } });
|
|
68
97
|
};
|
|
69
98
|
RichText.ListBlock = (props) => {
|
|
70
99
|
if (!props.data?.items?.length) {
|
|
@@ -74,20 +103,20 @@ RichText.ListBlock = (props) => {
|
|
|
74
103
|
if (!style) {
|
|
75
104
|
style = props.type === "orderedList" ? "ordered" : "unordered";
|
|
76
105
|
}
|
|
77
|
-
const
|
|
106
|
+
const Component2 = style === "ordered" ? "ol" : "ul";
|
|
78
107
|
const items = props.data.items;
|
|
79
|
-
return /* @__PURE__ */ jsx(
|
|
108
|
+
return /* @__PURE__ */ jsx(Component2, { children: items.map((item) => {
|
|
80
109
|
if (item.content || item.items?.length) {
|
|
81
110
|
return /* @__PURE__ */ jsxs("li", { children: [
|
|
82
111
|
item.content && /* @__PURE__ */ jsx(
|
|
83
|
-
RichText.
|
|
112
|
+
RichText.Block,
|
|
84
113
|
{
|
|
85
114
|
type: "paragraph",
|
|
86
|
-
data: { text: item.content }
|
|
115
|
+
data: { text: item.content, components: item.components }
|
|
87
116
|
}
|
|
88
117
|
),
|
|
89
118
|
item.items && item.items.length > 0 && /* @__PURE__ */ jsx(
|
|
90
|
-
RichText.
|
|
119
|
+
RichText.Block,
|
|
91
120
|
{
|
|
92
121
|
type: props.type,
|
|
93
122
|
data: { style, items: item.items }
|
|
@@ -109,7 +138,8 @@ RichText.ImageBlock = (props) => {
|
|
|
109
138
|
return /* @__PURE__ */ jsx("img", { src: imageUrl, width, height, alt });
|
|
110
139
|
};
|
|
111
140
|
RichText.HtmlBlock = (props) => {
|
|
112
|
-
const
|
|
141
|
+
const t = useRichTextTranslations();
|
|
142
|
+
const html = t(props.data?.html || "");
|
|
113
143
|
if (!html) {
|
|
114
144
|
return null;
|
|
115
145
|
}
|
|
@@ -122,8 +152,7 @@ RichText.TableBlock = (props) => {
|
|
|
122
152
|
return null;
|
|
123
153
|
}
|
|
124
154
|
return /* @__PURE__ */ jsx("table", { children: /* @__PURE__ */ jsx("tbody", { children: rows.map((row, rowIndex) => /* @__PURE__ */ jsx("tr", { children: row.cells.map((cell, cellIndex) => {
|
|
125
|
-
const
|
|
126
|
-
const Cell = isHeader ? "th" : "td";
|
|
155
|
+
const Cell = cell.type === "header" ? "th" : "td";
|
|
127
156
|
return /* @__PURE__ */ jsx(Cell, { children: /* @__PURE__ */ jsx(
|
|
128
157
|
RichText,
|
|
129
158
|
{
|
|
@@ -146,8 +175,34 @@ function toNumber(input) {
|
|
|
146
175
|
}
|
|
147
176
|
return parsedNumber;
|
|
148
177
|
}
|
|
178
|
+
function testContent(data) {
|
|
179
|
+
return data?.blocks?.length > 0;
|
|
180
|
+
}
|
|
181
|
+
function collectInlineComponentParams(block, componentMap, renderContext) {
|
|
182
|
+
const components = block?.data?.components || {};
|
|
183
|
+
if (Object.keys(components).length === 0) {
|
|
184
|
+
return null;
|
|
185
|
+
}
|
|
186
|
+
const params = {};
|
|
187
|
+
for (const [componentId, component] of Object.entries(components)) {
|
|
188
|
+
const Component2 = componentMap[component.type];
|
|
189
|
+
if (Component2) {
|
|
190
|
+
const key = `${component.type}:${componentId}`;
|
|
191
|
+
params[key] = renderToString(
|
|
192
|
+
/* @__PURE__ */ jsx(Component2, { ...component.data }),
|
|
193
|
+
renderContext
|
|
194
|
+
);
|
|
195
|
+
} else {
|
|
196
|
+
console.warn(
|
|
197
|
+
`[RichText] could not find inline component for type: "${component.type}"`
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
return params;
|
|
202
|
+
}
|
|
149
203
|
export {
|
|
150
204
|
RichText,
|
|
151
205
|
RichTextContext,
|
|
206
|
+
testContent,
|
|
152
207
|
useRichTextContext
|
|
153
208
|
};
|
|
@@ -155,6 +155,11 @@ type ArrayField = CommonFieldProps & {
|
|
|
155
155
|
* Label to use for the "add item" button. Defaults to `Add`.
|
|
156
156
|
*/
|
|
157
157
|
buttonLabel?: string;
|
|
158
|
+
/**
|
|
159
|
+
* Whether array items should be open (expanded) by default. Defaults to
|
|
160
|
+
* `false`, meaning items start collapsed.
|
|
161
|
+
*/
|
|
162
|
+
defaultOpen?: boolean;
|
|
158
163
|
};
|
|
159
164
|
declare function array(field: Omit<ArrayField, 'type'>): ArrayField;
|
|
160
165
|
/**
|
package/dist/ui/signin.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
:root{--font-family-default: "Inter", sans-serif;--font-family-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;--color-text-default: #333333;--color-border: #EFEFEF;--button-background-hover: #F5F5F5;--button-background-active: #E5E5E5}html{box-sizing:border-box;overflow-x:hidden;font-size:16px;line-height:1.5}*,*:before,*:after{box-sizing:inherit}html,body{font-family:var(--font-family-default);color:var(--color-text-default);height:100%;margin:0;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;scroll-behavior:smooth}img,picture,figure,video,canvas,svg,iframe{display:block;max-width:100%;height:auto;margin:0}a{color:inherit}select{color-scheme:light}h1,h2,h3,h4,h5,p{margin:0}body.menu\:open{overflow:hidden}#root{margin:0 auto;min-height:100vh;position:relative}.bootstrap{font-size:48px;font-weight:900;width:100%;height:100vh;display:flex;flex-direction:column;justify-content:center;align-items:center;text-align:center;padding:40px;gap:36px;position:relative}.bootstrap-error{font-size:14px;font-weight:400;line-height:20px;position:absolute;bottom:100px;left:0;right:0;text-align:center;animation:.5s forwards bootstrap-loading-error;animation-delay:1s;opacity:0;padding:0 24px}@keyframes bootstrap-loading-error{0%{opacity:0}to{opacity:1}}.signin{font-family:Google Sans,arial,sans-serif;text-align:center;padding:48px 20px;color:#3c4043}.signin__headline{margin-bottom:40px}.signin__headline__title{font-size:36px;line-height:1.3;font-weight:500;margin-bottom:20px}.signin__headline__body{font-size:18px;line-height:1.5;font-weight:500}.signin__button{-webkit-appearance:none;-moz-appearance:none;appearance:none;display:inline-flex;align-items:center;text-align:center;gap:12px;background:#fff;border:1px solid #dadce0;border-radius:4px;cursor:pointer;font-family:inherit;padding:0 12px;height:40px;box-sizing:border-box;transition:all .218s ease}.signin__warning{max-width:520px;margin:0 auto 40px;padding:12px;border:1px solid #fbbc04;border-radius:8px;background:#fff9db;color:#5f370e;font-size:14px;line-height:1.5}.signin__button:hover{border-color:#d2e3fc;background-color:#4285f40a}.signin__button__icon{width:18px;height:18px;background-color:#fff}.signin__button__label{font-size:14px;line-height:1;letter-spacing:.25px;font-weight:500;color:#3c4043}.signin__button--busy{cursor:default;opacity:.85;border-color:#d2e3fc;background-color:#4285f40a}.signin__button--busy:hover{background-color:#4285f40a}.signin__spinner{width:18px;height:18px;color:#4285f4;animation:signin-spin .7s linear infinite}@keyframes signin-spin{to{transform:rotate(360deg)}}.signin__error{color:red;font-weight:700;text-align:center;max-width:60ch;margin:20px auto 0}
|
|
1
|
+
:root{--font-family-default: "Inter", sans-serif;--font-family-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;--color-text-default: #333333;--color-border: #EFEFEF;--button-background-hover: #F5F5F5;--button-background-active: #E5E5E5}html{box-sizing:border-box;overflow-x:hidden;font-size:16px;line-height:1.5}*,*:before,*:after{box-sizing:inherit}html,body{font-family:var(--font-family-default);color:var(--color-text-default);height:100%;margin:0;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;scroll-behavior:smooth}img,picture,figure,video,canvas,svg,iframe{display:block;max-width:100%;height:auto;margin:0}a{color:inherit}select{color-scheme:light}h1,h2,h3,h4,h5,p{margin:0}body.menu\:open{overflow:hidden}#root{margin:0 auto;min-height:100vh;position:relative}.bootstrap{font-size:48px;font-weight:900;width:100%;height:100vh;display:flex;flex-direction:column;justify-content:center;align-items:center;text-align:center;padding:40px;gap:36px;position:relative}.bootstrap-error{font-size:14px;font-weight:400;line-height:20px;position:absolute;bottom:100px;left:0;right:0;text-align:center;animation:.5s forwards bootstrap-loading-error;animation-delay:1s;opacity:0;padding:0 24px}.bootstrap--error{gap:16px}.bootstrap__error-title{font-size:48px;font-weight:900;line-height:1.1;margin:0}.bootstrap__error-message{color:#b00020;font-size:16px;font-weight:500;line-height:1.5;margin:0;max-width:640px}@keyframes bootstrap-loading-error{0%{opacity:0}to{opacity:1}}.signin{font-family:Google Sans,arial,sans-serif;text-align:center;padding:48px 20px;color:#3c4043}.signin__headline{margin-bottom:40px}.signin__headline__title{font-size:36px;line-height:1.3;font-weight:500;margin-bottom:20px}.signin__headline__body{font-size:18px;line-height:1.5;font-weight:500}.signin__button{-webkit-appearance:none;-moz-appearance:none;appearance:none;display:inline-flex;align-items:center;text-align:center;gap:12px;background:#fff;border:1px solid #dadce0;border-radius:4px;cursor:pointer;font-family:inherit;padding:0 12px;height:40px;box-sizing:border-box;transition:all .218s ease}.signin__warning{max-width:520px;margin:0 auto 40px;padding:12px;border:1px solid #fbbc04;border-radius:8px;background:#fff9db;color:#5f370e;font-size:14px;line-height:1.5}.signin__button:hover{border-color:#d2e3fc;background-color:#4285f40a}.signin__button__icon{width:18px;height:18px;background-color:#fff}.signin__button__label{font-size:14px;line-height:1;letter-spacing:.25px;font-weight:500;color:#3c4043}.signin__button--busy{cursor:default;opacity:.85;border-color:#d2e3fc;background-color:#4285f40a}.signin__button--busy:hover{background-color:#4285f40a}.signin__spinner{width:18px;height:18px;color:#4285f4;animation:signin-spin .7s linear infinite}@keyframes signin-spin{to{transform:rotate(360deg)}}.signin__error{color:red;font-weight:700;text-align:center;max-width:60ch;margin:20px auto 0}
|