@avocadostudio-ai/cli 0.14.0 → 0.16.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
@@ -13886,10 +13886,18 @@ function registerBlock(type, config2) {
13886
13886
  }
13887
13887
  }
13888
13888
  _blockMeta[type] = config2.meta;
13889
+ _imageFieldsCache.delete(type);
13890
+ _listImageFieldsCache.delete(type);
13891
+ _imageFieldMapCache.delete(type);
13892
+ _mediaFieldsCache.delete(type);
13889
13893
  if (!config2.meta.chrome && !allowedBlockTypes.includes(type)) {
13890
13894
  allowedBlockTypes.push(type);
13891
13895
  }
13892
13896
  }
13897
+ var _imageFieldsCache = /* @__PURE__ */ new Map();
13898
+ var _listImageFieldsCache = /* @__PURE__ */ new Map();
13899
+ var _imageFieldMapCache = /* @__PURE__ */ new Map();
13900
+ var _mediaFieldsCache = /* @__PURE__ */ new Map();
13893
13901
  var allowedBlockTypes = G.__ase_allowedBlockTypes ?? (G.__ase_allowedBlockTypes = []);
13894
13902
  var blockInstanceSchemaLenient = external_exports.object({
13895
13903
  id: external_exports.string().min(1),
@@ -14661,12 +14669,15 @@ var fieldMetaSchema = external_exports.object({
14661
14669
  decorators: external_exports.array(external_exports.object({ name: external_exports.string().min(1), title: external_exports.string().optional() })).optional(),
14662
14670
  required: external_exports.boolean().optional()
14663
14671
  });
14664
- var listFieldMetaSchema = external_exports.object({
14665
- label: external_exports.string().optional(),
14666
- itemFields: external_exports.record(external_exports.string(), fieldMetaSchema).optional(),
14667
- discriminator: external_exports.string().optional(),
14668
- itemFieldsByType: external_exports.record(external_exports.string(), external_exports.record(external_exports.string(), fieldMetaSchema)).optional()
14669
- });
14672
+ var listFieldMetaSchema = external_exports.lazy(
14673
+ () => external_exports.object({
14674
+ label: external_exports.string().optional(),
14675
+ itemFields: external_exports.record(external_exports.string(), fieldMetaSchema).optional(),
14676
+ discriminator: external_exports.string().optional(),
14677
+ itemFieldsByType: external_exports.record(external_exports.string(), external_exports.record(external_exports.string(), fieldMetaSchema)).optional(),
14678
+ itemListFields: external_exports.record(external_exports.string(), listFieldMetaSchema).optional()
14679
+ })
14680
+ );
14670
14681
  var blockDefinitionSchema = external_exports.object({
14671
14682
  type: external_exports.string().min(1),
14672
14683
  displayName: external_exports.string().min(1).optional(),
@@ -14954,7 +14965,8 @@ var updatePropsSchema = external_exports.object({
14954
14965
  op: external_exports.literal("update_props"),
14955
14966
  pageSlug: external_exports.string().min(1),
14956
14967
  blockId: external_exports.string().min(1),
14957
- patch: external_exports.record(external_exports.string(), external_exports.unknown())
14968
+ patch: external_exports.record(external_exports.string(), external_exports.unknown()),
14969
+ imageQuery: external_exports.string().optional()
14958
14970
  });
14959
14971
  var removeBlockSchema = external_exports.object({
14960
14972
  op: external_exports.literal("remove_block"),
@@ -1 +1 @@
1
- import{P as b}from"./chunk-2CNEFIQP-DFFuEPqD.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-B7q3SeBT.js";import{r as s,j as g}from"./index-DanvInLA.js";import{E as N,u as U}from"./index-CxCnZahh.js";import"./index-BbaDdHeb.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-C7R23XGO.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-BPfj6c_u.js";import{r as s,j as g}from"./index-D6u1d95B.js";import{E as N,u as U}from"./index-CZr4K3bY.js";import"./index-E3oY3YGB.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};