@vigilkids/section-renderer-vue 0.2.2 → 0.5.1

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.
Files changed (73) hide show
  1. package/dist/interactions/vigilkids.d.ts +44 -1
  2. package/dist/interactions/vigilkids.mjs +115 -1
  3. package/dist/sections/article/index.mjs +60 -0
  4. package/dist/sections/article/prosemirror.d.ts +2 -0
  5. package/dist/sections/article/prosemirror.mjs +8 -0
  6. package/dist/sections/article/vigilkids/ArticleFaq.vue +9 -2
  7. package/dist/sections/article/vigilkids/ArticleFaqItem.d.vue.ts +3 -0
  8. package/dist/sections/article/vigilkids/ArticleFaqItem.vue +18 -18
  9. package/dist/sections/article/vigilkids/ArticleFaqItem.vue.d.ts +3 -0
  10. package/dist/sections/article/vigilkids/ArticleHeading.vue +2 -1
  11. package/dist/sections/article/vigilkids/ArticleHighlightParagraph.d.vue.ts +21 -0
  12. package/dist/sections/article/vigilkids/ArticleHighlightParagraph.vue +38 -0
  13. package/dist/sections/article/vigilkids/ArticleHighlightParagraph.vue.d.ts +21 -0
  14. package/dist/sections/article/vigilkids/ArticleProductCard.d.vue.ts +21 -0
  15. package/dist/sections/article/vigilkids/ArticleProductCard.vue +59 -0
  16. package/dist/sections/article/vigilkids/ArticleProductCard.vue.d.ts +21 -0
  17. package/dist/sections/article/vigilkids/ArticleProductInfoBanner.d.vue.ts +21 -0
  18. package/dist/sections/article/vigilkids/ArticleProductInfoBanner.vue +56 -0
  19. package/dist/sections/article/vigilkids/ArticleProductInfoBanner.vue.d.ts +21 -0
  20. package/dist/sections/article/vigilkids/ArticleRelatedArticles.d.vue.ts +21 -0
  21. package/dist/sections/article/vigilkids/ArticleRelatedArticles.vue +92 -0
  22. package/dist/sections/article/vigilkids/ArticleRelatedArticles.vue.d.ts +21 -0
  23. package/dist/sections/article/vigilkids/ArticleRetentionBanner.d.vue.ts +21 -0
  24. package/dist/sections/article/vigilkids/ArticleRetentionBanner.vue +101 -0
  25. package/dist/sections/article/vigilkids/ArticleRetentionBanner.vue.d.ts +21 -0
  26. package/dist/sections/article/vigilkids/ArticleSectionIntro.d.vue.ts +21 -0
  27. package/dist/sections/article/vigilkids/ArticleSectionIntro.vue +63 -0
  28. package/dist/sections/article/vigilkids/ArticleSectionIntro.vue.d.ts +21 -0
  29. package/dist/sections/article/vigilkids/ArticleStepList.vue +11 -6
  30. package/dist/sections/article/vigilkids/ArticleStyledHeading.d.vue.ts +21 -0
  31. package/dist/sections/article/vigilkids/ArticleStyledHeading.vue +48 -0
  32. package/dist/sections/article/vigilkids/ArticleStyledHeading.vue.d.ts +21 -0
  33. package/dist/sections/article/vigilkids/ArticleSubheading.vue +5 -4
  34. package/dist/sections/article/vigilkids/ArticleTable.d.vue.ts +13 -1
  35. package/dist/sections/article/vigilkids/ArticleTable.vue +26 -6
  36. package/dist/sections/article/vigilkids/ArticleTable.vue.d.ts +13 -1
  37. package/dist/sections/article/vigilkids/ArticleTipNote.d.vue.ts +21 -0
  38. package/dist/sections/article/vigilkids/ArticleTipNote.vue +59 -0
  39. package/dist/sections/article/vigilkids/ArticleTipNote.vue.d.ts +21 -0
  40. package/dist/sections/article/vigilkids/ArticleToc.vue +22 -7
  41. package/dist/sections/article/vigilkids/ArticleTocList.d.vue.ts +21 -0
  42. package/dist/sections/article/vigilkids/ArticleTocList.vue +63 -0
  43. package/dist/sections/article/vigilkids/ArticleTocList.vue.d.ts +21 -0
  44. package/dist/sections/article/vigilkids/ArticleTopAd.d.vue.ts +21 -0
  45. package/dist/sections/article/vigilkids/ArticleTopAd.vue +99 -0
  46. package/dist/sections/article/vigilkids/ArticleTopAd.vue.d.ts +21 -0
  47. package/dist/sections/article/vigilkids/product-card/ProductCardCtaGroup.d.vue.ts +6 -0
  48. package/dist/sections/article/vigilkids/product-card/ProductCardCtaGroup.vue +21 -0
  49. package/dist/sections/article/vigilkids/product-card/ProductCardCtaGroup.vue.d.ts +6 -0
  50. package/dist/sections/article/vigilkids/product-card/ProductCardVariantA.d.vue.ts +21 -0
  51. package/dist/sections/article/vigilkids/product-card/ProductCardVariantA.vue +46 -0
  52. package/dist/sections/article/vigilkids/product-card/ProductCardVariantA.vue.d.ts +21 -0
  53. package/dist/sections/article/vigilkids/product-card/ProductCardVariantB.d.vue.ts +21 -0
  54. package/dist/sections/article/vigilkids/product-card/ProductCardVariantB.vue +46 -0
  55. package/dist/sections/article/vigilkids/product-card/ProductCardVariantB.vue.d.ts +21 -0
  56. package/dist/sections/article/vigilkids/product-card/ProductCardVariantC.d.vue.ts +21 -0
  57. package/dist/sections/article/vigilkids/product-card/ProductCardVariantC.vue +46 -0
  58. package/dist/sections/article/vigilkids/product-card/ProductCardVariantC.vue.d.ts +21 -0
  59. package/dist/sections/article/vigilkids/product-card/ProductCardVariantD.d.vue.ts +21 -0
  60. package/dist/sections/article/vigilkids/product-card/ProductCardVariantD.vue +58 -0
  61. package/dist/sections/article/vigilkids/product-card/ProductCardVariantD.vue.d.ts +21 -0
  62. package/dist/sections/article/vigilkids/product-card/ProductCardVariantE.d.vue.ts +21 -0
  63. package/dist/sections/article/vigilkids/product-card/ProductCardVariantE.vue +60 -0
  64. package/dist/sections/article/vigilkids/product-card/ProductCardVariantE.vue.d.ts +21 -0
  65. package/dist/sections/article/vigilkids/product-card/ProductCardVariantF.d.vue.ts +21 -0
  66. package/dist/sections/article/vigilkids/product-card/ProductCardVariantF.vue +65 -0
  67. package/dist/sections/article/vigilkids/product-card/ProductCardVariantF.vue.d.ts +21 -0
  68. package/dist/sections/article/vigilkids/product-card/ProductCardVariantG.d.vue.ts +21 -0
  69. package/dist/sections/article/vigilkids/product-card/ProductCardVariantG.vue +55 -0
  70. package/dist/sections/article/vigilkids/product-card/ProductCardVariantG.vue.d.ts +21 -0
  71. package/dist/styles/products/vigilkids.css +1 -1
  72. package/dist/styles/products/visiva.css +1 -1
  73. package/package.json +13 -10
