@avocadostudio-ai/cli 0.2.1 → 0.3.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 +35 -2
- package/editor-dist/assets/{Editor-EPSED64A-5GXOZwWs.js → Editor-EPSED64A-Z4S24EJL.js} +1 -1
- package/editor-dist/assets/{PuckPrototypeRoute-CIpO3h9H.js → PuckPrototypeRoute-DLvPOyWm.js} +4 -4
- package/editor-dist/assets/{Render-CU35UAWV-C1VtWmg6.js → Render-CU35UAWV-zE5K0xpi.js} +1 -1
- package/editor-dist/assets/{chunk-2CNEFIQP-W9Nm3hTe.js → chunk-2CNEFIQP-C5US-lfF.js} +1 -1
- package/editor-dist/assets/{full-N67EAB2Q-5hqHUblQ.js → full-N67EAB2Q-XJpACdfV.js} +1 -1
- package/editor-dist/assets/{index-CM2p2yNB.js → index-B7SCWsa0.js} +162 -162
- package/editor-dist/assets/{index-DaRt8zrp.js → index-Dbts1-uP.js} +1 -1
- package/editor-dist/assets/{index-Cqq_JD7D.js → index-De_6A-Lq.js} +1 -1
- package/editor-dist/assets/{loaded-F37CNCVG-Cg4RQXYq.js → loaded-F37CNCVG-D9BeD3n9.js} +1 -1
- package/editor-dist/assets/{loaded-H325ZSK5-VDlQcHWH.js → loaded-H325ZSK5-CrVJry99.js} +1 -1
- package/editor-dist/assets/{loaded-MIY725CK-DUPDdSS5.js → loaded-MIY725CK-Dpr7Fj8r.js} +1 -1
- package/editor-dist/index.html +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -13851,6 +13851,28 @@ config(en_default());
|
|
|
13851
13851
|
var G = globalThis;
|
|
13852
13852
|
var _blockSchemas = G.__ase_blockSchemas ?? (G.__ase_blockSchemas = {});
|
|
13853
13853
|
var _blockMeta = G.__ase_blockMeta ?? (G.__ase_blockMeta = {});
|
|
13854
|
+
function unwrapZod(schema) {
|
|
13855
|
+
let current = schema;
|
|
13856
|
+
for (let depth = 0; depth < 5 && current; depth += 1) {
|
|
13857
|
+
const inner = current.def?.innerType ?? current._def?.innerType;
|
|
13858
|
+
if (!inner) return current;
|
|
13859
|
+
current = inner;
|
|
13860
|
+
}
|
|
13861
|
+
return current;
|
|
13862
|
+
}
|
|
13863
|
+
var warnedListFields = /* @__PURE__ */ new Set();
|
|
13864
|
+
function warnUnbackedListField(type, listKey, present) {
|
|
13865
|
+
const key = `${type}.${listKey}`;
|
|
13866
|
+
if (warnedListFields.has(key)) return;
|
|
13867
|
+
warnedListFields.add(key);
|
|
13868
|
+
const because = present ? `the schema's \`${listKey}\` is not an array of objects` : `the schema has no \`${listKey}\``;
|
|
13869
|
+
try {
|
|
13870
|
+
console.warn(
|
|
13871
|
+
`[avocado] ${type}: meta.listFields declares "${listKey}" but ${because}. The property panel renders list rows from the schema, so this list will show no rows and no Add control. Declare it alongside the meta, e.g. ${listKey}: z.array(z.object({ \u2026 })).optional()`
|
|
13872
|
+
);
|
|
13873
|
+
} catch {
|
|
13874
|
+
}
|
|
13875
|
+
}
|
|
13854
13876
|
function registerBlock(type, config2) {
|
|
13855
13877
|
_blockSchemas[type] = config2.schema;
|
|
13856
13878
|
const shape = config2.schema.shape;
|
|
@@ -13865,8 +13887,11 @@ function registerBlock(type, config2) {
|
|
|
13865
13887
|
if (config2.meta.listFields) {
|
|
13866
13888
|
for (const [listKey, listMeta] of Object.entries(config2.meta.listFields)) {
|
|
13867
13889
|
const listZod = shape[listKey];
|
|
13868
|
-
const elementShape = listZod?.element?.shape;
|
|
13869
|
-
if (!elementShape)
|
|
13890
|
+
const elementShape = unwrapZod(listZod)?.element?.shape;
|
|
13891
|
+
if (!elementShape) {
|
|
13892
|
+
warnUnbackedListField(type, listKey, listZod !== void 0);
|
|
13893
|
+
continue;
|
|
13894
|
+
}
|
|
13870
13895
|
for (const [itemKey, itemField] of Object.entries(listMeta.itemFields)) {
|
|
13871
13896
|
if (itemField.required !== void 0) continue;
|
|
13872
13897
|
const zodItem = elementShape[itemKey];
|
|
@@ -15214,6 +15239,14 @@ async function startCommand(args) {
|
|
|
15214
15239
|
process.stdout.write(
|
|
15215
15240
|
[
|
|
15216
15241
|
`Avocado Studio editor running on http://${opts.host}:${opts.port}`,
|
|
15242
|
+
/*
|
|
15243
|
+
* Say the other spelling too. The bind address is a literal; every doc,
|
|
15244
|
+
* env table and example in this product says `localhost`. They are the
|
|
15245
|
+
* same machine and different origins, and a reader who copies the line
|
|
15246
|
+
* above into a CORS allowlist or a `frame-ancestors` rule written from
|
|
15247
|
+
* the docs has two strings that will never compare equal.
|
|
15248
|
+
*/
|
|
15249
|
+
...opts.host === "127.0.0.1" ? [` also reachable at http://localhost:${opts.port} \u2014 the spelling the docs use`] : [],
|
|
15217
15250
|
` orchestrator: ${opts.orchestrator}`,
|
|
15218
15251
|
` preview site: ${opts.siteOrigin}`,
|
|
15219
15252
|
opts.publishToken ? ` publish token: (set)` : ` publish token: (unset)`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{P as b}from"./chunk-2CNEFIQP-
|
|
1
|
+
import{P as b}from"./chunk-2CNEFIQP-C5US-lfF.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-DLvPOyWm.js";import{r as s,j as g}from"./index-B7SCWsa0.js";import{E as N,u as U}from"./index-Dbts1-uP.js";import"./index-De_6A-Lq.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};
|