@avocadostudio-ai/cli 0.3.3 → 0.5.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/index.js CHANGED
@@ -15,70 +15,6 @@ import { fileURLToPath } from "node:url";
15
15
  // ../shared/src/protocol.ts
16
16
  var EDITOR_PROTOCOL_VERSION = "site-editor/v1";
17
17
 
18
- // ../richtext/src/parse.ts
19
- var INLINE_PATTERN = new RegExp(
20
- [
21
- // Code spans bind tightest, so they come first: nothing inside them is markup.
22
- "(?<!\\\\)`(?<code>[^`]+?)`",
23
- // Before the link alternative, so the `!` is consumed rather than left behind.
24
- "!\\[(?<imageAlt>.*?)(?<!\\\\)\\]\\((?<imageSrc>.+?)(?<!\\\\)\\)",
25
- "(?<!\\\\)\\*\\*(?<strong>.+?)(?<!\\\\)\\*\\*",
26
- "(?<!\\\\)~~(?<strike>.+?)(?<!\\\\)~~",
27
- "(?<!\\\\)\\*(?<em>.+?)(?<!\\\\)\\*",
28
- "(?<!\\\\)\\[(?<linkText>.+?)(?<!\\\\)\\]\\((?<linkHref>.+?)(?<!\\\\)\\)"
29
- ].join("|"),
30
- "g"
31
- );
32
-
33
- // ../richtext/src/doc.ts
34
- var MARK = {
35
- bold: "bold",
36
- italic: "italic",
37
- strike: "strike",
38
- code: "code",
39
- underline: "underline",
40
- link: "link"
41
- };
42
-
43
- // ../richtext/src/merge.ts
44
- var MARKDOWN_MARKS = [MARK.bold, MARK.italic, MARK.strike, MARK.code, MARK.link];
45
-
46
- // ../richtext/src/portable-text.ts
47
- var DECORATOR_TO_MARK = {
48
- strong: MARK.bold,
49
- em: MARK.italic,
50
- underline: MARK.underline,
51
- "strike-through": MARK.strike,
52
- code: MARK.code
53
- };
54
- var MARK_TO_DECORATOR = Object.fromEntries(
55
- Object.entries(DECORATOR_TO_MARK).map(([decorator, mark]) => [mark, decorator])
56
- );
57
-
58
- // ../richtext/src/contentful.ts
59
- var CONTENTFUL_TO_MARK = {
60
- bold: MARK.bold,
61
- italic: MARK.italic,
62
- underline: MARK.underline,
63
- code: MARK.code,
64
- strikethrough: MARK.strike
65
- };
66
- var MARK_TO_CONTENTFUL = Object.fromEntries(
67
- Object.entries(CONTENTFUL_TO_MARK).map(([contentful, mark]) => [mark, contentful])
68
- );
69
-
70
- // ../richtext/src/strapi.ts
71
- var FLAG_TO_MARK = {
72
- bold: MARK.bold,
73
- italic: MARK.italic,
74
- underline: MARK.underline,
75
- strikethrough: MARK.strike,
76
- code: MARK.code
77
- };
78
- var MARK_TO_FLAG = Object.fromEntries(
79
- Object.entries(FLAG_TO_MARK).map(([flag, mark]) => [mark, flag])
80
- );
81
-
82
18
  // ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/external.js
83
19
  var external_exports = {};
