@avocadostudio-ai/cli 0.18.0 → 0.20.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 +55 -6
- package/editor-dist/assets/{Editor-EPSED64A-C3dmGmif.js → Editor-EPSED64A-ShA_kq9S.js} +1 -1
- package/editor-dist/assets/{PuckPrototypeRoute-CrrOmaf8.js → PuckPrototypeRoute-B8SYzh7-.js} +4 -4
- package/editor-dist/assets/{PuckPrototypeRoute-Bn1rE5xN.css → PuckPrototypeRoute-D3Yu5jsP.css} +1 -1
- package/editor-dist/assets/{Render-CU35UAWV-YCm3Frvc.js → Render-CU35UAWV-Bwy58uZd.js} +1 -1
- package/editor-dist/assets/{chunk-2CNEFIQP-DzFOgeLS.js → chunk-2CNEFIQP-BR7PU-7I.js} +1 -1
- package/editor-dist/assets/{full-N67EAB2Q-C7KJuNzX.js → full-N67EAB2Q-QDGaZjbg.js} +1 -1
- package/editor-dist/assets/{index-CJPLcYvR.js → index-6vx1HRlR.js} +193 -212
- package/editor-dist/assets/{index-BojQt5v5.js → index-CTnBzh7l.js} +1 -1
- package/editor-dist/assets/{index-qsQHPHTW.js → index-Ig3LRGy0.js} +1 -1
- package/editor-dist/assets/index-JeTqIXoj.css +1 -0
- package/editor-dist/assets/{loaded-F37CNCVG-CdibEI93.js → loaded-F37CNCVG-Cb0KvIrp.js} +1 -1
- package/editor-dist/assets/{loaded-H325ZSK5-Xg3HWjZB.js → loaded-H325ZSK5-hCI01cLE.js} +1 -1
- package/editor-dist/assets/{loaded-MIY725CK-lRYZE7V-.js → loaded-MIY725CK-1wvC0Lno.js} +1 -1
- package/editor-dist/index.html +2 -2
- package/package.json +2 -2
- package/editor-dist/assets/index-DgLEs9n7.css +0 -1
package/dist/index.js
CHANGED
|
@@ -13937,7 +13937,16 @@ var f = {
|
|
|
13937
13937
|
*/
|
|
13938
13938
|
icon: (label = "Icon (single emoji)") => ({ kind: "text", label, inlineEditable: false }),
|
|
13939
13939
|
imageAlt: (label) => ({ kind: "imageAlt", label }),
|
|
13940
|
-
headingLevel: () => ({ kind: "headingLevel", label: "Heading type", inlineEditable: false })
|
|
13940
|
+
headingLevel: () => ({ kind: "headingLevel", label: "Heading type", inlineEditable: false }),
|
|
13941
|
+
/**
|
|
13942
|
+
* Which ground the section sits on.
|
|
13943
|
+
*
|
|
13944
|
+
* A page reads as a rhythm when its sections alternate, and the alternation
|
|
13945
|
+
* belongs to each block rather than to a rule that counts them — a
|
|
13946
|
+
* `nth-of-type` stripe re-colours the whole page the moment two blocks are
|
|
13947
|
+
* reordered, and nothing in the editor or the planner can address it.
|
|
13948
|
+
*/
|
|
13949
|
+
tone: () => ({ kind: "enum", label: "Background", options: ["default", "panel", "inverse"], inlineEditable: false })
|
|
13941
13950
|
};
|
|
13942
13951
|
|
|
13943
13952
|
// ../shared/src/blocks/hero.ts
|
|
@@ -13983,6 +13992,7 @@ registerBuiltinBlock("Hero", {
|
|
|
13983
13992
|
// ../shared/src/blocks/feature-grid.ts
|
|
13984
13993
|
registerBuiltinBlock("FeatureGrid", {
|
|
13985
13994
|
schema: external_exports.object({
|
|
13995
|
+
tone: external_exports.enum(["default", "panel", "inverse"]).optional(),
|
|
13986
13996
|
title: external_exports.string().min(1),
|
|
13987
13997
|
columns: external_exports.enum(["2", "3", "4"]).default("3").catch("3"),
|
|
13988
13998
|
features: external_exports.array(external_exports.object({
|
|
@@ -13997,6 +14007,7 @@ registerBuiltinBlock("FeatureGrid", {
|
|
|
13997
14007
|
description: "Grid of feature cards with optional icon, title, and description.",
|
|
13998
14008
|
category: "content",
|
|
13999
14009
|
fields: {
|
|
14010
|
+
tone: f.tone(),
|
|
14000
14011
|
title: f.text("Section title"),
|
|
14001
14012
|
columns: { kind: "enum", label: "Columns", options: ["2", "3", "4"], inlineEditable: false },
|
|
14002
14013
|
headingLevel: f.headingLevel()
|
|
@@ -14017,6 +14028,7 @@ registerBuiltinBlock("FeatureGrid", {
|
|
|
14017
14028
|
// ../shared/src/blocks/testimonials.ts
|
|
14018
14029
|
registerBuiltinBlock("Testimonials", {
|
|
14019
14030
|
schema: external_exports.object({
|
|
14031
|
+
tone: external_exports.enum(["default", "panel", "inverse"]).optional(),
|
|
14020
14032
|
title: external_exports.string().min(1),
|
|
14021
14033
|
items: external_exports.array(external_exports.object({
|
|
14022
14034
|
id: external_exports.string().optional(),
|
|
@@ -14032,7 +14044,7 @@ registerBuiltinBlock("Testimonials", {
|
|
|
14032
14044
|
displayName: "Testimonials",
|
|
14033
14045
|
description: "Grid of testimonial cards with quotes and authors.",
|
|
14034
14046
|
category: "content",
|
|
14035
|
-
fields: { title: f.text("Section title"), headingLevel: f.headingLevel() },
|
|
14047
|
+
fields: { tone: f.tone(), title: f.text("Section title"), headingLevel: f.headingLevel() },
|
|
14036
14048
|
listFields: {
|
|
14037
14049
|
items: {
|
|
14038
14050
|
label: "Testimonials",
|
|
@@ -14052,6 +14064,7 @@ registerBuiltinBlock("Testimonials", {
|
|
|
14052
14064
|
// ../shared/src/blocks/faq-accordion.ts
|
|
14053
14065
|
registerBuiltinBlock("FAQAccordion", {
|
|
14054
14066
|
schema: external_exports.object({
|
|
14067
|
+
tone: external_exports.enum(["default", "panel", "inverse"]).optional(),
|
|
14055
14068
|
title: external_exports.string().min(1),
|
|
14056
14069
|
items: external_exports.array(external_exports.object({ id: external_exports.string().optional(), q: external_exports.string().min(1), a: external_exports.string().min(1) })).min(1)
|
|
14057
14070
|
}),
|
|
@@ -14059,7 +14072,7 @@ registerBuiltinBlock("FAQAccordion", {
|
|
|
14059
14072
|
displayName: "FAQ Accordion",
|
|
14060
14073
|
description: "Expandable question-and-answer section.",
|
|
14061
14074
|
category: "content",
|
|
14062
|
-
fields: { title: f.text("Section title"), headingLevel: f.headingLevel() },
|
|
14075
|
+
fields: { tone: f.tone(), title: f.text("Section title"), headingLevel: f.headingLevel() },
|
|
14063
14076
|
listFields: {
|
|
14064
14077
|
items: {
|
|
14065
14078
|
label: "FAQ items",
|
|
@@ -14072,6 +14085,7 @@ registerBuiltinBlock("FAQAccordion", {
|
|
|
14072
14085
|
// ../shared/src/blocks/cta.ts
|
|
14073
14086
|
registerBuiltinBlock("CTA", {
|
|
14074
14087
|
schema: external_exports.object({
|
|
14088
|
+
tone: external_exports.enum(["default", "panel", "inverse"]).optional(),
|
|
14075
14089
|
title: external_exports.string().min(1),
|
|
14076
14090
|
description: external_exports.string().min(1),
|
|
14077
14091
|
ctaText: external_exports.string().min(1),
|
|
@@ -14086,6 +14100,7 @@ registerBuiltinBlock("CTA", {
|
|
|
14086
14100
|
description: "Centered promotional section with primary and optional secondary button.",
|
|
14087
14101
|
category: "conversion",
|
|
14088
14102
|
fields: {
|
|
14103
|
+
tone: f.tone(),
|
|
14089
14104
|
title: f.text("Headline"),
|
|
14090
14105
|
description: f.longtext("Description"),
|
|
14091
14106
|
ctaText: f.text("Button text"),
|
|
@@ -14102,6 +14117,7 @@ registerBuiltinBlock("CTA", {
|
|
|
14102
14117
|
// ../shared/src/blocks/card.ts
|
|
14103
14118
|
registerBuiltinBlock("Card", {
|
|
14104
14119
|
schema: external_exports.object({
|
|
14120
|
+
tone: external_exports.enum(["default", "panel", "inverse"]).optional(),
|
|
14105
14121
|
title: external_exports.string().min(1),
|
|
14106
14122
|
description: external_exports.string().min(1),
|
|
14107
14123
|
ctaText: external_exports.string().min(1),
|
|
@@ -14116,6 +14132,7 @@ registerBuiltinBlock("Card", {
|
|
|
14116
14132
|
description: "Single prominent card with a CTA. Use 'full-bleed' variant for background image with dark overlay and white text.",
|
|
14117
14133
|
category: "content",
|
|
14118
14134
|
fields: {
|
|
14135
|
+
tone: f.tone(),
|
|
14119
14136
|
title: f.text("Card title"),
|
|
14120
14137
|
description: f.longtext("Card description"),
|
|
14121
14138
|
ctaText: f.text("Button text"),
|
|
@@ -14132,6 +14149,7 @@ registerBuiltinBlock("Card", {
|
|
|
14132
14149
|
// ../shared/src/blocks/card-grid.ts
|
|
14133
14150
|
registerBuiltinBlock("CardGrid", {
|
|
14134
14151
|
schema: external_exports.object({
|
|
14152
|
+
tone: external_exports.enum(["default", "panel", "inverse"]).optional(),
|
|
14135
14153
|
title: external_exports.string().min(1),
|
|
14136
14154
|
subtitle: external_exports.string().optional(),
|
|
14137
14155
|
columns: external_exports.enum(["2", "3", "4"]).default("3").catch("3"),
|
|
@@ -14154,6 +14172,7 @@ registerBuiltinBlock("CardGrid", {
|
|
|
14154
14172
|
description: "Grid of cards, each with title, description, and CTA.",
|
|
14155
14173
|
category: "content",
|
|
14156
14174
|
fields: {
|
|
14175
|
+
tone: f.tone(),
|
|
14157
14176
|
title: f.text("Section title"),
|
|
14158
14177
|
subtitle: f.text("Subtitle"),
|
|
14159
14178
|
columns: { kind: "enum", label: "Columns", options: ["2", "3", "4"], inlineEditable: false },
|
|
@@ -14180,6 +14199,7 @@ registerBuiltinBlock("CardGrid", {
|
|
|
14180
14199
|
// ../shared/src/blocks/rich-text.ts
|
|
14181
14200
|
registerBuiltinBlock("RichText", {
|
|
14182
14201
|
schema: external_exports.object({
|
|
14202
|
+
tone: external_exports.enum(["default", "panel", "inverse"]).optional(),
|
|
14183
14203
|
title: external_exports.string(),
|
|
14184
14204
|
body: external_exports.string().min(1)
|
|
14185
14205
|
}),
|
|
@@ -14188,6 +14208,7 @@ registerBuiltinBlock("RichText", {
|
|
|
14188
14208
|
description: "Freeform text content with markdown-style formatting.",
|
|
14189
14209
|
category: "content",
|
|
14190
14210
|
fields: {
|
|
14211
|
+
tone: f.tone(),
|
|
14191
14212
|
title: f.text("Section title"),
|
|
14192
14213
|
body: f.richtext("Body"),
|
|
14193
14214
|
headingLevel: f.headingLevel()
|
|
@@ -14198,11 +14219,23 @@ registerBuiltinBlock("RichText", {
|
|
|
14198
14219
|
// ../shared/src/blocks/stats.ts
|
|
14199
14220
|
registerBuiltinBlock("Stats", {
|
|
14200
14221
|
schema: external_exports.object({
|
|
14222
|
+
tone: external_exports.enum(["default", "panel", "inverse"]).optional(),
|
|
14201
14223
|
title: external_exports.string().optional(),
|
|
14202
14224
|
stats: external_exports.array(external_exports.object({
|
|
14203
14225
|
id: external_exports.string().optional(),
|
|
14204
14226
|
icon: external_exports.string().optional(),
|
|
14205
14227
|
value: external_exports.string().min(1),
|
|
14228
|
+
/*
|
|
14229
|
+
* The unit, out of the numeral.
|
|
14230
|
+
*
|
|
14231
|
+
* It used to live inside `value` — "20+", "5,000 years" — which meant
|
|
14232
|
+
* the display face had to set both, so the measure word came out at the
|
|
14233
|
+
* same size and weight as the figure it qualifies. They are different
|
|
14234
|
+
* kinds of thing and they want different type. Optional, because plenty
|
|
14235
|
+
* of figures have no unit and inventing one to fill the field is worse
|
|
14236
|
+
* than leaving it empty.
|
|
14237
|
+
*/
|
|
14238
|
+
unit: external_exports.string().optional(),
|
|
14206
14239
|
label: external_exports.string().min(1),
|
|
14207
14240
|
description: external_exports.string().optional()
|
|
14208
14241
|
})).min(1)
|
|
@@ -14211,13 +14244,14 @@ registerBuiltinBlock("Stats", {
|
|
|
14211
14244
|
displayName: "Stats",
|
|
14212
14245
|
description: "Row of big numbers with labels (e.g. 10K+ Users).",
|
|
14213
14246
|
category: "content",
|
|
14214
|
-
fields: { title: f.text("Section title"), headingLevel: f.headingLevel() },
|
|
14247
|
+
fields: { tone: f.tone(), title: f.text("Section title"), headingLevel: f.headingLevel() },
|
|
14215
14248
|
listFields: {
|
|
14216
14249
|
stats: {
|
|
14217
14250
|
label: "Stats",
|
|
14218
14251
|
itemFields: {
|
|
14219
14252
|
icon: f.icon(),
|
|
14220
|
-
value: f.text("
|
|
14253
|
+
value: f.text("Figure"),
|
|
14254
|
+
unit: f.text("Unit"),
|
|
14221
14255
|
label: f.text("Label"),
|
|
14222
14256
|
description: f.text("Description")
|
|
14223
14257
|
}
|
|
@@ -14272,6 +14306,7 @@ var twoColumnItemFieldsByType = {
|
|
|
14272
14306
|
};
|
|
14273
14307
|
registerBuiltinBlock("TwoColumn", {
|
|
14274
14308
|
schema: external_exports.object({
|
|
14309
|
+
tone: external_exports.enum(["default", "panel", "inverse"]).optional(),
|
|
14275
14310
|
variant: external_exports.enum(["default", "accent"]).default("default").catch("default"),
|
|
14276
14311
|
left: external_exports.array(twoColumnChild).min(1),
|
|
14277
14312
|
right: external_exports.array(twoColumnChild).min(1)
|
|
@@ -14281,6 +14316,7 @@ registerBuiltinBlock("TwoColumn", {
|
|
|
14281
14316
|
description: "Composite two-column layout with typed child components in each column.",
|
|
14282
14317
|
category: "layout",
|
|
14283
14318
|
fields: {
|
|
14319
|
+
tone: f.tone(),
|
|
14284
14320
|
variant: { kind: "enum", label: "Style variant", options: ["default", "accent"], inlineEditable: false },
|
|
14285
14321
|
headingLevel: f.headingLevel()
|
|
14286
14322
|
},
|
|
@@ -14384,6 +14420,7 @@ registerBuiltinBlock("SiteHeader", {
|
|
|
14384
14420
|
// ../shared/src/blocks/embed.ts
|
|
14385
14421
|
registerBuiltinBlock("Embed", {
|
|
14386
14422
|
schema: external_exports.object({
|
|
14423
|
+
tone: external_exports.enum(["default", "panel", "inverse"]).optional(),
|
|
14387
14424
|
embedType: external_exports.enum(["map", "social", "custom"]).default("map").catch("map"),
|
|
14388
14425
|
url: external_exports.string().min(1),
|
|
14389
14426
|
title: external_exports.string().optional(),
|
|
@@ -14394,6 +14431,7 @@ registerBuiltinBlock("Embed", {
|
|
|
14394
14431
|
description: "Embed external content \u2014 Google Maps, social media posts, or a custom iframe. For video use the Video block instead.",
|
|
14395
14432
|
category: "media",
|
|
14396
14433
|
fields: {
|
|
14434
|
+
tone: f.tone(),
|
|
14397
14435
|
embedType: { kind: "enum", label: "Embed type", options: ["map", "social", "custom"], inlineEditable: false },
|
|
14398
14436
|
url: f.url("URL"),
|
|
14399
14437
|
title: f.text("Title / caption"),
|
|
@@ -14432,6 +14470,7 @@ registerBuiltinBlock("Banner", {
|
|
|
14432
14470
|
// ../shared/src/blocks/carousel.ts
|
|
14433
14471
|
registerBuiltinBlock("Carousel", {
|
|
14434
14472
|
schema: external_exports.object({
|
|
14473
|
+
tone: external_exports.enum(["default", "panel", "inverse"]).optional(),
|
|
14435
14474
|
items: external_exports.array(external_exports.object({
|
|
14436
14475
|
id: external_exports.string().optional(),
|
|
14437
14476
|
imageUrl: external_exports.string().min(1),
|
|
@@ -14450,6 +14489,7 @@ registerBuiltinBlock("Carousel", {
|
|
|
14450
14489
|
description: "Image/content slideshow with prev/next navigation and dot indicators.",
|
|
14451
14490
|
category: "content",
|
|
14452
14491
|
fields: {
|
|
14492
|
+
tone: f.tone(),
|
|
14453
14493
|
autoplay: { kind: "enum", label: "Autoplay", options: ["true", "false"], inlineEditable: false },
|
|
14454
14494
|
interval: { kind: "number", label: "Interval (ms)", inlineEditable: false }
|
|
14455
14495
|
},
|
|
@@ -14473,6 +14513,7 @@ registerBuiltinBlock("Carousel", {
|
|
|
14473
14513
|
// ../shared/src/blocks/gallery.ts
|
|
14474
14514
|
registerBuiltinBlock("Gallery", {
|
|
14475
14515
|
schema: external_exports.object({
|
|
14516
|
+
tone: external_exports.enum(["default", "panel", "inverse"]).optional(),
|
|
14476
14517
|
title: external_exports.string().optional(),
|
|
14477
14518
|
headingLevel: external_exports.string().optional(),
|
|
14478
14519
|
columns: external_exports.enum(["2", "3", "4"]).default("3").catch("3"),
|
|
@@ -14488,6 +14529,7 @@ registerBuiltinBlock("Gallery", {
|
|
|
14488
14529
|
description: "Image grid with configurable columns and optional captions.",
|
|
14489
14530
|
category: "media",
|
|
14490
14531
|
fields: {
|
|
14532
|
+
tone: f.tone(),
|
|
14491
14533
|
title: f.text("Section title"),
|
|
14492
14534
|
columns: { kind: "enum", label: "Columns", options: ["2", "3", "4"], inlineEditable: false },
|
|
14493
14535
|
headingLevel: f.headingLevel()
|
|
@@ -14508,6 +14550,7 @@ registerBuiltinBlock("Gallery", {
|
|
|
14508
14550
|
// ../shared/src/blocks/tabs.ts
|
|
14509
14551
|
registerBuiltinBlock("Tabs", {
|
|
14510
14552
|
schema: external_exports.object({
|
|
14553
|
+
tone: external_exports.enum(["default", "panel", "inverse"]).optional(),
|
|
14511
14554
|
title: external_exports.string().optional(),
|
|
14512
14555
|
tabs: external_exports.array(external_exports.object({
|
|
14513
14556
|
id: external_exports.string().optional(),
|
|
@@ -14519,7 +14562,7 @@ registerBuiltinBlock("Tabs", {
|
|
|
14519
14562
|
displayName: "Tabs",
|
|
14520
14563
|
description: "Switchable tabbed content panels with rich text in each tab.",
|
|
14521
14564
|
category: "content",
|
|
14522
|
-
fields: { title: f.text("Section title"), headingLevel: f.headingLevel() },
|
|
14565
|
+
fields: { tone: f.tone(), title: f.text("Section title"), headingLevel: f.headingLevel() },
|
|
14523
14566
|
listFields: {
|
|
14524
14567
|
tabs: {
|
|
14525
14568
|
label: "Tabs",
|
|
@@ -14535,6 +14578,7 @@ registerBuiltinBlock("Tabs", {
|
|
|
14535
14578
|
// ../shared/src/blocks/table.ts
|
|
14536
14579
|
registerBuiltinBlock("Table", {
|
|
14537
14580
|
schema: external_exports.object({
|
|
14581
|
+
tone: external_exports.enum(["default", "panel", "inverse"]).optional(),
|
|
14538
14582
|
title: external_exports.string().optional(),
|
|
14539
14583
|
headingLevel: external_exports.string().optional(),
|
|
14540
14584
|
headers: external_exports.array(external_exports.string().min(1)).min(1),
|
|
@@ -14546,6 +14590,7 @@ registerBuiltinBlock("Table", {
|
|
|
14546
14590
|
description: "Data table with column headers, rows, and optional stripe styling. Headers is a string array. Rows is a 2D string array where each inner array is one row matching the headers order.",
|
|
14547
14591
|
category: "content",
|
|
14548
14592
|
fields: {
|
|
14593
|
+
tone: f.tone(),
|
|
14549
14594
|
title: f.text("Section title"),
|
|
14550
14595
|
headingLevel: f.headingLevel(),
|
|
14551
14596
|
// Both are lists of scalars, which `FieldKind` cannot name — the panel
|
|
@@ -14561,6 +14606,7 @@ registerBuiltinBlock("Table", {
|
|
|
14561
14606
|
// ../shared/src/blocks/quote.ts
|
|
14562
14607
|
registerBuiltinBlock("Quote", {
|
|
14563
14608
|
schema: external_exports.object({
|
|
14609
|
+
tone: external_exports.enum(["default", "panel", "inverse"]).optional(),
|
|
14564
14610
|
quote: external_exports.string().min(1),
|
|
14565
14611
|
author: external_exports.string().optional(),
|
|
14566
14612
|
role: external_exports.string().optional(),
|
|
@@ -14572,6 +14618,7 @@ registerBuiltinBlock("Quote", {
|
|
|
14572
14618
|
description: "Pull quote or blockquote with optional author attribution and avatar.",
|
|
14573
14619
|
category: "content",
|
|
14574
14620
|
fields: {
|
|
14621
|
+
tone: f.tone(),
|
|
14575
14622
|
quote: f.richtext("Quote text"),
|
|
14576
14623
|
author: f.text("Author name"),
|
|
14577
14624
|
role: f.text("Author role / title"),
|
|
@@ -14584,6 +14631,7 @@ registerBuiltinBlock("Quote", {
|
|
|
14584
14631
|
// ../shared/src/blocks/video.ts
|
|
14585
14632
|
registerBuiltinBlock("Video", {
|
|
14586
14633
|
schema: external_exports.object({
|
|
14634
|
+
tone: external_exports.enum(["default", "panel", "inverse"]).optional(),
|
|
14587
14635
|
src: external_exports.string().min(1),
|
|
14588
14636
|
title: external_exports.string().optional(),
|
|
14589
14637
|
posterUrl: external_exports.string().optional(),
|
|
@@ -14595,6 +14643,7 @@ registerBuiltinBlock("Video", {
|
|
|
14595
14643
|
description: "Video player \u2014 supports YouTube, Vimeo URLs, or direct video files (mp4, webm). Auto-detects source type.",
|
|
14596
14644
|
category: "media",
|
|
14597
14645
|
fields: {
|
|
14646
|
+
tone: f.tone(),
|
|
14598
14647
|
src: f.url("Video URL"),
|
|
14599
14648
|
title: f.text("Title / caption"),
|
|
14600
14649
|
posterUrl: f.image("Poster image", { aspectRatio: "landscape", width: 1200, height: 675 }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{P as b}from"./chunk-2CNEFIQP-
|
|
1
|
+
import{P as b}from"./chunk-2CNEFIQP-BR7PU-7I.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-B8SYzh7-.js";import{r as s,j as g}from"./index-6vx1HRlR.js";import{E as N,u as U}from"./index-Ig3LRGy0.js";import"./index-CTnBzh7l.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};
|