eddev 2.2.0-beta.2 → 2.2.0-beta.4

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.
@@ -1,4 +1,4 @@
1
- import { FormEvent, ReactNode } from "react";
1
+ import { ComponentProps, FormEvent, ReactNode } from "react";
2
2
  import { GFLayoutType, GravityFormsFieldState, GravityFormState, UseGravityFormResult } from "./useGravityForm";
3
3
  import { GFFieldTypeSpec, GravityFormsField } from "./types";
4
4
  import { GF_BUILTIN_FIELDS } from "./field-types";
@@ -9,6 +9,14 @@ declare const FORM_COMPONENTS: {
9
9
  layout: GFLayoutType;
10
10
  state: GravityFormState;
11
11
  }): import("react/jsx-runtime").JSX.Element;
12
+ Input(props: ComponentProps<"input">): import("react/jsx-runtime").JSX.Element;
13
+ Select({ choices, ...props }: Omit<ComponentProps<"select">, "children"> & {
14
+ choices: {
15
+ value: string;
16
+ text: string;
17
+ }[];
18
+ placeholder?: string;
19
+ }): import("react/jsx-runtime").JSX.Element;
12
20
  Success(props: {
13
21
  message: string;
14
22
  state: GravityFormState;
@@ -41,7 +49,7 @@ declare const FORM_COMPONENTS: {
41
49
  SubFieldRow(props: {
42
50
  children: ReactNode;
43
51
  basis?: number;
44
- }): import("react/jsx-runtime").JSX.Element;
52
+ }): import("react/jsx-runtime").JSX.Element | null;
45
53
  SubFieldStack(props: {
46
54
  children: ReactNode;
47
55
  }): import("react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"createGravityFormComponent.d.ts","sourceRoot":"","sources":["../../../../../src/app/lib/integrations/gravityforms/createGravityFormComponent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAA8B,MAAM,OAAO,CAAA;AACxE,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAC/G,OAAO,EAAgB,eAAe,EAAE,iBAAiB,EAAE,MAAM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AC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE;4BAY5E;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE;sBAG7B;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE;mBAGpB;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE;qBAGlC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,OAAO,CAAC;QAAC,SAAS,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,MAAM,IAAI,CAAA;KAAE;CAchG,CAAA;AAED,MAAM,MAAM,cAAc,GAAG,OAAO,eAAe,CAAA;AAEnD,MAAM,MAAM,eAAe,GAAG;KAC3B,CAAC,IAAI,MAAM,OAAO,iBAAiB,CAAC,CAAC,EAAE,CAAC,OAAO,iBAAiB,CAAC,CAAC,CAAC,CAAC,SAAS,eAAe,CAC3F,MAAM,MAAM,EACZ,MAAM,QAAQ,CACf,GACG,CAAC,KAAK,EAAE,sBAAsB,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG;QAAE,cAAc,EAAE,OAAO,eAAe,CAAA;KAAE,KAAK,SAAS,GAC3G,KAAK;CACV,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG,CAAC,KAAK,EAAE;IAAE,KAAK,EAAE,oBAAoB,CAAA;CAAE,KAAK,GAAG,CAAC,OAAO,CAAA;AAE3F,KAAK,UAAU,GAAG;IAChB,cAAc,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAA;IACxC,eAAe,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAA;CAC3C,CAAA;AAED,wBAAgB,0BAA0B,CAAC,IAAI,CAAC,EAAE,UAAU,GAAG,qBAAqB,CAwHnF"}
1
+ {"version":3,"file":"createGravityFormComponent.d.ts","sourceRoot":"","sources":["../../../../../src/app/lib/integrations/gravityforms/createGravityFormComponent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,S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E,KAAK,EAAE,oBAAoB,CAAA;CAAE,KAAK,GAAG,CAAC,OAAO,CAAA;AAE3F,KAAK,UAAU,GAAG;IAChB,cAAc,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAA;IACxC,eAAe,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAA;CAC3C,CAAA;AAED,wBAAgB,0BAA0B,CAAC,IAAI,CAAC,EAAE,UAAU,GAAG,qBAAqB,CAwHnF"}
@@ -5,6 +5,12 @@ const FORM_COMPONENTS = {
5
5
  Form(props) {
6
6
  return (_jsx("form", { className: "edgf-form", onSubmit: props.onSubmit, children: props.children }));
7
7
  },
8
+ Input(props) {
9
+ return _jsx("input", { ...props });
10
+ },
11
+ Select({ choices, ...props }) {
12
+ return (_jsxs("select", { ...props, children: [props.placeholder && _jsx("option", { value: "", children: props.placeholder }), choices.map((choice) => (_jsx("option", { value: choice.value, children: choice.text }, choice.value)))] }));
13
+ },
8
14
  Success(props) {
9
15
  return (_jsxs("div", { className: "edgf-form-success", children: [_jsx("h2", { children: "Thank you for your submission!" }), _jsx("div", { dangerouslySetInnerHTML: { __html: props.message } })] }));
10
16
  },
@@ -21,9 +27,11 @@ const FORM_COMPONENTS = {
21
27
  return (_jsxs("div", { className: `edgf-field edgf-field-${props.field.type} ${props.field.className || ""}`.trim(), children: [props.showLabel ? props.labelElement : null, props.descriptionPlacement === "above" && props.descriptionElement, props.children, props.descriptionPlacement === "below" && props.descriptionElement, props.errorElement] }));
22
28
  },
23
29
  FieldLabel(props) {
24
- return (_jsxs("label", { className: "edgf-field-label", htmlFor: props.htmlFor, children: [props.label, props.isRequired && _jsx("span", { className: "edgf-field-required-indicator" })] }));
30
+ return (_jsxs("label", { className: "edgf-field-label", htmlFor: props.htmlFor, children: [_jsx("span", { dangerouslySetInnerHTML: { __html: props.label } }), props.isRequired && _jsx("span", { className: "edgf-field-required-indicator" })] }));
25
31
  },
26
32
  SubFieldRow(props) {
33
+ if (!props.children || (Array.isArray(props.children) && props.children.length === 0))
34
+ return null;
27
35
  return (_jsx("div", { className: "edgf-subfield-row", style: {
28
36
  "--edgf-subfield-basis": props.basis ?? "auto",
29
37
  }, children: props.children }));
@@ -35,7 +43,7 @@ const FORM_COMPONENTS = {
35
43
  return (_jsxs("div", { className: `edgf-subfield ${props.className ?? ""}`.trim(), children: [props.label && (_jsx("label", { className: "edgf-subfield-label", htmlFor: props.labelId, children: props.label })), props.children] }));
36
44
  },
37
45
  FieldDescription(props) {
38
- return !!props.description && _jsx("div", { className: "edgf-field-description", children: props.description });
46
+ return (!!props.description && (_jsx("div", { className: "edgf-field-description", dangerouslySetInnerHTML: { __html: props.description } })));
39
47
  },
40
48
  FieldError(props) {
41
49
  return !!props.error && _jsx("div", { className: "edgf-field-error", children: props.error });
@@ -1 +1 @@
1
- {"version":3,"file":"field-types.d.ts","sourceRoot":"","sources":["../../../../../src/app/lib/integrations/gravityforms/field-types.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAEzC,MAAM,MAAM,aAAa,GAAG;IAC1B,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAA;CACnC,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,WAAW,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAA;IAClC,YAAY,EAAE,aAAa,GAAG,eAAe,GAAG,cAAc,GAAG,gBAAgB,CAAA;CAClF,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,E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MAAM,CAAA;CAChB,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,aAAa,EAAE,MAAM,CAAA;CACtB,CAAA;AAED,MAAM,MAAM,cAAc,GAAG,MAAM,OAAO,iBAAiB,CAAA;AA8B3D,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;CAosB7B,CAAA;AAED,MAAM,MAAM,UAAU,GAAG,OAAO,iBAAiB,CAAA;AAEjD,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,iBAAiB,CAAA;AAE5D,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,SAAS,CAElF"}
1
+ {"version":3,"file":"field-types.d.ts","sourceRoot":"","sources":["../../../../../src/app/lib/integrations/gravityforms/field-types.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAEzC,MAAM,MAAM,aAAa,GAAG;IAC1B,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAA;CACnC,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,WAAW,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAA;IAClC,YAAY,EAAE,aAAa,GAAG,eAAe,GAAG,cAAc,GAAG,gBAAgB,CAAA;CAClF,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;CAC3C,CAAA;AAED,MAAM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C7B,aAAa,EAAE,MAAM,CAAA;CACtB,CAAA;AAED,MAAM,MAAM,cAAc,GAAG,MAAM,OAAO,iBAAiB,CAAA;AA8B3D,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;CA0rB7B,CAAA;AAED,MAAM,MAAM,UAAU,GAAG,OAAO,iBAAiB,CAAA;AAEjD,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,iBAAiB,CAAA;AAE5D,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,SAAS,CAElF"}
@@ -35,7 +35,7 @@ export const GF_BUILTIN_FIELDS = {
35
35
  }),
36
36
  defaultComponent(props) {
37
37
  const id = useId();
38
- return (_jsx(props.Wrapper, { labelId: id, children: _jsx("input", { id: id, type: "text", required: props.isRequired, name: `field_${props.id}`, disabled: props.disabled, placeholder: props.options?.placeholder || "", value: props.value || "", onChange: (e) => props.set(e.currentTarget.value) }) }));
38
+ return (_jsx(props.Wrapper, { labelId: id, children: _jsx(props.formComponents.Input, { id: id, type: "text", required: props.isRequired, name: `field_${props.id}`, disabled: props.disabled, placeholder: props.options?.placeholder || "", value: props.value || "", onChange: (e) => props.set(e.currentTarget.value) }) }));
39
39
  },
40
40
  }),
41
41
  textarea: defineType({
@@ -58,7 +58,7 @@ export const GF_BUILTIN_FIELDS = {
58
58
  defaultComponent(props) {
59
59
  const id = useId();
60
60
  const isPlaceholder = props.value === "" || props.value == null || props.value === undefined;
61
- return (_jsx(props.Wrapper, { labelId: id, children: _jsxs("select", { id: id, name: `field_${props.id}`, required: props.isRequired, disabled: props.disabled, value: props.value || "", onChange: (e) => props.set(e.target.value), "data-is-placeholder": isPlaceholder ? "" : undefined, children: [isPlaceholder && _jsx("option", { value: "", children: props.placeholder ?? "" }), props.choices.map((choice, index) => (_jsx("option", { value: choice.value, children: choice.text }, index)))] }) }));
61
+ return (_jsx(props.Wrapper, { labelId: id, children: _jsx(props.formComponents.Select, { id: id, name: `field_${props.id}`, required: props.isRequired, disabled: props.disabled, value: props.value || "", onChange: (e) => props.set(e.target.value), "data-is-placeholder": isPlaceholder ? "" : undefined, placeholder: isPlaceholder ? (props.placeholder ?? "") : undefined, choices: props.choices }) }));
62
62
  },
63
63
  }),
64
64
  number: defineType({
@@ -72,7 +72,7 @@ export const GF_BUILTIN_FIELDS = {
72
72
  }),
73
73
  defaultComponent(props) {
74
74
  const id = useId();
75
- return (_jsx(props.Wrapper, { labelId: id, children: _jsx("input", { id: id, type: "number", required: props.isRequired, name: `field_${props.id}`, disabled: props.disabled, placeholder: props.placeholder || "", value: props.value !== undefined && props.value !== null ? props.value : "", min: props.rangeMin, max: props.rangeMax, onChange: (e) => {
75
+ return (_jsx(props.Wrapper, { labelId: id, children: _jsx(props.formComponents.Input, { id: id, type: "number", required: props.isRequired, name: `field_${props.id}`, disabled: props.disabled, placeholder: props.placeholder || "", value: props.value !== undefined && props.value !== null ? props.value : "", min: props.rangeMin, max: props.rangeMax, onChange: (e) => {
76
76
  const number = parseFloat(e.currentTarget.value);
77
77
  props.set(String(number) === e.currentTarget.value ? number : e.currentTarget.value);
78
78
  } }) }));
@@ -92,7 +92,7 @@ export const GF_BUILTIN_FIELDS = {
92
92
  });
93
93
  },
94
94
  defaultComponent(props) {
95
- return (_jsx(props.Wrapper, { children: _jsx("ul", { children: props.choices.map((choice, index) => (_jsx("li", { children: _jsxs("label", { children: [_jsx("input", { type: "checkbox", name: `field_${props.id}[]`, value: choice.value, disabled: props.disabled, checked: props.value?.includes(choice.value), onChange: (e) => {
95
+ return (_jsx(props.Wrapper, { children: _jsx("ul", { children: props.choices.map((choice, index) => (_jsx("li", { children: _jsxs("label", { children: [_jsx(props.formComponents.Input, { type: "checkbox", name: `field_${props.id}[]`, value: choice.value, disabled: props.disabled, checked: props.value?.includes(choice.value), onChange: (e) => {
96
96
  if (e.target.checked) {
97
97
  props.set([...(props.value || []), choice.value]);
98
98
  }
@@ -110,7 +110,7 @@ export const GF_BUILTIN_FIELDS = {
110
110
  columns: field.columns ? Number(field.columns) : undefined,
111
111
  }),
112
112
  defaultComponent(props) {
113
- return (_jsx(props.Wrapper, { children: _jsx("ul", { children: props.choices.map((choice, index) => (_jsx("li", { children: _jsxs("label", { children: [_jsx("input", { type: "radio", name: `field_${props.id}`, value: choice.value, disabled: props.disabled, checked: props.value === choice.value, onChange: (e) => {
113
+ return (_jsx(props.Wrapper, { children: _jsx("ul", { children: props.choices.map((choice, index) => (_jsx("li", { children: _jsxs("label", { children: [_jsx(props.formComponents.Input, { type: "radio", name: `field_${props.id}`, value: choice.value, disabled: props.disabled, checked: props.value === choice.value, onChange: (e) => {
114
114
  props.set(choice.value);
115
115
  } }), _jsx("span", { children: choice.text })] }) }, index))) }) }));
116
116
  },
@@ -198,12 +198,12 @@ export const GF_BUILTIN_FIELDS = {
198
198
  for (const subfield of Object.values(props.subfields)) {
199
199
  if (!subfield.visible)
200
200
  continue;
201
- fields.push(_jsx(props.formComponents.SubFieldWrapper, { label: subfield.label, labelId: id + subfield.name, children: subfield.choices?.length ? (_jsxs("select", { id: id + subfield.name, name: `field_${props.id}_${subfield.name}`, disabled: props.disabled, value: props.value?.[subfield.name] || "", onChange: (e) => {
201
+ fields.push(_jsx(props.formComponents.SubFieldWrapper, { label: subfield.label, labelId: id + subfield.name, children: subfield.choices?.length ? (_jsx(props.formComponents.Select, { id: id + subfield.name, name: `field_${props.id}_${subfield.name}`, disabled: props.disabled, value: props.value?.[subfield.name] || "", onChange: (e) => {
202
202
  props.set({
203
203
  ...(props.value || {}),
204
204
  [subfield.name]: e.target.value,
205
205
  });
206
- }, children: [_jsx("option", { value: "", children: subfield.placeholder }), subfield.choices.map((choice, index) => (_jsx("option", { value: choice.value, children: choice.text }, index)))] })) : (_jsx("input", { id: id + subfield.name, type: "text", name: `field_${props.id}_${subfield.name}`, disabled: props.disabled, placeholder: subfield.placeholder, value: props.value?.[subfield.name] || "", autoComplete: subfield.autocomplete, onChange: (e) => {
206
+ }, placeholder: subfield.placeholder || "", choices: subfield.choices })) : (_jsx(props.formComponents.Input, { id: id + subfield.name, type: "text", name: `field_${props.id}_${subfield.name}`, disabled: props.disabled, placeholder: subfield.placeholder, value: props.value?.[subfield.name] || "", autoComplete: subfield.autocomplete, onChange: (e) => {
207
207
  props.set({
208
208
  ...(props.value || {}),
209
209
  [subfield.name]: e.currentTarget.value,
@@ -220,7 +220,7 @@ export const GF_BUILTIN_FIELDS = {
220
220
  },
221
221
  defaultComponent(props) {
222
222
  const id = useId();
223
- return (_jsx(props.Wrapper, { labelId: id, children: _jsx("input", { type: "date", id: id, name: `field_${props.id}`, required: props.isRequired, disabled: props.disabled, placeholder: props.options?.placeholder || "", value: props.value || "", onChange: (e) => props.set(e.currentTarget.value) }) }));
223
+ return (_jsx(props.Wrapper, { labelId: id, children: _jsx(props.formComponents.Input, { type: "date", id: id, name: `field_${props.id}`, required: props.isRequired, disabled: props.disabled, placeholder: props.options?.placeholder || "", value: props.value || "", onChange: (e) => props.set(e.currentTarget.value) }) }));
224
224
  },
225
225
  }),
226
226
  time: defineType({
@@ -230,7 +230,7 @@ export const GF_BUILTIN_FIELDS = {
230
230
  },
231
231
  defaultComponent(props) {
232
232
  const id = useId();
233
- return (_jsx(props.Wrapper, { labelId: id, children: _jsx("input", { type: "time", id: id, name: `field_${props.id}`, required: props.isRequired, disabled: props.disabled, placeholder: props.options?.placeholder || "", value: props.value || "", onChange: (e) => props.set(e.currentTarget.value) }) }));
233
+ return (_jsx(props.Wrapper, { labelId: id, children: _jsx(props.formComponents.Input, { type: "time", id: id, name: `field_${props.id}`, required: props.isRequired, disabled: props.disabled, placeholder: props.options?.placeholder || "", value: props.value || "", onChange: (e) => props.set(e.currentTarget.value) }) }));
234
234
  },
235
235
  }),
236
236
  phone: defineType({
@@ -240,7 +240,7 @@ export const GF_BUILTIN_FIELDS = {
240
240
  },
241
241
  defaultComponent(props) {
242
242
  const id = useId();
243
- return (_jsx(props.Wrapper, { labelId: id, children: _jsx("input", { type: "tel", id: id, name: `field_${props.id}`, required: props.isRequired, disabled: props.disabled, placeholder: props.options?.placeholder || "", value: props.value || "", onChange: (e) => props.set(e.currentTarget.value) }) }));
243
+ return (_jsx(props.Wrapper, { labelId: id, children: _jsx(props.formComponents.Input, { type: "tel", id: id, name: `field_${props.id}`, required: props.isRequired, disabled: props.disabled, placeholder: props.options?.placeholder || "", value: props.value || "", onChange: (e) => props.set(e.currentTarget.value) }) }));
244
244
  },
245
245
  }),
246
246
  address: defineType({
@@ -291,7 +291,7 @@ export const GF_BUILTIN_FIELDS = {
291
291
  for (const subfield of Object.values(props.subfields)) {
292
292
  if (!subfield.visible)
293
293
  continue;
294
- fields[subfield.name] = (_jsx(props.formComponents.SubFieldWrapper, { label: subfield.label, labelId: id + subfield.name, children: _jsx("input", { id: id + subfield.name, type: "text", name: `field_${props.id}_${subfield.name}`, disabled: props.disabled, placeholder: subfield.placeholder, autoComplete: subfield.autocomplete, value: props.value?.[subfield.name] || "", "data-address-component": subfield.name, onChange: (e) => {
294
+ fields[subfield.name] = (_jsx(props.formComponents.SubFieldWrapper, { label: subfield.label, labelId: id + subfield.name, children: _jsx(props.formComponents.Input, { id: id + subfield.name, type: "text", name: `field_${props.id}_${subfield.name}`, disabled: props.disabled, placeholder: subfield.placeholder, autoComplete: subfield.autocomplete, value: props.value?.[subfield.name] || "", "data-address-component": subfield.name, onChange: (e) => {
295
295
  props.set({
296
296
  ...(props.value || {}),
297
297
  [subfield.name]: e.currentTarget.value,
@@ -312,7 +312,7 @@ export const GF_BUILTIN_FIELDS = {
312
312
  },
313
313
  defaultComponent(props) {
314
314
  const id = useId();
315
- return (_jsx(props.Wrapper, { labelId: id, children: _jsx("input", { id: id, type: "url", name: `field_${props.id}`, required: props.isRequired, disabled: props.disabled, placeholder: props.options?.placeholder || "", value: props.value || "", onChange: (e) => props.set(e.currentTarget.value) }) }));
315
+ return (_jsx(props.Wrapper, { labelId: id, children: _jsx(props.formComponents.Input, { id: id, type: "url", name: `field_${props.id}`, required: props.isRequired, disabled: props.disabled, placeholder: props.options?.placeholder || "", value: props.value || "", onChange: (e) => props.set(e.currentTarget.value) }) }));
316
316
  },
317
317
  }),
318
318
  email: defineType({
@@ -344,19 +344,19 @@ export const GF_BUILTIN_FIELDS = {
344
344
  const id = useId();
345
345
  if (props.confirmation.enabled) {
346
346
  const value = typeof props.value === "object" ? props.value : { email: props.value || "", confirmEmail: "" };
347
- return (_jsx(props.Wrapper, { children: _jsxs(props.formComponents.SubFieldRow, { children: [_jsx(props.formComponents.SubFieldWrapper, { label: props.confirmation.emailLabel || "Email", labelId: id + "_email", children: _jsx("input", { type: "email", id: id + "_email", required: props.isRequired, name: `field_${props.id}_email`, disabled: props.disabled, placeholder: props.confirmation.emailPlaceholder || "", value: typeof props.value === "object" ? props.value.email : props.value || "", onChange: (e) => {
347
+ return (_jsx(props.Wrapper, { children: _jsxs(props.formComponents.SubFieldRow, { children: [_jsx(props.formComponents.SubFieldWrapper, { label: props.confirmation.emailLabel || "Email", labelId: id + "_email", children: _jsx(props.formComponents.Input, { type: "email", id: id + "_email", required: props.isRequired, name: `field_${props.id}_email`, disabled: props.disabled, placeholder: props.confirmation.emailPlaceholder || "", value: typeof props.value === "object" ? props.value.email : props.value || "", onChange: (e) => {
348
348
  props.set({
349
349
  email: e.currentTarget.value,
350
350
  confirmEmail: value.confirmEmail,
351
351
  });
352
- } }) }), _jsx(props.formComponents.SubFieldWrapper, { label: props.confirmation.confirmLabel || "Confirm Email", labelId: id + "_confirm", children: _jsx("input", { type: "email", id: id + "_confirm", required: props.isRequired, name: `field_${props.id}_email`, disabled: props.disabled, placeholder: props.confirmation.confirmPlaceholder || "", value: typeof props.value === "object" ? props.value.confirmEmail : props.value || "", onChange: (e) => {
352
+ } }) }), _jsx(props.formComponents.SubFieldWrapper, { label: props.confirmation.confirmLabel || "Confirm Email", labelId: id + "_confirm", children: _jsx(props.formComponents.Input, { type: "email", id: id + "_confirm", required: props.isRequired, name: `field_${props.id}_email`, disabled: props.disabled, placeholder: props.confirmation.confirmPlaceholder || "", value: typeof props.value === "object" ? props.value.confirmEmail : props.value || "", onChange: (e) => {
353
353
  props.set({
354
354
  email: value.email,
355
355
  confirmEmail: e.currentTarget.value,
356
356
  });
357
357
  } }) })] }) }));
358
358
  }
359
- return (_jsx(props.Wrapper, { labelId: id, children: _jsx("input", { type: "email", id: id, name: `field_${props.id}`, required: props.isRequired, disabled: props.disabled, placeholder: props.options?.placeholder || "", value: typeof props.value === "object" ? props.value.email : props.value || "", onChange: (e) => props.set(e.currentTarget.value) }) }));
359
+ return (_jsx(props.Wrapper, { labelId: id, children: _jsx(props.formComponents.Input, { type: "email", id: id, name: `field_${props.id}`, required: props.isRequired, disabled: props.disabled, placeholder: props.options?.placeholder || "", value: typeof props.value === "object" ? props.value.email : props.value || "", onChange: (e) => props.set(e.currentTarget.value) }) }));
360
360
  },
361
361
  }),
362
362
  fileupload: defineType({
@@ -385,7 +385,7 @@ export const GF_BUILTIN_FIELDS = {
385
385
  },
386
386
  defaultComponent(props) {
387
387
  const id = useId();
388
- return (_jsx(props.Wrapper, { labelId: id, children: _jsx("input", { type: "file", id: id, name: `field_${props.id}${props.multiple ? "[]" : ""}`, required: props.isRequired, disabled: props.disabled, multiple: props.multiple, accept: props.allowedExtensions?.map((ext) => `.${ext}`).join(","), onChange: (e) => {
388
+ return (_jsx(props.Wrapper, { labelId: id, children: _jsx(props.formComponents.Input, { type: "file", id: id, name: `field_${props.id}${props.multiple ? "[]" : ""}`, required: props.isRequired, disabled: props.disabled, multiple: props.multiple, accept: props.allowedExtensions?.map((ext) => `.${ext}`).join(","), onChange: (e) => {
389
389
  if (props.multiple) {
390
390
  props.set(e.currentTarget.files ?? undefined);
391
391
  }
@@ -416,7 +416,7 @@ export const GF_BUILTIN_FIELDS = {
416
416
  },
417
417
  defaultComponent(props) {
418
418
  const id = useId();
419
- return (_jsx(props.Wrapper, { descriptionElement: null, showLabel: false, children: _jsxs("div", { className: "edgf-consent-field", children: [_jsx("input", { type: "checkbox", name: `field_${props.id}`, required: props.isRequired, disabled: props.disabled, checked: props.value || false, onChange: (e) => props.set(e.target.checked), id: id }), _jsx("label", { htmlFor: id, className: "edgf-consent-label", dangerouslySetInnerHTML: { __html: props.checkboxLabel || "I Agree" } }), !!props.description && (_jsx("div", { className: "edgf-consent-agreement", dangerouslySetInnerHTML: { __html: props.description || "" } }))] }) }));
419
+ return (_jsx(props.Wrapper, { descriptionElement: null, showLabel: false, children: _jsxs("div", { className: "edgf-consent-field", children: [_jsx(props.formComponents.Input, { type: "checkbox", name: `field_${props.id}`, required: props.isRequired, disabled: props.disabled, checked: props.value || false, onChange: (e) => props.set(e.target.checked), id: id }), _jsx("label", { htmlFor: id, className: "edgf-consent-label", dangerouslySetInnerHTML: { __html: props.checkboxLabel || "I Agree" } }), !!props.description && (_jsx("div", { className: "edgf-consent-agreement", dangerouslySetInnerHTML: { __html: props.description || "" } }))] }) }));
420
420
  },
421
421
  }),
422
422
  captcha: defineType({
@@ -1 +1 @@
1
- {"version":3,"file":"useGravityForm.d.ts","sourceRoot":"","sources":["../../../../../src/app/lib/integrations/gravityforms/useGravityForm.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkB,eAAe,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAE/E,KAAK,OAAO,GAAG;IACb,IAAI,EAAE,eAAe,CAAA;IACrB,WAAW,CAAC,EAAE;QACZ,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KACnB,CAAA;CACF,CAAA;AAsBD,MAAM,MAAM,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAA;AAEpE,MAAM,MAAM,sBAAsB,CAAC,CAAC,GAAG,GAAG,EAAE,MAAM,GAAG,EAAE,IAAI,iBAAiB,GAAG;IAC7E,KAAK,EAAE,CAAC,GAAG,SAAS,CAAA;IACpB,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB,GAAG,CAAC,KAAK,E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EAmTF;AAED,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAA"}
1
+ {"version":3,"file":"useGravityForm.d.ts","sourceRoot":"","sources":["../../../../../src/app/lib/integrations/gravityforms/useGravityForm.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkB,eAAe,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAE/E,KAAK,OAAO,GAAG;IACb,IAAI,EAAE,eAAe,CAAA;IACrB,WAAW,CAAC,EAAE;QACZ,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KACnB,CAAA;CACF,CAAA;AAsBD,MAAM,MAAM,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAA;AAEpE,MAAM,MAAM,sBAAsB,CAAC,CAAC,GAAG,GAAG,EAAE,MAAM,GAAG,EAAE,IAAI,iBAAiB,GAAG;IAC7E,KAAK,EAAE,CAAC,GAAG,SAAS,CAAA;IACpB,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,SAAS,GAAG,IAAI,CAAA;CAChC,GAAG,MAAM,CAAA;AAEV,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,QAAQ,CAAA;IACd,MAAM,EAAE,sBAAsB,EAAE,CAAA;CACjC,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,SAAS,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,YAAY,GACpB;IACE,IAAI,EAAE,QAAQ,CAAA;IACd,MAAM,EAAE,sBAAsB,EAAE,CAAA;CACjC,GACD;IACE,IAAI,EAAE,SAAS,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAEL,MAAM,MAAM,YAAY,GACpB;IACE,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,YAAY,EAAE,CAAA;CACtB,GACD;IACE,IAAI,EAAE,SAAS,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AA4HL,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO;;;gBAhLhC,MAAM;;;;;;oBAsSE,MAAM;;YAWZ,YAAY;;oBAQN,MAAM,SAAS,GAAG;gBAhUxB,OAAO;cACT,OAAO;oBACD,MAAM,GAAG,IAAI;eAClB,MAAM,GAAG,IAAI;eACb,OAAO;UACZ,MAAM;WACL;QACL,KAAK,CAAC,EAAE,MAAM,CAAA;KACf,EAAE;YACK;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE;YACtB;QACN,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;KAClC;cACS;QACR,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KACvB;EAqTF;AAED,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAA"}
@@ -189,11 +189,12 @@ export function useGravityForm(opts) {
189
189
  dispatch({ type: "goToPage", number: firstErrorPage });
190
190
  }
191
191
  }, [JSON.stringify(state.errors)]);
192
+ console.log("State is", state);
192
193
  return {
193
194
  ...state,
194
195
  submitLabel: state.page < state.pages.length - 1 ? "Next" : state.submitLabel || "Submit",
195
196
  pageInfo: state.complete ? null : state.pages[state.page],
196
- canGoBack: state.page > 0,
197
+ canGoBack: state.page > 0 && !state.complete,
197
198
  canGoForward: state.page < state.pages.length - 1,
198
199
  goBack: state.page > 0 ? () => dispatch({ type: "goToPage", number: state.page - 1 }) : null,
199
200
  goForward: state.page < state.pages.length - 1 ? () => dispatch({ type: "goToPage", number: state.page + 1 }) : null,
@@ -210,7 +211,7 @@ export function useGravityForm(opts) {
210
211
  items: fieldsLayout,
211
212
  }),
212
213
  submit() {
213
- if (state.page === form.pagination?.pages.length - 1) {
214
+ if (state.page === form.pagination?.pages.length - 1 || !form.pagination?.pages.length) {
214
215
  submitter?.submit(state);
215
216
  }
216
217
  else {
@@ -1 +1 @@
1
- {"version":3,"file":"replace-host.d.ts","sourceRoot":"","sources":["../../../../src/app/server/utils/replace-host.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,EAAE,MAAM,CAAA;IACV,0FAA0F;IAC1F,QAAQ,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,EAAE,CAAA;CACjD,CAAA;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,eAAe,IAI7C,MAAM,MAAM,EAAE,YAAY,MAAM,YAiEzC"}
1
+ {"version":3,"file":"replace-host.d.ts","sourceRoot":"","sources":["../../../../src/app/server/utils/replace-host.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,EAAE,MAAM,CAAA;IACV,0FAA0F;IAC1F,QAAQ,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,EAAE,CAAA;CACjD,CAAA;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,eAAe,IAI7C,MAAM,MAAM,EAAE,YAAY,MAAM,YAgCzC"}
@@ -31,39 +31,6 @@ export function createUrlReplacer(conf) {
31
31
  }
32
32
  }
33
33
  return path;
34
- // if (path.startsWith("/wp-content/uploads/")) {
35
- // if (!conf.ignoreUploads) {
36
- // return path
37
- // } else {
38
- // return url
39
- // }
40
- // // } else if (path.startsWith("/wp-content/themes/")) {
41
- // // if (settings?.uploads === "proxy") {
42
- // // return path
43
- // // } else if (settings?.uploads === "remote") {
44
- // // return url
45
- // // }
46
- // // } else if (path.startsWith("/wp-content/plugins/")) {
47
- // // if (settings?.uploads === "proxy") {
48
- // // return path
49
- // // } else if (settings?.uploads === "remote") {
50
- // // return url
51
- // // }
52
- // } else {
53
- // return path
54
- // }
55
34
  });
56
35
  };
57
- // const from = conf.from
58
- // const to = conf.to
59
- // const https = conf.https
60
- // const ignoreUploads = conf.ignoreUploads
61
- // const ignorePlugins = conf.ignorePlugins
62
- // const replaceTargetString = from.replaceAll(/https?:/g, "https?:").replaceAll("/", "\\/")
63
- // const replaceTargetEscapedString = from.replaceAll(/https?:/g, "https?:").replaceAll("/", "\\\\/")
64
- // const replaceTarget = new RegExp(replaceTargetString, "g")
65
- // const replaceTargetEscaped = new RegExp(replaceTargetEscapedString, "g")
66
- // return (value: string) => {
67
- // return value.replaceAll(replaceTarget, to).replace(replaceTargetEscaped, to.replaceAll("/", "\\/"))
68
- // }
69
36
  }
@@ -31,6 +31,13 @@ const program = new Command()
31
31
  const init = (verbose) => {
32
32
  console.log(`\n<⚡️ ED. Stack v${VERSION}>\n`);
33
33
  };
34
+ program.command("create-favicons").action(async () => {
35
+ const project = await Project.create({
36
+ rootDir: process.cwd(),
37
+ });
38
+ const { buildFavicons } = await import("../project/favicons.js");
39
+ await buildFavicons(project.rootDir, project.config?.favicon);
40
+ });
34
41
  program
35
42
  .command("dev")
36
43
  .description("Run in dev mode")
@@ -94,6 +101,14 @@ program
94
101
  rootDir: process.cwd(),
95
102
  reportPluginCompatibility: true,
96
103
  });
104
+ async function buildFavicons() {
105
+ try {
106
+ const { buildFavicons } = await import("../project/favicons.js");
107
+ await buildFavicons(project.rootDir, project.config?.favicon);
108
+ }
109
+ catch (e) { }
110
+ }
111
+ buildFavicons();
97
112
  // const result = await project.verifyOriginAccess()
98
113
  // if (!result.success) {
99
114
  // projectLog.fail(result.message)
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "2.2.0-beta.2";
1
+ export declare const VERSION = "2.2.0-beta.4";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- export const VERSION = "2.2.0-beta.2";
1
+ export const VERSION = "2.2.0-beta.4";
@@ -1,32 +1,58 @@
1
1
  import { z } from "zod";
2
2
  import { Project } from "./project.js";
3
3
  export declare const EDCacheConfigSchema: z.ZodObject<{
4
- wordpress: z.ZodDefault<z.ZodOptional<z.ZodObject<{
5
- strategy: z.ZodOptional<z.ZodEnum<{
4
+ wordpress: z.ZodDefault<z.ZodObject<{
5
+ strategy: z.ZodEnum<{
6
6
  always: "always";
7
7
  "ssr-always-fresh": "ssr-always-fresh";
8
- }>>;
8
+ }>;
9
9
  cacheHeaders: z.ZodDefault<z.ZodBoolean>;
10
10
  transients: z.ZodDefault<z.ZodBoolean>;
11
- }, z.core.$strip>>>;
12
- serverless: z.ZodDefault<z.ZodOptional<z.ZodObject<{
13
- isr: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
11
+ }, z.core.$strip>>;
12
+ serverless: z.ZodDefault<z.ZodObject<{
13
+ isr: z.ZodDefault<z.ZodBoolean>;
14
14
  dataCache: z.ZodDefault<z.ZodEnum<{
15
15
  none: "none";
16
16
  "in-memory": "in-memory";
17
17
  kv: "kv";
18
18
  }>>;
19
- }, z.core.$strip>>>;
19
+ }, z.core.$strip>>;
20
20
  pageDataTTL: z.ZodDefault<z.ZodNumber>;
21
21
  appDataTTL: z.ZodDefault<z.ZodNumber>;
22
22
  queryHooksTTL: z.ZodDefault<z.ZodNumber>;
23
23
  }, z.core.$strip>;
24
+ export declare const EDFaviconConfigSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
25
+ mode: z.ZodLiteral<"auto">;
26
+ }, z.core.$strip>, z.ZodObject<{
27
+ mode: z.ZodLiteral<"svg">;
28
+ default: z.ZodDefault<z.ZodString>;
29
+ light: z.ZodDefault<z.ZodString>;
30
+ dark: z.ZodDefault<z.ZodString>;
31
+ }, z.core.$strip>, z.ZodObject<{
32
+ mode: z.ZodLiteral<"pngs">;
33
+ default: z.ZodDefault<z.ZodString>;
34
+ light: z.ZodDefault<z.ZodString>;
35
+ dark: z.ZodDefault<z.ZodString>;
36
+ }, z.core.$strip>], "mode">;
24
37
  export declare const EDConfigSchema: z.ZodObject<{
25
38
  $schema: z.ZodOptional<z.ZodString>;
26
39
  version: z.ZodEnum<{
27
40
  1: "1";
28
41
  2: "2";
29
42
  }>;
43
+ favicon: z.ZodOptional<z.ZodDefault<z.ZodDiscriminatedUnion<[z.ZodObject<{
44
+ mode: z.ZodLiteral<"auto">;
45
+ }, z.core.$strip>, z.ZodObject<{
46
+ mode: z.ZodLiteral<"svg">;
47
+ default: z.ZodDefault<z.ZodString>;
48
+ light: z.ZodDefault<z.ZodString>;
49
+ dark: z.ZodDefault<z.ZodString>;
50
+ }, z.core.$strip>, z.ZodObject<{
51
+ mode: z.ZodLiteral<"pngs">;
52
+ default: z.ZodDefault<z.ZodString>;
53
+ light: z.ZodDefault<z.ZodString>;
54
+ dark: z.ZodDefault<z.ZodString>;
55
+ }, z.core.$strip>], "mode">>>;
30
56
  legacyMetadata: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
31
57
  legacyStitches: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
32
58
  trackers: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -67,22 +93,22 @@ export declare const EDConfigSchema: z.ZodObject<{
67
93
  }, z.core.$strip>>;
68
94
  }, z.core.$strip>;
69
95
  cache: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
70
- wordpress: z.ZodDefault<z.ZodOptional<z.ZodObject<{
71
- strategy: z.ZodOptional<z.ZodEnum<{
96
+ wordpress: z.ZodDefault<z.ZodObject<{
97
+ strategy: z.ZodEnum<{
72
98
  always: "always";
73
99
  "ssr-always-fresh": "ssr-always-fresh";
74
- }>>;
100
+ }>;
75
101
  cacheHeaders: z.ZodDefault<z.ZodBoolean>;
76
102
  transients: z.ZodDefault<z.ZodBoolean>;
77
- }, z.core.$strip>>>;
78
- serverless: z.ZodDefault<z.ZodOptional<z.ZodObject<{
79
- isr: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
103
+ }, z.core.$strip>>;
104
+ serverless: z.ZodDefault<z.ZodObject<{
105
+ isr: z.ZodDefault<z.ZodBoolean>;
80
106
  dataCache: z.ZodDefault<z.ZodEnum<{
81
107
  none: "none";
82
108
  "in-memory": "in-memory";
83
109
  kv: "kv";
84
110
  }>>;
85
- }, z.core.$strip>>>;
111
+ }, z.core.$strip>>;
86
112
  pageDataTTL: z.ZodDefault<z.ZodNumber>;
87
113
  appDataTTL: z.ZodDefault<z.ZodNumber>;
88
114
  queryHooksTTL: z.ZodDefault<z.ZodNumber>;
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/node/project/config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,OAAO,EAAE,OAAO,EAAyB,MAAM,cAAc,CAAA;AAE7D,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;iBA8B9B,CAAA;AAEF,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAuHzB,CAAA;AAEF,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAA;AACrD,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAE/D,qBAAa,YAAY;IAGI,OAAO,EAAE,OAAO;IAF3C,MAAM,CAAC,EAAE,QAAQ,CAAA;IAEjB,OAAO;WAEM,MAAM,CAAC,OAAO,EAAE,OAAO;IAM9B,IAAI;YAQI,kBAAkB;YAYlB,UAAU;IAiCxB,OAAO,CAAC,WAAW;IAOnB,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO;CAUzD"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/node/project/config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,OAAO,EAAE,OAAO,EAAyB,MAAM,cAAc,CAAA;AAE7D,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;iBAqB9B,CAAA;AAqBF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;2BAwChC,CAAA;AAEF,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAwHzB,CAAA;AAEF,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAA;AACrD,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAE/D,qBAAa,YAAY;IAGI,OAAO,EAAE,OAAO;IAF3C,MAAM,CAAC,EAAE,QAAQ,CAAA;IAEjB,OAAO;WAEM,MAAM,CAAC,OAAO,EAAE,OAAO;IAM9B,IAAI;YAQI,kBAAkB;YAclB,UAAU;IAiCxB,OAAO,CAAC,WAAW;IAOnB,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO;CAUzD"}
@@ -9,36 +9,81 @@ export const EDCacheConfigSchema = z.object({
9
9
  wordpress: z
10
10
  .object({
11
11
  /** @deprecated */
12
- strategy: z
13
- .enum(["always", "ssr-always-fresh"])
14
- .optional()
15
- .describe("Deprecated. Use cacheHeaders/transients instead."),
12
+ strategy: z.enum(["always", "ssr-always-fresh"]).describe("Deprecated. Use cacheHeaders/transients instead."),
16
13
  cacheHeaders: z.boolean().default(true).describe("Whether to add caching headers to data requests."),
17
14
  transients: z.boolean().default(true).describe("Whether to cache within transients."),
18
15
  })
19
- .optional()
20
16
  .default({ strategy: "always", cacheHeaders: true, transients: true }),
21
17
  serverless: z
22
18
  .object({
23
- isr: z
24
- .boolean()
25
- .optional()
26
- .default(true)
27
- .describe("Whether to use Incremental Static Regeneration for this origin."),
19
+ isr: z.boolean().default(true).describe("Whether to use Incremental Static Regeneration for this origin."),
28
20
  dataCache: z
29
21
  .enum(["in-memory", "kv", "none"])
30
22
  .default("in-memory")
31
23
  .describe("The cache strategy to use for page data."),
32
24
  })
33
- .optional()
34
25
  .default({ isr: true, dataCache: "in-memory" }),
35
26
  pageDataTTL: z.number().default(300).describe("The number of seconds to cache page data."),
36
27
  appDataTTL: z.number().default(300).describe("The number of seconds to cache global app data."),
37
28
  queryHooksTTL: z.number().default(300).describe("The number of seconds to cache named GraphQL queries."),
38
29
  });
30
+ const faviconMods = `
31
+ The favicon generation mode.
32
+
33
+ "svg" — Use a single SVG file as the source for generating favicons.
34
+ - The default will be \`/assets/favicon.svg\`
35
+ - The .svg will be served via a link tag for modern browsers.
36
+ - You can optionally specify light and dark mode variants.
37
+ - A raster .ico file will be generated from the SVG for maximum compatibility. If light and dark variants are provided, the .ico will prefer either the 'file' or 'light' variant.
38
+
39
+ "pngs" — Use multiple PNG files as the source for generating favicons.
40
+ - The PNG files will be collected from the glob pattern, default "/assets/favicon/favicon-*.png".
41
+ - The PNG files will be served via link tags for maximum compatibility.
42
+ - A raster .ico file will be generated from the PNGs for maximum compatibility.
43
+
44
+ "auto" — Disable .ico generation, and use WordPress' built-in favicon handling via the Site Icon feature.
45
+ - You must provide your own favicons via the WordPress admin.
46
+ - No favicons will be generated during the build process.
47
+ `.trim();
48
+ export const EDFaviconConfigSchema = z.discriminatedUnion("mode", [
49
+ z.object({
50
+ mode: z.literal("auto").describe(faviconMods),
51
+ }),
52
+ z.object({
53
+ mode: z.literal("svg").describe(faviconMods),
54
+ default: z
55
+ .string()
56
+ .describe("The SVG file to use as a favicon. Defaults to '/assets/favicon.svg'")
57
+ .default("/assets/favicon.svg"),
58
+ light: z
59
+ .string()
60
+ .describe("The SVG file to use as a light-mode favicon, where supported. Defaults to '/assets/favicon-light.svg'")
61
+ .default("/assets/favicon-light.svg"),
62
+ dark: z
63
+ .string()
64
+ .describe("The SVG file to use as a dark-mode favicon, where supported. Defaults to '/assets/favicon-dark.svg'")
65
+ .default("/assets/favicon-dark.svg"),
66
+ }),
67
+ z.object({
68
+ mode: z.literal("pngs").describe(faviconMods),
69
+ default: z
70
+ .string()
71
+ .describe("The glob pattern to use to find PNG files for favicon generation. Defaults to '/assets/favicon/favicon-*.png'")
72
+ .default("/assets/favicon/favicon-*.png"),
73
+ light: z
74
+ .string()
75
+ .describe("The SVG file to use as a light-mode favicon, where supported. Defaults to '/assets/favicon/favicon-*-light.png'")
76
+ .default("/assets/favicon/favicon-*-light.png"),
77
+ dark: z
78
+ .string()
79
+ .describe("The SVG file to use as a dark-mode favicon, where supported. Defaults to '/assets/favicon/favicon-*-dark.png'")
80
+ .default("/assets/favicon/favicon-*-dark.png"),
81
+ }),
82
+ ]);
39
83
  export const EDConfigSchema = z.object({
40
84
  $schema: z.string().optional(),
41
85
  version: z.enum(["1", "2"]).refine((v) => v === "2", { message: "Only version 2 is supported" }),
86
+ favicon: EDFaviconConfigSchema.describe("Favicon handling configuration").default({ mode: "auto" }).optional(),
42
87
  legacyMetadata: z
43
88
  .boolean()
44
89
  .optional()
@@ -159,7 +204,9 @@ export class Configurator {
159
204
  return;
160
205
  console.verbose("Ensuring config schema exists...");
161
206
  const schemaPath = path.resolve(this.project.rootDir, ".ed.config.schema.json");
162
- const didChange = await fs.writeJsonIfUnchanged(schemaPath, z.toJSONSchema(EDConfigSchema)).catch((err) => {
207
+ const didChange = await fs
208
+ .writeJsonIfUnchanged(schemaPath, z.toJSONSchema(EDConfigSchema, { io: "input" }))
209
+ .catch((err) => {
163
210
  console.error("Failed to write config schema file:\n", err);
164
211
  });
165
212
  if (didChange) {
@@ -1 +1,6 @@
1
+ import z from "zod";
2
+ import { EDFaviconConfigSchema } from "./config";
3
+ type Config = z.infer<typeof EDFaviconConfigSchema>;
4
+ export declare function buildFavicons(rootDir: string, config: Config): Promise<void>;
5
+ export {};
1
6
  //# sourceMappingURL=favicons.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"favicons.d.ts","sourceRoot":"","sources":["../../../src/node/project/favicons.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"favicons.d.ts","sourceRoot":"","sources":["../../../src/node/project/favicons.ts"],"names":[],"mappings":"AAKA,OAAO,CAAC,MAAM,KAAK,CAAA;AACnB,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAA;AAUhD,KAAK,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAEnD,wBAAsB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,iBAiElE"}
@@ -1 +1,133 @@
1
- "use strict";
1
+ import ico from "sharp-ico";
2
+ import sharp from "sharp";
3
+ import * as fs from "fs/promises";
4
+ import { globby } from "globby";
5
+ import { join } from "path";
6
+ export async function buildFavicons(rootDir, config) {
7
+ // Clear the favicon directory
8
+ await fs.rm(join(rootDir, "assets/favicon-out/"), { recursive: true }).catch(() => { });
9
+ await fs.mkdir(join(rootDir, "assets/favicon-out/"), { recursive: true });
10
+ // If 'auto' mode is used, do nothing
11
+ if (config.mode === "auto")
12
+ return;
13
+ await fs.rm(join(rootDir, "favicon.ico")).catch(() => { });
14
+ if (config.mode === "svg") {
15
+ let svgFavicon = "";
16
+ const defaultFavicon = config.default
17
+ ? await fs.readFile(join(rootDir, config.default), "utf-8").catch(() => null)
18
+ : null;
19
+ const lightFavicon = config.light ? await fs.readFile(join(rootDir, config.light), "utf-8").catch(() => null) : null;
20
+ const darkFavicon = config.dark ? await fs.readFile(join(rootDir, config.dark), "utf-8").catch(() => null) : null;
21
+ if (lightFavicon && darkFavicon) {
22
+ svgFavicon = mergeSVGIcons(lightFavicon, darkFavicon);
23
+ }
24
+ else if (defaultFavicon) {
25
+ svgFavicon = defaultFavicon;
26
+ }
27
+ else if (lightFavicon) {
28
+ svgFavicon = lightFavicon;
29
+ }
30
+ else if (darkFavicon) {
31
+ svgFavicon = darkFavicon;
32
+ }
33
+ if (svgFavicon) {
34
+ await fs.writeFile(join(rootDir, "assets/favicon-out/", "favicon.svg"), svgFavicon, "utf-8");
35
+ }
36
+ // Create SVG favicons
37
+ }
38
+ // Create .ico file if configured
39
+ {
40
+ const icoPatterns = [config.default, config.light, config.dark];
41
+ let icoSources = [];
42
+ for (const pattern of icoPatterns) {
43
+ if (!pattern)
44
+ continue;
45
+ const files = await globby(join(rootDir, pattern));
46
+ if (files.length === 0)
47
+ continue;
48
+ if (icoSources.length === 0) {
49
+ icoSources = files;
50
+ }
51
+ else {
52
+ icoSources = icoSources.filter((f) => !files.includes(f));
53
+ }
54
+ }
55
+ if (icoSources.length === 0)
56
+ return;
57
+ let validSources = icoSources.map((file) => sharp(file));
58
+ if (validSources.length > 0) {
59
+ // If any source is larger than 256x256, resize it
60
+ validSources = await Promise.all(validSources.map(async (source) => {
61
+ const metadata = await source.metadata();
62
+ if ((metadata.width && metadata.width > 256) || (metadata.height && metadata.height > 256)) {
63
+ return source.resize(256, 256, { fit: "inside" });
64
+ }
65
+ return source;
66
+ }));
67
+ await ico.sharpsToIco(validSources, join(rootDir, "assets/favicon-out//favicon.ico"));
68
+ }
69
+ }
70
+ }
71
+ function mergeSVGIcons(light, dark) {
72
+ const lightSvg = parseSvg(light);
73
+ const darkSvg = parseSvg(dark);
74
+ // Prefer light's attributes, fall back to dark's
75
+ const width = lightSvg.width ?? darkSvg.width;
76
+ const height = lightSvg.height ?? darkSvg.height;
77
+ const viewBox = lightSvg.viewBox ?? darkSvg.viewBox;
78
+ let sizeAttrs = "";
79
+ if (width)
80
+ sizeAttrs += ` width="${width}"`;
81
+ if (height)
82
+ sizeAttrs += ` height="${height}"`;
83
+ if (viewBox)
84
+ sizeAttrs += ` viewBox="${viewBox}"`;
85
+ return [
86
+ `<svg xmlns="http://www.w3.org/2000/svg"${sizeAttrs}>`,
87
+ ` <style>`,
88
+ ` .icon-dark { display: none; }`,
89
+ ` @media (prefers-color-scheme: dark) {`,
90
+ ` .icon-light { display: none; }`,
91
+ ` .icon-dark { display: inline; }`,
92
+ ` }`,
93
+ ` </style>`,
94
+ ` <g class="icon-light">`,
95
+ indentInner(lightSvg.inner),
96
+ ` </g>`,
97
+ ` <g class="icon-dark">`,
98
+ indentInner(darkSvg.inner),
99
+ ` </g>`,
100
+ `</svg>`,
101
+ ].join("\n");
102
+ }
103
+ function parseSvg(svg) {
104
+ const openTagMatch = svg.match(/<svg\b([^>]*)>/i);
105
+ const endIndex = svg.lastIndexOf("</svg>");
106
+ let attrs = "";
107
+ let inner = svg.trim();
108
+ if (openTagMatch && openTagMatch.index !== undefined && endIndex !== -1) {
109
+ attrs = openTagMatch[1] ?? "";
110
+ const contentStart = openTagMatch.index + openTagMatch[0].length;
111
+ inner = svg.slice(contentStart, endIndex).trim();
112
+ }
113
+ const width = matchAttr(attrs, "width");
114
+ const height = matchAttr(attrs, "height");
115
+ const viewBox = matchAttr(attrs, "viewBox");
116
+ // If no width/height but we have a viewBox, we *could* derive them from it,
117
+ // but the caller only asked to "determine size" — using viewBox is enough.
118
+ return { width, height, viewBox, inner };
119
+ }
120
+ function matchAttr(attrs, name) {
121
+ // width="24", width='24', width=24, viewBox="0 0 24 24", etc.
122
+ const re = new RegExp(`\\b${name}\\s*=\\s*(?:"([^"]*)"|'([^']*)'|([^\\s"'>]+))`, "i");
123
+ const m = attrs.match(re);
124
+ if (!m)
125
+ return undefined;
126
+ return m[1] ?? m[2] ?? m[3];
127
+ }
128
+ function indentInner(inner, indent = " ") {
129
+ return inner
130
+ .split("\n")
131
+ .map((line) => (line.trim() ? indent + line : line))
132
+ .join("\n");
133
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eddev",
3
- "version": "2.2.0-beta.2",
3
+ "version": "2.2.0-beta.4",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -123,6 +123,7 @@
123
123
  "react-compiler-runtime": "^1.0.0",
124
124
  "react-inspector": "^9.0.0",
125
125
  "rollup-plugin-visualizer": "^5.14.0",
126
+ "sharp-ico": "^0.1.5",
126
127
  "superjson": "^2.2.2",
127
128
  "ts-poet": "^6.6.0",
128
129
  "ufo": "^1.3.1",
package/types.meta.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  declare global {
2
2
  type PostTypeName = keyof PostTypes
3
- type TemplateName = keyof PageTemplates | (string & {})
3
+ type TemplateName = "default" | keyof PageTemplates | (string & {})
4
4
  type BlockTypeName = Exclude<keyof BlockProps, "_core"> | (string & {})
5
5
  type ChildBlockTypeName = BlockTypeName | keyof CoreBlockProps
6
6
  type BlockTagName = keyof DefinedBlockTags