84
20
  __export(external_exports, {
@@ -13933,6 +13869,18 @@ var f = {
13933
13869
  */
13934
13870
  newTab: (label = "Open in new tab") => ({ kind: "boolean", label, inlineEditable: false }),
13935
13871
  image: (label, imageSpec) => ({ kind: "image", label, inlineEditable: false, ...imageSpec ? { imageSpec } : {} }),
13872
+ /**
13873
+ * A single emoji or symbol glyph, or the URL of a small image.
13874
+ *
13875
+ * Text in the panel, and deliberately *not* editable on the page. Whatever a
13876
+ * person types into an icon goes through `renderBlockIcon`, which draws only a
13877
+ * glyph or an image and renders **nothing** for anything else — so an inline
13878
+ * edit that typed a word ("rocket", the name the planner reaches for) would
13879
+ * make the icon silently disappear with the value stored and invisible. The
13880
+ * panel's labelled box is the affordance that fits a value from a constrained
13881
+ * vocabulary; a cursor blinking inside the emoji is not.
13882
+ */
13883
+ icon: (label = "Icon (single emoji)") => ({ kind: "text", label, inlineEditable: false }),
13936
13884
  imageAlt: (label) => ({ kind: "imageAlt", label }),
13937
13885
  headingLevel: () => ({ kind: "headingLevel", label: "Heading type", inlineEditable: false })
13938
13886
  };
@@ -14002,7 +13950,7 @@ registerBlock("FeatureGrid", {
14002
13950
  features: {
14003
13951
  label: "Features",
14004
13952
  itemFields: {
14005
- icon: f.text("Icon (single emoji)"),
13953
+ icon: f.icon(),
14006
13954
  title: f.text("Feature title"),
14007
13955
  description: f.longtext("Feature description")
14008
13956
  }
@@ -14034,7 +13982,7 @@ registerBlock("Testimonials", {
14034
13982
  items: {
14035
13983
  label: "Testimonials",
14036
13984
  itemFields: {
14037
- icon: f.text("Icon (single emoji)"),
13985
+ icon: f.icon(),
14038
13986
  quote: f.longtext("Quote"),
14039
13987
  author: f.text("Author"),
14040
13988
  role: f.text("Role / Company"),
@@ -14213,7 +14161,7 @@ registerBlock("Stats", {
14213
14161
  stats: {
14214
14162
  label: "Stats",
14215
14163
  itemFields: {
14216
- icon: f.text("Icon (single emoji)"),
14164
+ icon: f.icon(),
14217
14165
  value: f.text("Value"),
14218
14166
  label: f.text("Label"),
14219
14167
  description: f.text("Description")
@@ -14251,6 +14199,22 @@ var twoColumnItemFields = {
14251
14199
  alt: f.imageAlt("Alt text"),
14252
14200
  poster: f.image("Video poster image", { aspectRatio: "landscape", width: 768, height: 512 })
14253
14201
  };
14202
+ var twoColumnItemFieldsByType = {
14203
+ heading: { text: f.longtext("Heading text") },
14204
+ subheading: { text: f.longtext("Subheading text") },
14205
+ paragraph: { text: f.richtext("Body text") },
14206
+ list: { text: f.longtext("Text content") },
14207
+ cta: { label: f.text("Button label"), href: f.link("Link URL"), newTab: f.newTab() },
14208
+ ctas: { label: f.text("Button label"), href: f.link("Link URL"), newTab: f.newTab() },
14209
+ image: {
14210
+ src: f.image("Image", { aspectRatio: "portrait", width: 768, height: 1024 }),
14211
+ alt: f.imageAlt("Alt text")
14212
+ },
14213
+ video: {
14214
+ src: f.url("Video file URL"),
14215
+ poster: f.image("Video poster image", { aspectRatio: "landscape", width: 768, height: 512 })
14216
+ }
14217
+ };
14254
14218
  registerBlock("TwoColumn", {
14255
14219
  schema: external_exports.object({
14256
14220
  variant: external_exports.enum(["default", "accent"]).default("default").catch("default"),
@@ -14266,8 +14230,18 @@ registerBlock("TwoColumn", {
14266
14230
  headingLevel: f.headingLevel()
14267
14231
  },
14268
14232
  listFields: {
14269
- left: { label: "Left column items", itemFields: twoColumnItemFields },
14270
- right: { label: "Right column items", itemFields: twoColumnItemFields }
14233
+ left: {
14234
+ label: "Left column items",
14235
+ itemFields: twoColumnItemFields,
14236
+ discriminator: "type",
14237
+ itemFieldsByType: twoColumnItemFieldsByType
14238
+ },
14239
+ right: {
14240
+ label: "Right column items",
14241
+ itemFields: twoColumnItemFields,
14242
+ discriminator: "type",
14243
+ itemFieldsByType: twoColumnItemFieldsByType
14244
+ }
14271
14245
  }
14272
14246
  }
14273
14247
  });
@@ -14590,8 +14564,22 @@ var jsonSchemaLikeSchema = external_exports.lazy(
14590
14564
  description: external_exports.string().optional()
14591
14565
  }).catchall(external_exports.unknown())
14592
14566
  );
14567
+ var FIELD_KINDS = [
14568
+ "text",
14569
+ "richtext",
14570
+ "url",
14571
+ "link",
14572
+ "file",
14573
+ "image",
14574
+ "imageAlt",
14575
+ "enum",
14576
+ "color",
14577
+ "number",
14578
+ "boolean",
14579
+ "headingLevel"
14580
+ ];
14593
14581
  var fieldMetaSchema = external_exports.object({
14594
- kind: external_exports.enum(["text", "richtext", "url", "link", "image", "imageAlt", "enum", "color", "number", "boolean", "headingLevel"]),
14582
+ kind: external_exports.enum(FIELD_KINDS),
14595
14583
  label: external_exports.string().optional(),
14596
14584
  inlineEditable: external_exports.boolean().optional(),
14597
14585
  options: external_exports.array(external_exports.string()).optional(),
@@ -14644,6 +14632,70 @@ var blockManifestSchema = external_exports.object({
14644
14632
  blocks: external_exports.array(blockDefinitionSchema)
14645
14633
  });
14646
14634
 
14635
+ // ../richtext/src/parse.ts
14636
+ var INLINE_PATTERN = new RegExp(
14637
+ [
14638
+ // Code spans bind tightest, so they come first: nothing inside them is markup.
14639
+ "(?<!\\\\)`(?<code>[^`]+?)`",
14640
+ // Before the link alternative, so the `!` is consumed rather than left behind.
14641
+ "!\\[(?<imageAlt>.*?)(?<!\\\\)\\]\\((?<imageSrc>.+?)(?<!\\\\)\\)",
14642
+ "(?<!\\\\)\\*\\*(?<strong>.+?)(?<!\\\\)\\*\\*",
14643
+ "(?<!\\\\)~~(?<strike>.+?)(?<!\\\\)~~",
14644
+ "(?<!\\\\)\\*(?<em>.+?)(?<!\\\\)\\*",
14645
+ "(?<!\\\\)\\[(?<linkText>.+?)(?<!\\\\)\\]\\((?<linkHref>.+?)(?<!\\\\)\\)"
14646
+ ].join("|"),
14647
+ "g"
14648
+ );
14649
+
14650
+ // ../richtext/src/doc.ts
14651
+ var MARK = {
14652
+ bold: "bold",
14653
+ italic: "italic",
14654
+ strike: "strike",
14655
+ code: "code",
14656
+ underline: "underline",
14657
+ link: "link"
14658
+ };
14659
+
14660
+ // ../richtext/src/merge.ts
14661
+ var MARKDOWN_MARKS = [MARK.bold, MARK.italic, MARK.strike, MARK.code, MARK.link];
14662
+
14663
+ // ../richtext/src/portable-text.ts
14664
+ var DECORATOR_TO_MARK = {
14665
+ strong: MARK.bold,
14666
+ em: MARK.italic,
14667
+ underline: MARK.underline,
14668
+ "strike-through": MARK.strike,
14669
+ code: MARK.code
14670
+ };
14671
+ var MARK_TO_DECORATOR = Object.fromEntries(
14672
+ Object.entries(DECORATOR_TO_MARK).map(([decorator, mark]) => [mark, decorator])
14673
+ );
14674
+
14675
+ // ../richtext/src/contentful.ts
14676
+ var CONTENTFUL_TO_MARK = {
14677
+ bold: MARK.bold,
14678
+ italic: MARK.italic,
14679
+ underline: MARK.underline,
14680
+ code: MARK.code,
14681
+ strikethrough: MARK.strike
14682
+ };
14683
+ var MARK_TO_CONTENTFUL = Object.fromEntries(
14684
+ Object.entries(CONTENTFUL_TO_MARK).map(([contentful, mark]) => [mark, contentful])
14685
+ );
14686
+
14687
+ // ../richtext/src/strapi.ts
14688
+ var FLAG_TO_MARK = {
14689
+ bold: MARK.bold,
14690
+ italic: MARK.italic,
14691
+ underline: MARK.underline,
14692
+ strikethrough: MARK.strike,
14693
+ code: MARK.code
14694
+ };
14695
+ var MARK_TO_FLAG = Object.fromEntries(
14696
+ Object.entries(FLAG_TO_MARK).map(([flag, mark]) => [mark, flag])
14697
+ );
14698
+
14647
14699
  // ../shared/src/ops/theme-tokens.ts
14648
14700
  var THEME_TOKEN_TO_CSS_VARS = {
14649
14701
  brandColor: ["--brand", "--brand-hover", "--link"],
@@ -1 +1 @@
1
- import{P as b}from"./chunk-2CNEFIQP-B3HjHnn-.js";import{u as y,a as j,E as L,_ as m,L as M,b as p,o as P,i as A}from"./PuckPrototypeRoute-CEtarLZd.js";import{r as s,j as g}from"./index-8s1LXOA6.js";import{E as N,u as U}from"./index-B0cipFdl.js";import"./index-CIC8kldS.js";A();A();function C({content:a,onChange:x,extensions:v,editable:d=!0,onFocusChange:o,name:c}){const[i,E]=P(null,50,{leading:!0,maxWait:200}),l=s.useRef(!1),S=s.useRef(""),f=s.useRef(null),R=!!f.current,_=j(t=>t.state.ui.field.focus===c),T=t=>{f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{S.current===t&&(f.current=null)},200)},u=y(),e=U({extensions:v,content:a,editable:d,immediatelyRender:!1,parseOptions:{preserveWhitespace:"full"},onUpdate:({editor:t})=>{if(l.current||!_){u.getState().setUi({field:{focus:c}});return}const r=t.getHTML(),{from:n,to:h}=t.state.selection;E({from:n,to:h,html:r}),T(r),S.current=r}});return s.useEffect(()=>{if(!e)return;const t=()=>{o==null||o(e)};return e.on("focus",t),()=>{e.off("focus",t)}},[e,o]),s.useEffect(()=>{if(i){const{ui:t}=u.getState().state;x(i.html,{field:m(p({},t.field),{metadata:{from:i.from,to:i.to}})})}},[e,i,x,u,c]),s.useEffect(()=>{e==null||e.setEditable(d)},[e,d]),s.useEffect(()=>{var t;if(!e||R||e.getHTML()===a)return;l.current=!0,e.commands.setContent(a,{emitUpdate:!1});const{ui:n}=u.getState().state;typeof((t=n.field.metadata)==null?void 0:t.from)<"u"&&e.commands.setTextSelection({from:n.field.metadata.from,to:n.field.metadata.to}),l.current=!1},[a,e,u]),e}var F=s.memo(a=>{const{onChange:x,content:v,readOnly:d=!1,field:o,inline:c=!1,onFocus:i,id:E,name:l}=a,{tiptap:S={},options:f}=o,{extensions:R=[]}=S,_=s.useMemo(()=>[b.configure(f),...R],[o,R]),T=y(),u=`${l}${c?"::inline":""}`,e=C({content:v,onChange:x,extensions:_,editable:!d,name:u,onFocusChange:r=>{if(r){const n=T.getState();T.setState({currentRichText:{field:o,editor:r,id:E,inline:c},state:m(p({},n.state),{ui:m(p({},n.state.ui),{field:m(p({},n.state.ui.field),{focus:u})})})}),i==null||i(r)}}}),t=j(r=>{var n,h;return!c&&((n=r.currentRichText)==null?void 0:n.id)===E&&((h=r.currentRichText)!=null&&h.inlineComponentId)?r.currentRichText.editor:e});return e?g.jsx(L,m(p({},a),{editor:e,menu:g.jsx(M,{field:o,editor:t,readOnly:d}),children:g.jsx(N,{editor:e,className:"rich-text"})})):null});F.displayName="Editor";export{F as Editor};
1
+ import{P as b}from"./chunk-2CNEFIQP-DfR5vtvK.js";import{u as y,a as j,E as L,_ as m,L as M,b as p,o as P,i as A}from"./PuckPrototypeRoute-C4zGt4iA.js";import{r as s,j as g}from"./index-B8UmizZ0.js";import{E as N,u as U}from"./index-DAQiYlVE.js";import"./index-C6o8aifP.js";A();A();function C({content:a,onChange:x,extensions:v,editable:d=!0,onFocusChange:o,name:c}){const[i,E]=P(null,50,{leading:!0,maxWait:200}),l=s.useRef(!1),S=s.useRef(""),f=s.useRef(null),R=!!f.current,_=j(t=>t.state.ui.field.focus===c),T=t=>{f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{S.current===t&&(f.current=null)},200)},u=y(),e=U({extensions:v,content:a,editable:d,immediatelyRender:!1,parseOptions:{preserveWhitespace:"full"},onUpdate:({editor:t})=>{if(l.current||!_){u.getState().setUi({field:{focus:c}});return}const r=t.getHTML(),{from:n,to:h}=t.state.selection;E({from:n,to:h,html:r}),T(r),S.current=r}});return s.useEffect(()=>{if(!e)return;const t=()=>{o==null||o(e)};return e.on("focus",t),()=>{e.off("focus",t)}},[e,o]),s.useEffect(()=>{if(i){const{ui:t}=u.getState().state;x(i.html,{field:m(p({},t.field),{metadata:{from:i.from,to:i.to}})})}},[e,i,x,u,c]),s.useEffect(()=>{e==null||e.setEditable(d)},[e,d]),s.useEffect(()=>{var t;if(!e||R||e.getHTML()===a)return;l.current=!0,e.commands.setContent(a,{emitUpdate:!1});const{ui:n}=u.getState().state;typeof((t=n.field.metadata)==null?void 0:t.from)<"u"&&e.commands.setTextSelection({from:n.field.metadata.from,to:n.field.metadata.to}),l.current=!1},[a,e,u]),e}var F=s.memo(a=>{const{onChange:x,content:v,readOnly:d=!1,field:o,inline:c=!1,onFocus:i,id:E,name:l}=a,{tiptap:S={},options:f}=o,{extensions:R=[]}=S,_=s.useMemo(()=>[b.configure(f),...R],[o,R]),T=y(),u=`${l}${c?"::inline":""}`,e=C({content:v,onChange:x,extensions:_,editable:!d,name:u,onFocusChange:r=>{if(r){const n=T.getState();T.setState({currentRichText:{field:o,editor:r,id:E,inline:c},state:m(p({},n.state),{ui:m(p({},n.state.ui),{field:m(p({},n.state.ui.field),{focus:u})})})}),i==null||i(r)}}}),t=j(r=>{var n,h;return!c&&((n=r.currentRichText)==null?void 0:n.id)===E&&((h=r.currentRichText)!=null&&h.inlineComponentId)?r.currentRichText.editor:e});return e?g.jsx(L,m(p({},a),{editor:e,menu:g.jsx(M,{field:o,editor:t,readOnly:d}),children:g.jsx(N,{editor:e,className:"rich-text"})})):null});F.displayName="Editor";export{F as Editor};