@@ -0,0 +1,21 @@
1
+ import type { BlockData } from '@vigilkids/section-core';
2
+ type __VLS_Props = {
3
+ blockOrder: string[];
4
+ blocks: Record<string, BlockData>;
5
+ editorMode?: boolean;
6
+ settings: Record<string, unknown>;
7
+ };
8
+ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
9
+ "update:setting": (key: string, value: unknown) => any;
10
+ "update:block-setting": (blockId: string, key: string, value: unknown) => any;
11
+ "inline-edit-start": (key: string) => any;
12
+ "inline-edit-end": () => any;
13
+ "undo-redo": (action: "redo" | "undo") => any;
14
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
15
+ "onUpdate:setting"?: ((key: string, value: unknown) => any) | undefined;
16
+ "onUpdate:block-setting"?: ((blockId: string, key: string, value: unknown) => any) | undefined;
17
+ "onInline-edit-start"?: ((key: string) => any) | undefined;
18
+ "onInline-edit-end"?: (() => any) | undefined;
19
+ "onUndo-redo"?: ((action: "redo" | "undo") => any) | undefined;
20
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
21
+ export default _default;
@@ -0,0 +1,46 @@
1
+ <script setup lang="ts">
2
+ import type { BlockData } from '@vigilkids/section-core'
3
+
4
+ import { computed } from 'vue'
5
+
6
+ import { useInlineEdit } from '../../../../composables/useInlineEdit'
7
+ import ProductCardCtaGroup from './ProductCardCtaGroup.vue'
8
+
9
+ // Variant C: 手机截图横向(product-card-image)
10
+ const props = defineProps<{
11
+ blockOrder: string[]
12
+ blocks: Record<string, BlockData>
13
+ editorMode?: boolean
14
+ settings: Record<string, unknown>
15
+ }>()
16
+
17
+ const emit = defineEmits<{
18
+ (e: 'update:setting', key: string, value: unknown): void
19
+ (e: 'update:block-setting', blockId: string, key: string, value: unknown): void
20
+ (e: 'inline-edit-start', key: string): void
21
+ (e: 'inline-edit-end'): void
22
+ (e: 'undo-redo', action: 'redo' | 'undo'): void
23
+ }>()
24
+
25
+ const s = computed(() => props.settings)
26
+
27
+ const { editableAttrs } = useInlineEdit({
28
+ editorMode: () => !!props.editorMode,
29
+ onSettingUpdate: (key, value) => emit('update:setting', key, value),
30
+ onBlockSettingUpdate: (blockId, key, value) => emit('update:block-setting', blockId, key, value),
31
+ onEditStart: key => emit('inline-edit-start', key),
32
+ onEditEnd: () => emit('inline-edit-end'),
33
+ onUndoRedo: action => emit('undo-redo', action),
34
+ })
35
+ </script>
36
+
37
+ <template>
38
+ <img :src="(s.image_url as string) || ''" :alt="(s.image_alt as string) || ''">
39
+ <div>
40
+ <!-- eslint-disable-next-line vue/no-v-html -->
41
+ <p class="product-name" v-bind="editableAttrs('product_name')" v-html="s.product_name" />
42
+ <!-- eslint-disable-next-line vue/no-v-html -->
43
+ <p class="product-desc" v-bind="editableAttrs('product_desc')" v-html="s.product_desc" />
44
+ <ProductCardCtaGroup :s="s" :editable-attrs="editableAttrs" />
45
+ </div>
46
+ </template>
@@ -0,0 +1,21 @@
1
+ import type { BlockData } from '@vigilkids/section-core';
2
+ type __VLS_Props = {
3
+ blockOrder: string[];
4
+ blocks: Record<string, BlockData>;
5
+ editorMode?: boolean;
6
+ settings: Record<string, unknown>;
7
+ };
8
+ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
9
+ "update:setting": (key: string, value: unknown) => any;
10
+ "update:block-setting": (blockId: string, key: string, value: unknown) => any;
11
+ "inline-edit-start": (key: string) => any;
12
+ "inline-edit-end": () => any;
13
+ "undo-redo": (action: "redo" | "undo") => any;
14
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
15
+ "onUpdate:setting"?: ((key: string, value: unknown) => any) | undefined;
16
+ "onUpdate:block-setting"?: ((blockId: string, key: string, value: unknown) => any) | undefined;
17
+ "onInline-edit-start"?: ((key: string) => any) | undefined;
18
+ "onInline-edit-end"?: (() => any) | undefined;
19
+ "onUndo-redo"?: ((action: "redo" | "undo") => any) | undefined;
20
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
21
+ export default _default;
@@ -0,0 +1,21 @@
1
+ import type { BlockData } from '@vigilkids/section-core';
2
+ type __VLS_Props = {
3
+ blockOrder: string[];
4
+ blocks: Record<string, BlockData>;
5
+ editorMode?: boolean;
6
+ settings: Record<string, unknown>;
7
+ };
8
+ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
9
+ "update:setting": (key: string, value: unknown) => any;
10
+ "update:block-setting": (blockId: string, key: string, value: unknown) => any;
11
+ "inline-edit-start": (key: string) => any;
12
+ "inline-edit-end": () => any;
13
+ "undo-redo": (action: "redo" | "undo") => any;
14
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
15
+ "onUpdate:setting"?: ((key: string, value: unknown) => any) | undefined;
16
+ "onUpdate:block-setting"?: ((blockId: string, key: string, value: unknown) => any) | undefined;
17
+ "onInline-edit-start"?: ((key: string) => any) | undefined;
18
+ "onInline-edit-end"?: (() => any) | undefined;
19
+ "onUndo-redo"?: ((action: "redo" | "undo") => any) | undefined;
20
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
21
+ export default _default;
@@ -0,0 +1,58 @@
1
+ <script setup lang="ts">
2
+ import type { BlockData } from '@vigilkids/section-core'
3
+
4
+ import { computed } from 'vue'
5
+
6
+ import { useInlineEdit } from '../../../../composables/useInlineEdit'
7
+ import { renderInlineContent } from '../../prosemirror'
8
+ import ProductCardCtaGroup from './ProductCardCtaGroup.vue'
9
+
10
+ const props = defineProps<{
11
+ blockOrder: string[]
12
+ blocks: Record<string, BlockData>
13
+ editorMode?: boolean
14
+ settings: Record<string, unknown>
15
+ }>()
16
+
17
+ const emit = defineEmits<{
18
+ (e: 'update:setting', key: string, value: unknown): void
19
+ (e: 'update:block-setting', blockId: string, key: string, value: unknown): void
20
+ (e: 'inline-edit-start', key: string): void
21
+ (e: 'inline-edit-end'): void
22
+ (e: 'undo-redo', action: 'redo' | 'undo'): void
23
+ }>()
24
+
25
+ const s = computed(() => props.settings)
26
+
27
+ const featureDots = computed(() =>
28
+ props.blockOrder
29
+ .filter(id => props.blocks[id]?.type === 'feature_dot')
30
+ .map(id => ({
31
+ id,
32
+ block: props.blocks[id]!,
33
+ renderedText: renderInlineContent(props.blocks[id]!.settings.text),
34
+ })),
35
+ )
36
+
37
+ const { editableAttrs, blockEditableAttrs } = useInlineEdit({
38
+ editorMode: () => !!props.editorMode,
39
+ onSettingUpdate: (key, value) => emit('update:setting', key, value),
40
+ onBlockSettingUpdate: (blockId, key, value) => emit('update:block-setting', blockId, key, value),
41
+ onEditStart: key => emit('inline-edit-start', key),
42
+ onEditEnd: () => emit('inline-edit-end'),
43
+ onUndoRedo: action => emit('undo-redo', action),
44
+ })
45
+ </script>
46
+
47
+ <template>
48
+ <img :src="(s.image_url as string) || ''" :alt="(s.image_alt as string) || ''">
49
+ <div>
50
+ <!-- eslint-disable-next-line vue/no-v-html -->
51
+ <p class="product-name" v-bind="editableAttrs('product_name')" v-html="s.product_name" />
52
+ <ul class="feature-dot-list">
53
+ <!-- eslint-disable-next-line vue/no-v-html -->
54
+ <li v-for="item in featureDots" :key="item.id" v-bind="blockEditableAttrs(item.id, 'text')" v-html="item.renderedText" />
55
+ </ul>
56
+ <ProductCardCtaGroup :s="s" :editable-attrs="editableAttrs" />
57
+ </div>
58
+ </template>
@@ -0,0 +1,21 @@
1
+ import type { BlockData } from '@vigilkids/section-core';
2
+ type __VLS_Props = {
3
+ blockOrder: string[];
4
+ blocks: Record<string, BlockData>;
5
+ editorMode?: boolean;
6
+ settings: Record<string, unknown>;
7
+ };
8
+ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
9
+ "update:setting": (key: string, value: unknown) => any;
10
+ "update:block-setting": (blockId: string, key: string, value: unknown) => any;
11
+ "inline-edit-start": (key: string) => any;
12
+ "inline-edit-end": () => any;
13
+ "undo-redo": (action: "redo" | "undo") => any;
14
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
15
+ "onUpdate:setting"?: ((key: string, value: unknown) => any) | undefined;
16
+ "onUpdate:block-setting"?: ((blockId: string, key: string, value: unknown) => any) | undefined;
17
+ "onInline-edit-start"?: ((key: string) => any) | undefined;
18
+ "onInline-edit-end"?: (() => any) | undefined;
19
+ "onUndo-redo"?: ((action: "redo" | "undo") => any) | undefined;
20
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
21
+ export default _default;
@@ -0,0 +1,21 @@
1
+ import type { BlockData } from '@vigilkids/section-core';
2
+ type __VLS_Props = {
3
+ blockOrder: string[];
4
+ blocks: Record<string, BlockData>;
5
+ editorMode?: boolean;
6
+ settings: Record<string, unknown>;
7
+ };
8
+ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
9
+ "update:setting": (key: string, value: unknown) => any;
10
+ "update:block-setting": (blockId: string, key: string, value: unknown) => any;
11
+ "inline-edit-start": (key: string) => any;
12
+ "inline-edit-end": () => any;
13
+ "undo-redo": (action: "redo" | "undo") => any;
14
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
15
+ "onUpdate:setting"?: ((key: string, value: unknown) => any) | undefined;
16
+ "onUpdate:block-setting"?: ((blockId: string, key: string, value: unknown) => any) | undefined;
17
+ "onInline-edit-start"?: ((key: string) => any) | undefined;
18
+ "onInline-edit-end"?: (() => any) | undefined;
19
+ "onUndo-redo"?: ((action: "redo" | "undo") => any) | undefined;
20
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
21
+ export default _default;
@@ -0,0 +1,60 @@
1
+ <script setup lang="ts">
2
+ import type { BlockData } from '@vigilkids/section-core'
3
+
4
+ import { computed } from 'vue'
5
+
6
+ import { useInlineEdit } from '../../../../composables/useInlineEdit'
7
+ import { renderInlineContent } from '../../prosemirror'
8
+ import ProductCardCtaGroup from './ProductCardCtaGroup.vue'
9
+
10
+ // Variant E: 两侧装饰 + feature-dot(product-card-split)
11
+ // 消费 feature_dot 类型的 blocks,渲染带圆点装饰的特性列表
12
+ const props = defineProps<{
13
+ blockOrder: string[]
14
+ blocks: Record<string, BlockData>
15
+ editorMode?: boolean
16
+ settings: Record<string, unknown>
17
+ }>()
18
+
19
+ const emit = defineEmits<{
20
+ (e: 'update:setting', key: string, value: unknown): void
21
+ (e: 'update:block-setting', blockId: string, key: string, value: unknown): void
22
+ (e: 'inline-edit-start', key: string): void
23
+ (e: 'inline-edit-end'): void
24
+ (e: 'undo-redo', action: 'redo' | 'undo'): void
25
+ }>()
26
+
27
+ const s = computed(() => props.settings)
28
+
29
+ const featureDots = computed(() =>
30
+ props.blockOrder
31
+ .filter(id => props.blocks[id]?.type === 'feature_dot')
32
+ .map(id => ({
33
+ id,
34
+ block: props.blocks[id]!,
35
+ renderedText: renderInlineContent(props.blocks[id]!.settings.text),
36
+ })),
37
+ )
38
+
39
+ const { editableAttrs, blockEditableAttrs } = useInlineEdit({
40
+ editorMode: () => !!props.editorMode,
41
+ onSettingUpdate: (key, value) => emit('update:setting', key, value),
42
+ onBlockSettingUpdate: (blockId, key, value) => emit('update:block-setting', blockId, key, value),
43
+ onEditStart: key => emit('inline-edit-start', key),
44
+ onEditEnd: () => emit('inline-edit-end'),
45
+ onUndoRedo: action => emit('undo-redo', action),
46
+ })
47
+ </script>
48
+
49
+ <template>
50
+ <img :src="(s.image_url as string) || ''" :alt="(s.image_alt as string) || ''">
51
+ <div>
52
+ <!-- eslint-disable-next-line vue/no-v-html -->
53
+ <p class="split-product-name product-name" v-bind="editableAttrs('product_name')" v-html="s.product_name" />
54
+ <ul class="feature-dot-list">
55
+ <!-- eslint-disable-next-line vue/no-v-html -->
56
+ <li v-for="item in featureDots" :key="item.id" v-bind="blockEditableAttrs(item.id, 'text')" v-html="item.renderedText" />
57
+ </ul>
58
+ <ProductCardCtaGroup :s="s" :editable-attrs="editableAttrs" />
59
+ </div>
60
+ </template>
@@ -0,0 +1,21 @@
1
+ import type { BlockData } from '@vigilkids/section-core';
2
+ type __VLS_Props = {
3
+ blockOrder: string[];
4
+ blocks: Record<string, BlockData>;
5
+ editorMode?: boolean;
6
+ settings: Record<string, unknown>;
7
+ };
8
+ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
9
+ "update:setting": (key: string, value: unknown) => any;
10
+ "update:block-setting": (blockId: string, key: string, value: unknown) => any;
11
+ "inline-edit-start": (key: string) => any;
12
+ "inline-edit-end": () => any;
13
+ "undo-redo": (action: "redo" | "undo") => any;
14
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
15
+ "onUpdate:setting"?: ((key: string, value: unknown) => any) | undefined;
16
+ "onUpdate:block-setting"?: ((blockId: string, key: string, value: unknown) => any) | undefined;
17
+ "onInline-edit-start"?: ((key: string) => any) | undefined;
18
+ "onInline-edit-end"?: (() => any) | undefined;
19
+ "onUndo-redo"?: ((action: "redo" | "undo") => any) | undefined;
20
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
21
+ export default _default;
@@ -0,0 +1,21 @@
1
+ import type { BlockData } from '@vigilkids/section-core';
2
+ type __VLS_Props = {
3
+ blockOrder: string[];
4
+ blocks: Record<string, BlockData>;
5
+ editorMode?: boolean;
6
+ settings: Record<string, unknown>;
7
+ };
8
+ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
9
+ "update:setting": (key: string, value: unknown) => any;
10
+ "update:block-setting": (blockId: string, key: string, value: unknown) => any;
11
+ "inline-edit-start": (key: string) => any;
12
+ "inline-edit-end": () => any;
13
+ "undo-redo": (action: "redo" | "undo") => any;
14
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
15
+ "onUpdate:setting"?: ((key: string, value: unknown) => any) | undefined;
16
+ "onUpdate:block-setting"?: ((blockId: string, key: string, value: unknown) => any) | undefined;
17
+ "onInline-edit-start"?: ((key: string) => any) | undefined;
18
+ "onInline-edit-end"?: (() => any) | undefined;
19
+ "onUndo-redo"?: ((action: "redo" | "undo") => any) | undefined;
20
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
21
+ export default _default;
@@ -0,0 +1,65 @@
1
+ <script setup lang="ts">
2
+ import type { BlockData } from '@vigilkids/section-core'
3
+
4
+ import { computed } from 'vue'
5
+
6
+ import { useInlineEdit } from '../../../../composables/useInlineEdit'
7
+ import { renderInlineContent } from '../../prosemirror'
8
+
9
+ const props = defineProps<{
10
+ blockOrder: string[]
11
+ blocks: Record<string, BlockData>
12
+ editorMode?: boolean
13
+ settings: Record<string, unknown>
14
+ }>()
15
+
16
+ const emit = defineEmits<{
17
+ (e: 'update:setting', key: string, value: unknown): void
18
+ (e: 'update:block-setting', blockId: string, key: string, value: unknown): void
19
+ (e: 'inline-edit-start', key: string): void
20
+ (e: 'inline-edit-end'): void
21
+ (e: 'undo-redo', action: 'redo' | 'undo'): void
22
+ }>()
23
+
24
+ const s = computed(() => props.settings)
25
+
26
+ const featureChecks = computed(() =>
27
+ props.blockOrder
28
+ .filter(id => props.blocks[id]?.type === 'feature_check')
29
+ .map(id => ({
30
+ id,
31
+ block: props.blocks[id]!,
32
+ renderedText: renderInlineContent(props.blocks[id]!.settings.text),
33
+ })),
34
+ )
35
+
36
+ const { editableAttrs, blockEditableAttrs } = useInlineEdit({
37
+ editorMode: () => !!props.editorMode,
38
+ onSettingUpdate: (key, value) => emit('update:setting', key, value),
39
+ onBlockSettingUpdate: (blockId, key, value) => emit('update:block-setting', blockId, key, value),
40
+ onEditStart: key => emit('inline-edit-start', key),
41
+ onEditEnd: () => emit('inline-edit-end'),
42
+ onUndoRedo: action => emit('undo-redo', action),
43
+ })
44
+ </script>
45
+
46
+ <template>
47
+ <div class="card-vertical-left">
48
+ <div class="card-vertical-header">
49
+ <img :src="(s.image_url as string) || ''" :alt="(s.image_alt as string) || ''">
50
+ <!-- eslint-disable-next-line vue/no-v-html -->
51
+ <p class="product-name" v-bind="editableAttrs('product_name')" v-html="s.product_name" />
52
+ </div>
53
+ <ul class="feature-check-list">
54
+ <!-- eslint-disable-next-line vue/no-v-html -->
55
+ <li v-for="item in featureChecks" :key="item.id" v-bind="blockEditableAttrs(item.id, 'text')" v-html="item.renderedText" />
56
+ </ul>
57
+ </div>
58
+ <div class="card-vertical-divider" />
59
+ <div class="card-vertical-right">
60
+ <!-- eslint-disable-next-line vue/no-v-html -->
61
+ <a :href="(s.cta_primary_url as string) || '#'" class="action-btn-primary" v-bind="editableAttrs('cta_primary_label')" v-html="s.cta_primary_label" />
62
+ <!-- eslint-disable-next-line vue/no-v-html -->
63
+ <a :href="(s.cta_outline_url as string) || '#'" class="action-btn-outline" v-bind="editableAttrs('cta_outline_label')" v-html="s.cta_outline_label" />
64
+ </div>
65
+ </template>
@@ -0,0 +1,21 @@
1
+ import type { BlockData } from '@vigilkids/section-core';
2
+ type __VLS_Props = {
3
+ blockOrder: string[];
4
+ blocks: Record<string, BlockData>;
5
+ editorMode?: boolean;
6
+ settings: Record<string, unknown>;
7
+ };
8
+ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
9
+ "update:setting": (key: string, value: unknown) => any;
10
+ "update:block-setting": (blockId: string, key: string, value: unknown) => any;
11
+ "inline-edit-start": (key: string) => any;
12
+ "inline-edit-end": () => any;
13
+ "undo-redo": (action: "redo" | "undo") => any;
14
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
15
+ "onUpdate:setting"?: ((key: string, value: unknown) => any) | undefined;
16
+ "onUpdate:block-setting"?: ((blockId: string, key: string, value: unknown) => any) | undefined;
17
+ "onInline-edit-start"?: ((key: string) => any) | undefined;
18
+ "onInline-edit-end"?: (() => any) | undefined;
19
+ "onUndo-redo"?: ((action: "redo" | "undo") => any) | undefined;
20
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
21
+ export default _default;
@@ -0,0 +1,21 @@
1
+ import type { BlockData } from '@vigilkids/section-core';
2
+ type __VLS_Props = {
3
+ blockOrder: string[];
4
+ blocks: Record<string, BlockData>;
5
+ editorMode?: boolean;
6
+ settings: Record<string, unknown>;
7
+ };
8
+ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
9
+ "update:setting": (key: string, value: unknown) => any;
10
+ "update:block-setting": (blockId: string, key: string, value: unknown) => any;
11
+ "inline-edit-start": (key: string) => any;
12
+ "inline-edit-end": () => any;
13
+ "undo-redo": (action: "redo" | "undo") => any;
14
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
15
+ "onUpdate:setting"?: ((key: string, value: unknown) => any) | undefined;
16
+ "onUpdate:block-setting"?: ((blockId: string, key: string, value: unknown) => any) | undefined;
17
+ "onInline-edit-start"?: ((key: string) => any) | undefined;
18
+ "onInline-edit-end"?: (() => any) | undefined;
19
+ "onUndo-redo"?: ((action: "redo" | "undo") => any) | undefined;
20
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
21
+ export default _default;
@@ -0,0 +1,55 @@
1
+ <script setup lang="ts">
2
+ import type { BlockData } from '@vigilkids/section-core'
3
+
4
+ import { computed } from 'vue'
5
+
6
+ import { useInlineEdit } from '../../../../composables/useInlineEdit'
7
+ import { renderInlineContent } from '../../prosemirror'
8
+ import ProductCardCtaGroup from './ProductCardCtaGroup.vue'
9
+
10
+ const props = defineProps<{
11
+ blockOrder: string[]
12
+ blocks: Record<string, BlockData>
13
+ editorMode?: boolean
14
+ settings: Record<string, unknown>
15
+ }>()
16
+
17
+ const emit = defineEmits<{
18
+ (e: 'update:setting', key: string, value: unknown): void
19
+ (e: 'update:block-setting', blockId: string, key: string, value: unknown): void
20
+ (e: 'inline-edit-start', key: string): void
21
+ (e: 'inline-edit-end'): void
22
+ (e: 'undo-redo', action: 'redo' | 'undo'): void
23
+ }>()
24
+
25
+ const s = computed(() => props.settings)
26
+
27
+ const featureItems = computed(() =>
28
+ props.blockOrder
29
+ .filter(id => props.blocks[id]?.type === 'feature_item')
30
+ .map(id => ({
31
+ id,
32
+ block: props.blocks[id]!,
33
+ renderedText: renderInlineContent(props.blocks[id]!.settings.text),
34
+ })),
35
+ )
36
+
37
+ const { editableAttrs, blockEditableAttrs } = useInlineEdit({
38
+ editorMode: () => !!props.editorMode,
39
+ onSettingUpdate: (key, value) => emit('update:setting', key, value),
40
+ onBlockSettingUpdate: (blockId, key, value) => emit('update:block-setting', blockId, key, value),
41
+ onEditStart: key => emit('inline-edit-start', key),
42
+ onEditEnd: () => emit('inline-edit-end'),
43
+ onUndoRedo: action => emit('undo-redo', action),
44
+ })
45
+ </script>
46
+
47
+ <template>
48
+ <!-- eslint-disable-next-line vue/no-v-html -->
49
+ <p class="product-name" v-bind="editableAttrs('product_name')" v-html="s.product_name" />
50
+ <ul class="product-feature-list">
51
+ <!-- eslint-disable-next-line vue/no-v-html -->
52
+ <li v-for="item in featureItems" :key="item.id" v-bind="blockEditableAttrs(item.id, 'text')" v-html="item.renderedText" />
53
+ </ul>
54
+ <ProductCardCtaGroup :s="s" :editable-attrs="editableAttrs" />
55
+ </template>
@@ -0,0 +1,21 @@
1
+ import type { BlockData } from '@vigilkids/section-core';
2
+ type __VLS_Props = {
3
+ blockOrder: string[];
4
+ blocks: Record<string, BlockData>;
5
+ editorMode?: boolean;
6
+ settings: Record<string, unknown>;
7
+ };
8
+ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
9
+ "update:setting": (key: string, value: unknown) => any;
10
+ "update:block-setting": (blockId: string, key: string, value: unknown) => any;
11
+ "inline-edit-start": (key: string) => any;
12
+ "inline-edit-end": () => any;
13
+ "undo-redo": (action: "redo" | "undo") => any;
14
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
15
+ "onUpdate:setting"?: ((key: string, value: unknown) => any) | undefined;
16
+ "onUpdate:block-setting"?: ((blockId: string, key: string, value: unknown) => any) | undefined;
17
+ "onInline-edit-start"?: ((key: string) => any) | undefined;
18
+ "onInline-edit-end"?: (() => any) | undefined;
19
+ "onUndo-redo"?: ((action: "redo" | "undo") => any) | undefined;
20
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
21
+ export default _default;