@avocadostudio-ai/cli 0.7.0 → 0.9.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
@@ -14614,6 +14614,7 @@ var jsonSchemaLikeSchema = external_exports.lazy(
14614
14614
  var FIELD_KINDS = [
14615
14615
  "text",
14616
14616
  "richtext",
14617
+ "html",
14617
14618
  "url",
14618
14619
  "link",
14619
14620
  "file",
@@ -14624,7 +14625,9 @@ var FIELD_KINDS = [
14624
14625
  "number",
14625
14626
  "boolean",
14626
14627
  "headingLevel",
14627
- "reference"
14628
+ "reference",
14629
+ "stringList",
14630
+ "imageList"
14628
14631
  ];
14629
14632
  var fieldMetaSchema = external_exports.object({
14630
14633
  kind: external_exports.enum(FIELD_KINDS),
@@ -14731,7 +14734,18 @@ var NODE = {
14731
14734
  * unchanged. The editor registers a matching read-only node, so it also
14732
14735
  * survives a trip through the property panel in its original position.
14733
14736
  */
14734
- unknown: "avocadoUnknownBlock"
14737
+ unknown: "avocadoUnknownBlock",
14738
+ /**
14739
+ * The same thing in inline position: a `<br class="hidden md:inline">`, an
14740
+ * `<img>` or any other void element sitting inside a run of text.
14741
+ *
14742
+ * It is a separate name from `avocadoUnknownBlock` because ProseMirror makes
14743
+ * a node inline or block and never both, and a paragraph's content is
14744
+ * `inline*`. Emitting the block name here put a block node inside a
14745
+ * paragraph, which is not a document the editor's schema can hold: it was
14746
+ * dropped on load, taking the element with it.
14747
+ */
14748
+ unknownInline: "avocadoUnknownInline"
14735
14749
  };
14736
14750
  var MARK = {
14737
14751
  bold: "bold",
@@ -14739,12 +14753,64 @@ var MARK = {
14739
14753
  strike: "strike",
14740
14754
  code: "code",
14741
14755
  underline: "underline",
14742
- link: "link"
14756
+ link: "link",
14757
+ /**
14758
+ * An inline element the pivot has no mark for, carried rather than dropped.
14759
+ *
14760
+ * The inline twin of `avocadoUnknownBlock`, and it exists for HTML: a
14761
+ * template stores `<span class="hidden xl:inline">creating websites with</span>`
14762
+ * as content, and neither half of that can be thrown away. The text inside
14763
+ * is ordinary editable text; the wrapper rides along in `attrs` as its tag
14764
+ * and its attributes in source order, and is re-emitted around whatever the
14765
+ * text became.
14766
+ *
14767
+ * Unknown marks already survive a round trip untouched — the Storyblok
14768
+ * converter relies on it for `styled` and `highlight`. This one is named so
14769
+ * the HTML converter can recognise its own and rebuild the element.
14770
+ */
14771
+ unknownHtml: "avocadoUnknownHtml"
14743
14772
  };
14744
14773
 
14745
14774
  // ../richtext/src/merge.ts
14746
14775
  var MARKDOWN_MARKS = [MARK.bold, MARK.italic, MARK.strike, MARK.code, MARK.link];
14747
14776
 
14777
+ // ../richtext/src/html.ts
14778
+ var BLOCK_TAGS = {
14779
+ p: NODE.paragraph,
14780
+ h1: NODE.heading,
14781
+ h2: NODE.heading,
14782
+ h3: NODE.heading,
14783
+ h4: NODE.heading,
14784
+ h5: NODE.heading,
14785
+ h6: NODE.heading,
14786
+ ul: NODE.bulletList,
14787
+ ol: NODE.orderedList,
14788
+ li: NODE.listItem,
14789
+ blockquote: NODE.blockquote,
14790
+ pre: NODE.codeBlock,
14791
+ hr: NODE.horizontalRule
14792
+ };
14793
+ var MARK_TAGS = {
14794
+ strong: MARK.bold,
14795
+ b: MARK.bold,
14796
+ em: MARK.italic,
14797
+ i: MARK.italic,
14798
+ s: MARK.strike,
14799
+ del: MARK.strike,
14800
+ strike: MARK.strike,
14801
+ code: MARK.code,
14802
+ u: MARK.underline,
14803
+ a: MARK.link
14804
+ };
14805
+ var MARK_TAG_OUT = {
14806
+ [MARK.bold]: "strong",
14807
+ [MARK.italic]: "em",
14808
+ [MARK.strike]: "s",
14809
+ [MARK.code]: "code",
14810
+ [MARK.underline]: "u",
14811
+ [MARK.link]: "a"
14812
+ };
14813
+
14748
14814
  // ../richtext/src/portable-text.ts
14749
14815
  var DECORATOR_TO_MARK = {
14750
14816
  strong: MARK.bold,
@@ -15489,6 +15555,10 @@ function main(argv) {
15489
15555
  printHelp();
15490
15556
  return;
15491
15557
  }
15558
+ if (rest.includes("--help") || rest.includes("-h")) {
15559
+ printHelp();
15560
+ return;
15561
+ }
15492
15562
  switch (cmd) {
15493
15563
  case "start":
15494
15564
  return startCommand(rest);
@@ -1 +1 @@
1
- import{P as b}from"./chunk-2CNEFIQP-Brxm4NMf.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-B6iMNdku.js";import{r as s,j as g}from"./index-B4qUKNTV.js";import{E as N,u as U}from"./index-DY7tRaFQ.js";import"./index-CTqfgO94.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-CVtjE0im.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-DFrDHnD9.js";import{r as s,j as g}from"./index-pJyyOoxH.js";import{E as N,u as U}from"./index-C3w-otrq.js";import"./index-DIQwi1AS.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};