cardbuddy 0.6.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.
Files changed (167) hide show
  1. package/README.md +211 -0
  2. package/dist/cli.js +76 -0
  3. package/dist/config.js +63 -0
  4. package/dist/core.js +2 -0
  5. package/dist/preview-editor/assets/apple-touch-icon-BQcES9QK.png +0 -0
  6. package/dist/preview-editor/assets/default-image-wzZYQ86K.png +0 -0
  7. package/dist/preview-editor/assets/favicon-16-Cg6Nrosk.png +0 -0
  8. package/dist/preview-editor/assets/favicon-32-B_1744sp.png +0 -0
  9. package/dist/preview-editor/assets/index-BYB0hngG.js +72 -0
  10. package/dist/preview-editor/assets/index-CpBZEQDy.css +1 -0
  11. package/dist/preview-editor/assets/site-icon-CFMif8z4.png +0 -0
  12. package/dist/preview-editor/assets/svg-symbols-B2exBrAr.svg +118 -0
  13. package/dist/preview-editor/index.html +17 -0
  14. package/dist/server-core/_vendor/finmall-env.mjs +96 -0
  15. package/dist/server-core/assetProxy.js +154 -0
  16. package/dist/server-core/bbox.js +153 -0
  17. package/dist/server-core/browser.js +108 -0
  18. package/dist/server-core/buildDataFromSchema.js +50 -0
  19. package/dist/server-core/cardFiles.js +188 -0
  20. package/dist/server-core/cardHistory.js +156 -0
  21. package/dist/server-core/cardImage.js +85 -0
  22. package/dist/server-core/cardImportMeta.js +139 -0
  23. package/dist/server-core/cardListCache.js +68 -0
  24. package/dist/server-core/cardOpenFolder.js +135 -0
  25. package/dist/server-core/cardSave.js +127 -0
  26. package/dist/server-core/cardSidecar.js +72 -0
  27. package/dist/server-core/cardSync.js +259 -0
  28. package/dist/server-core/cardValidate.js +134 -0
  29. package/dist/server-core/index.js +82 -0
  30. package/dist/server-core/logger.js +241 -0
  31. package/dist/server-core/nodeModels.js +52 -0
  32. package/dist/server-core/renderStatus.js +207 -0
  33. package/dist/server-core/screenshot.js +123 -0
  34. package/dist/server-core/sliceStatic.js +44 -0
  35. package/dist/standalone.js +447 -0
  36. package/dist/vendored/App.vue +2330 -0
  37. package/dist/vendored/api.js +142 -0
  38. package/dist/vendored/assets/apple-touch-icon.png +0 -0
  39. package/dist/vendored/assets/default-image.png +0 -0
  40. package/dist/vendored/assets/favicon-16.png +0 -0
  41. package/dist/vendored/assets/favicon-32.png +0 -0
  42. package/dist/vendored/assets/logo.png +0 -0
  43. package/dist/vendored/assets/site-icon.png +0 -0
  44. package/dist/vendored/assets/svg-symbols.svg +118 -0
  45. package/dist/vendored/assets/svgIcons/icons.svg +54 -0
  46. package/dist/vendored/assets/svgIcons/index.js +39 -0
  47. package/dist/vendored/components/AbsoluteLayout.vue +42 -0
  48. package/dist/vendored/components/AlertCardInstance.vue +58 -0
  49. package/dist/vendored/components/AlertCardLayer.vue +59 -0
  50. package/dist/vendored/components/ApiPayloadTree.vue +168 -0
  51. package/dist/vendored/components/AppToast.vue +37 -0
  52. package/dist/vendored/components/Button.vue +37 -0
  53. package/dist/vendored/components/Canvas.vue +65 -0
  54. package/dist/vendored/components/CardGallery.vue +243 -0
  55. package/dist/vendored/components/CardPreview.vue +72 -0
  56. package/dist/vendored/components/CardSelect.vue +200 -0
  57. package/dist/vendored/components/CheckGroup.vue +131 -0
  58. package/dist/vendored/components/Column.vue +25 -0
  59. package/dist/vendored/components/ComponentPalette.vue +294 -0
  60. package/dist/vendored/components/ConfirmDialog.vue +39 -0
  61. package/dist/vendored/components/CustomPlaceholder.vue +33 -0
  62. package/dist/vendored/components/DatePickerOverlay.vue +345 -0
  63. package/dist/vendored/components/DebugPanel.vue +806 -0
  64. package/dist/vendored/components/DeviceOverlay.vue +70 -0
  65. package/dist/vendored/components/Divider.vue +22 -0
  66. package/dist/vendored/components/Dropdown.vue +191 -0
  67. package/dist/vendored/components/EventEditor.vue +247 -0
  68. package/dist/vendored/components/GridLayout.vue +67 -0
  69. package/dist/vendored/components/HoverGuides.vue +122 -0
  70. package/dist/vendored/components/Icon.vue +34 -0
  71. package/dist/vendored/components/Image.vue +34 -0
  72. package/dist/vendored/components/Input.vue +90 -0
  73. package/dist/vendored/components/JsonTree.vue +516 -0
  74. package/dist/vendored/components/ListLayout.vue +68 -0
  75. package/dist/vendored/components/LogValue.vue +51 -0
  76. package/dist/vendored/components/Map.vue +110 -0
  77. package/dist/vendored/components/MultiColumn.vue +49 -0
  78. package/dist/vendored/components/MultiText.vue +58 -0
  79. package/dist/vendored/components/NodeInspector.vue +295 -0
  80. package/dist/vendored/components/PickerOverlay.vue +131 -0
  81. package/dist/vendored/components/ProgressSlider.vue +167 -0
  82. package/dist/vendored/components/PropControl.vue +241 -0
  83. package/dist/vendored/components/PropTree.vue +128 -0
  84. package/dist/vendored/components/RadioButton.vue +74 -0
  85. package/dist/vendored/components/RemotePreview.vue +171 -0
  86. package/dist/vendored/components/RenderTree.vue +437 -0
  87. package/dist/vendored/components/Root.vue +30 -0
  88. package/dist/vendored/components/Row.vue +25 -0
  89. package/dist/vendored/components/SelectionOverlay.vue +105 -0
  90. package/dist/vendored/components/StructureTree.vue +949 -0
  91. package/dist/vendored/components/SvgCode.vue +19 -0
  92. package/dist/vendored/components/SvgSymbols.vue +30 -0
  93. package/dist/vendored/components/Switch.vue +38 -0
  94. package/dist/vendored/components/Text.vue +32 -0
  95. package/dist/vendored/components/Video.vue +70 -0
  96. package/dist/vendored/components/ViewContainer.vue +52 -0
  97. package/dist/vendored/components/base.js +12 -0
  98. package/dist/vendored/components/icons.js +47 -0
  99. package/dist/vendored/components/index.js +58 -0
  100. package/dist/vendored/components/setters/SetBgPosition.vue +64 -0
  101. package/dist/vendored/components/setters/SetBgSize.vue +90 -0
  102. package/dist/vendored/components/setters/SetCode.vue +90 -0
  103. package/dist/vendored/components/setters/SetColor.vue +244 -0
  104. package/dist/vendored/components/setters/SetCustomSelect.vue +58 -0
  105. package/dist/vendored/components/setters/SetExpr.vue +107 -0
  106. package/dist/vendored/components/setters/SetGradient.vue +125 -0
  107. package/dist/vendored/components/setters/SetGrid9.vue +68 -0
  108. package/dist/vendored/components/setters/SetIconSelect.vue +67 -0
  109. package/dist/vendored/components/setters/SetIfForm.vue +61 -0
  110. package/dist/vendored/components/setters/SetImage.vue +43 -0
  111. package/dist/vendored/components/setters/SetList.vue +139 -0
  112. package/dist/vendored/components/setters/SetNumber.vue +118 -0
  113. package/dist/vendored/components/setters/SetNumberStyle.vue +113 -0
  114. package/dist/vendored/components/setters/SetPadding.vue +77 -0
  115. package/dist/vendored/components/setters/SetSegment.vue +160 -0
  116. package/dist/vendored/components/setters/SetSelect.vue +51 -0
  117. package/dist/vendored/components/setters/SetSwitch.vue +49 -0
  118. package/dist/vendored/components/setters/SetText.vue +52 -0
  119. package/dist/vendored/components/setters/props.js +23 -0
  120. package/dist/vendored/fidelity/baseline-messageOverview.json +87 -0
  121. package/dist/vendored/fidelity/calibration.json +29 -0
  122. package/dist/vendored/fidelity/fidelity-messageOverview-after.html +114 -0
  123. package/dist/vendored/fidelity/fidelity-messageOverview-after.json +272 -0
  124. package/dist/vendored/fidelity/fidelity-messageOverview.html +185 -0
  125. package/dist/vendored/fidelity/fidelity-messageOverview.json +336 -0
  126. package/dist/vendored/fidelity/fidelity-messageOverview_v2.html +262 -0
  127. package/dist/vendored/fidelity/fidelity-messageOverview_v2.json +502 -0
  128. package/dist/vendored/fidelity/fidelity-messageOverview_v3.html +201 -0
  129. package/dist/vendored/fidelity/fidelity-messageOverview_v3.json +417 -0
  130. package/dist/vendored/fidelity/fidelity-messageOverview_visual.html +125 -0
  131. package/dist/vendored/fidelity/fidelity-messageOverview_visual.json +338 -0
  132. package/dist/vendored/index.html +16 -0
  133. package/dist/vendored/main.js +36 -0
  134. package/dist/vendored/meta/action-meta.json +141 -0
  135. package/dist/vendored/meta/component-meta.json +2714 -0
  136. package/dist/vendored/meta/directive-meta.json +40 -0
  137. package/dist/vendored/meta/style-meta.json +1086 -0
  138. package/dist/vendored/runtime/StyleParser.js +179 -0
  139. package/dist/vendored/runtime/adapter.js +166 -0
  140. package/dist/vendored/runtime/alert-card.js +125 -0
  141. package/dist/vendored/runtime/app-toast.js +33 -0
  142. package/dist/vendored/runtime/assets.js +16 -0
  143. package/dist/vendored/runtime/canvas-context.js +141 -0
  144. package/dist/vendored/runtime/card-runtime.js +289 -0
  145. package/dist/vendored/runtime/clipboard-node.js +83 -0
  146. package/dist/vendored/runtime/clipboard.js +29 -0
  147. package/dist/vendored/runtime/evaluate.js +152 -0
  148. package/dist/vendored/runtime/event-model.js +300 -0
  149. package/dist/vendored/runtime/hoverGuide.js +31 -0
  150. package/dist/vendored/runtime/jsapi-mock.js +256 -0
  151. package/dist/vendored/runtime/node-model.js +217 -0
  152. package/dist/vendored/runtime/property.js +364 -0
  153. package/dist/vendored/runtime/selectionOverlay.js +53 -0
  154. package/dist/vendored/runtime/toPreview.js +648 -0
  155. package/dist/vendored/standalone-main.js +36 -0
  156. package/dist/vendored/standalone.html +12 -0
  157. package/dist/vendored/styles/app.css +2565 -0
  158. package/dist/vendored/styles/card-gallery.css +234 -0
  159. package/dist/vendored/styles/card-select.css +281 -0
  160. package/dist/vendored/styles/components.css +383 -0
  161. package/dist/vendored/styles/dropdown.css +337 -0
  162. package/dist/vendored/styles/json-tree.css +308 -0
  163. package/dist/vendored/styles/node-inspector.css +1003 -0
  164. package/dist/vendored/styles/setters.css +962 -0
  165. package/dist/vendored/styles/standalone.css +27 -0
  166. package/dist/vendored/styles/structure-tree.css +320 -0
  167. package/package.json +42 -0
@@ -0,0 +1,19 @@
1
+ <!-- 官方 module 1995 / 513:卡片里内联的 svg 源码直接 innerHTML 塞进去 -->
2
+ <template>
3
+ <span class="ce_svgcode" :style="svgStyle" v-html="content" />
4
+ </template>
5
+
6
+ <script>
7
+ export default {
8
+ name: 'SvgCode',
9
+ props: {
10
+ content: { type: String, default: '' },
11
+ color: { type: String, default: '' },
12
+ },
13
+ computed: {
14
+ svgStyle() {
15
+ return { fill: this.color }
16
+ },
17
+ },
18
+ }
19
+ </script>
@@ -0,0 +1,30 @@
1
+ <!--
2
+ 官方 module 1992 / 511。
3
+ 从 sprite 里按 id 取图标;sprite 文件(svg-symbols.svg)由仓库直接维护在 preview/assets/。
4
+ 官方只有 IE 才 inline 注入 sprite,现代浏览器直接用外链 `#id`,这里保持一致。
5
+ -->
6
+ <template>
7
+ <svg class="ce_svgsymbols" :fill="color">
8
+ <use :xlink:href="href" :fill="color" />
9
+ </svg>
10
+ </template>
11
+
12
+ <script>
13
+ import { SVG_SYMBOLS_URL } from '../runtime/assets.js'
14
+
15
+ export default {
16
+ name: 'SvgSymbols',
17
+ props: {
18
+ icon: { type: String, default: '' },
19
+ color: { type: String, default: '' },
20
+ },
21
+ data() {
22
+ return { symbols: SVG_SYMBOLS_URL }
23
+ },
24
+ computed: {
25
+ href() {
26
+ return `${this.symbols}#${this.icon}`
27
+ },
28
+ },
29
+ }
30
+ </script>
@@ -0,0 +1,38 @@
1
+ <!-- 通用开关组件(受控)。
2
+ 视觉对齐 App.vue 内的 .theme-toggle 范式,配色严格遵循
3
+ 《深浅主题配色规范手册》§4.5 Switch:
4
+ - 关闭:中性灰(复用 --bg-input / --border-strong / --text-faint)
5
+ - 开启:主色实心(--accent)+ 滑块用主色上的文字(--on-accent)
6
+ 双主题仅切换同名 Token 取值,组件不写颜色分支、禁止硬编码十六进制。 -->
7
+ <template>
8
+ <button
9
+ type="button"
10
+ class="switch"
11
+ :class="{ 'switch--on': modelValue, 'switch--disabled': disabled }"
12
+ role="switch"
13
+ :aria-checked="String(modelValue)"
14
+ :disabled="disabled"
15
+ @click="onClick"
16
+ >
17
+ <span class="switch__track">
18
+ <span class="switch__thumb"></span>
19
+ </span>
20
+ </button>
21
+ </template>
22
+
23
+ <script>
24
+ export default {
25
+ name: 'Switch',
26
+ props: {
27
+ modelValue: { type: Boolean, default: false },
28
+ disabled: { type: Boolean, default: false },
29
+ },
30
+ emits: ['update:modelValue'],
31
+ methods: {
32
+ onClick() {
33
+ if (this.disabled) return
34
+ this.$emit('update:modelValue', !this.modelValue)
35
+ },
36
+ },
37
+ }
38
+ </script>
@@ -0,0 +1,32 @@
1
+ <!-- 官方 module 1977 / 502 -->
2
+ <template>
3
+ <span class="ce_text" :style="styleObj" @click="$emit('click', $event)">{{
4
+ doI18n(value)
5
+ }}</span>
6
+ </template>
7
+
8
+ <script>
9
+ import StyleParser from '../runtime/StyleParser.js'
10
+ import base from './base.js'
11
+
12
+ export default {
13
+ name: 'CeText',
14
+ emits: ['click'],
15
+ mixins: [base],
16
+ props: {
17
+ styleProps: { type: Object, default: () => ({}) },
18
+ // 官方声明是 String;变量绑定完全可能算出数字,放宽类型只为少刷 warning,
19
+ // 渲染结果(插值)与官方一致
20
+ value: { type: [String, Number], default: '' },
21
+ },
22
+ computed: {
23
+ styleObj() {
24
+ // Text 比容器多一步 parseFont(IE 的 justifyContent 兼容分支省略)
25
+ const parser = new StyleParser(this, this.styleProps)
26
+ const out = parser.parse()
27
+ parser.parseFont(this.styleProps.font || {}, out)
28
+ return out
29
+ },
30
+ },
31
+ }
32
+ </script>
@@ -0,0 +1,70 @@
1
+ <!--
2
+ 视频(官方 module 1982 / 505)。
3
+ 结构对齐在线编辑器渲染产物:
4
+ ce_video > video(ce_video_elem) + ce_video_poster(封面遮罩)
5
+ 有封面时先显示封面,点击封面播放并隐藏;无封面直接显示 video 控件。
6
+ -->
7
+ <template>
8
+ <div class="ce_video" :style="rootStyle">
9
+ <video
10
+ ref="video"
11
+ class="ce_video_elem ce_npc"
12
+ :src="src"
13
+ :poster="poster"
14
+ controls
15
+ playsinline
16
+ webkit-playsinline
17
+ />
18
+ <div
19
+ v-if="poster && showPoster"
20
+ class="ce_video_poster ce_npc"
21
+ :style="{ backgroundImage: `url(${poster})`, backgroundSize: 'cover', backgroundPosition: 'center' }"
22
+ @click="play"
23
+ />
24
+ </div>
25
+ </template>
26
+
27
+ <script>
28
+ import StyleParser from '../runtime/StyleParser.js'
29
+ import base from './base.js'
30
+
31
+ export default {
32
+ name: 'CeVideo',
33
+ mixins: [base],
34
+ props: {
35
+ styleProps: { type: Object, default: () => ({}) },
36
+ url: { type: String, default: '' },
37
+ previewUrl: { type: String, default: '' },
38
+ },
39
+ emits: ['click'],
40
+ data() {
41
+ return { showPoster: true }
42
+ },
43
+ computed: {
44
+ rootStyle() {
45
+ const out = new StyleParser(this, this.styleProps).parse()
46
+ return Object.assign(out, { overflow: 'hidden', boxSizing: 'border-box' })
47
+ },
48
+ src() {
49
+ return this.adapter.doReplaceUrl(this.doI18n(this.url || ''))
50
+ },
51
+ poster() {
52
+ return this.adapter.doReplaceUrl(this.doI18n(this.previewUrl || ''))
53
+ },
54
+ },
55
+ methods: {
56
+ play() {
57
+ this.showPoster = false
58
+ const v = this.$refs.video
59
+ if (v) {
60
+ try {
61
+ v.play()
62
+ } catch (e) {
63
+ /* 自动播放可能被拦截,忽略 */
64
+ }
65
+ }
66
+ this.$emit('click')
67
+ },
68
+ },
69
+ }
70
+ </script>
@@ -0,0 +1,52 @@
1
+ <!--
2
+ 官方 module 2085 / 533。
3
+ 宿主注册的「自定义组件」插槽,业务方在 App 里通过 customComponents 注入实现;
4
+ 预览工程没有真实实现,统一落到 Placeholder 上画个占位块。
5
+ -->
6
+ <template>
7
+ <div class="ce_viewcontainer" :style="styleObj">
8
+ <component
9
+ :is="componentClass"
10
+ v-if="componentClass"
11
+ :icon="componentIcon"
12
+ :props="componentProps"
13
+ :custom-class="customClass"
14
+ @action="$emit('action', $event)"
15
+ />
16
+ </div>
17
+ </template>
18
+
19
+ <script>
20
+ import StyleParser from '../runtime/StyleParser.js'
21
+ import base from './base.js'
22
+
23
+ export default {
24
+ name: 'CeViewContainer',
25
+ emits: ['action'],
26
+ mixins: [base],
27
+ inject: ['adapter', 'customComponents'],
28
+ props: {
29
+ styleProps: { type: Object, default: () => ({}) },
30
+ customClass: { type: String, default: '' },
31
+ customProps: { type: Object, default: () => ({}) },
32
+ customRemarkImg: { type: String, default: '' },
33
+ },
34
+ computed: {
35
+ componentClass() {
36
+ const reg = this.customComponents
37
+ if (!reg) return ''
38
+ if (!this.customClass) return reg.Placeholder || ''
39
+ return reg[this.customClass] || reg.Placeholder || ''
40
+ },
41
+ componentProps() {
42
+ return this.customProps || {}
43
+ },
44
+ componentIcon() {
45
+ return this.customRemarkImg || ''
46
+ },
47
+ styleObj() {
48
+ return new StyleParser(this, this.styleProps).parse()
49
+ },
50
+ },
51
+ }
52
+ </script>
@@ -0,0 +1,12 @@
1
+ /**
2
+ * 官方每个渲染组件都有的两段样板:`inject:["adapter"]` 和 `doI18n`。
3
+ * 抽成 mixin,组件里只保留真正有差异的部分,方便和 comp/*.js 逐行对照。
4
+ */
5
+ export default {
6
+ inject: ['adapter'],
7
+ methods: {
8
+ doI18n(v) {
9
+ return this.adapter.doI18n(v)
10
+ },
11
+ },
12
+ }
@@ -0,0 +1,47 @@
1
+ /**
2
+ * 复选 / 单选图标的 SVG 路径数据。
3
+ *
4
+ * 取自官方 inner_card svg sprite(svg-check-style / svg-radio-style),
5
+ * 用于预览端离线渲染,避免依赖远程 sprite 文件。
6
+ * 每个符号对应一组 <path d="...">,视图框统一为 0 0 1024 1024。
7
+ */
8
+
9
+ export const CHECK_PATHS = {
10
+ // 圆形:两种状态共用同一符号,靠 fill 颜色区分选中/未选中
11
+ CheckGroupCircle: [
12
+ 'M512 65.983389c-245.919634 0-446.016611 200.095256-446.016611 446.016611 0 245.952318 200.064292 446.016611 446.016611 446.016611S958.016611 757.952318 958.016611 512C958.016611 266.080366 757.952318 65.983389 512 65.983389zM512 894.016611c-210.655557 0-382.016611-171.392017-382.016611-382.016611 0-210.655557 171.359333-382.016611 382.016611-382.016611 210.624593 0 382.016611 171.359333 382.016611 382.016611C894.016611 722.624593 722.624593 894.016611 512 894.016611z',
13
+ 'M512 352.00086c-88.223841 0-160.00086 71.775299-160.00086 159.99914s71.775299 160.00086 160.00086 160.00086 160.00086-71.775299 160.00086-160.00086S600.223841 352.00086 512 352.00086z',
14
+ ],
15
+ // 方框(空心):未选中
16
+ CheckGroupSquareEmpty: [
17
+ 'M833.008 928h-640c-52.944 0-96-43.072-96-96V192c0-52.928 43.056-96 96-96h640c52.912 0 96 43.072 96 96v640c0 52.928-43.072 96-96 96z m-640-768c-17.648 0-32 14.368-32 32v640c0 17.664 14.352 32 32 32h640a32 32 0 0 0 32-32V192c0-17.632-14.352-32-32-32h-640z',
18
+ ],
19
+ // 方框(空心)+ 勾:选中
20
+ CheckGroupSquareEmptyCheck: [
21
+ 'M727.984 393.184a31.968 31.968 0 0 0-45.248 0.256L449.44 629.248l-103.28-106.112a32 32 0 1 0-45.888 44.608l126.032 129.504c0.048 0.096 0.192 0.096 0.256 0.192 0.064 0.064 0.096 0.192 0.16 0.256 2.016 1.984 4.512 3.2 6.88 4.544 1.248 0.672 2.24 1.792 3.52 2.304a31.728 31.728 0 0 0 24.064 0.064c1.232-0.512 2.208-1.536 3.392-2.176 2.4-1.344 4.896-2.528 6.944-4.544 0.064-0.064 0.096-0.192 0.192-0.256 0.064-0.096 0.16-0.128 0.256-0.192l256.224-259.008a32 32 0 0 0-0.224-45.248zM832.992 928h-640c-52.928 0-96-43.072-96-96V192c0-52.928 43.072-96 96-96h640c52.928 0 96 43.072 96 96v640c0 52.928-43.056 96-96 96z m-640-768c-17.632 0-32 14.368-32 32v640c0 17.664 14.368 32 32 32h640a32 32 0 0 0 32-32V192c0-17.632-14.336-32-32-32h-640z',
22
+ ],
23
+ // 实心方框:未选中
24
+ CheckGroupSquare: [
25
+ 'M186 123c-33.137 0-60 26.863-60 60v655c0 33.137 26.863 60 60 60h655c33.137 0 60-26.863 60-60V183c0-33.137-26.863-60-60-60H186z m0-60h655c66.274 0 120 53.726 120 120v655c0 66.274-53.726 120-120 120H186c-66.274 0-120-53.726-120-120V183c0-66.274 53.726-120 120-120z',
26
+ ],
27
+ // 实心方框 + 勾:选中
28
+ CheckGroupSquareCheck: [
29
+ 'M840.6 97H185.4C137.1 97 98 136.1 98 184.4v655.3c0 48.3 39.1 87.4 87.4 87.4h655.3c48.3 0 87.4-39.1 87.4-87.4V184.4C928 136.1 888.9 97 840.6 97zM791 380.7L466.7 705.1c-17.1 17.1-44.7 17.1-61.8 0L235 535.2c-17.1-17.1-17.1-44.7 0-61.8 17.1-17.1 44.7-17.1 61.8 0l139 139L729.2 319c17.1-17.1 44.7-17.1 61.8 0 17.1 17 17.1 44.7 0 61.7z',
30
+ ],
31
+ }
32
+
33
+ export const RADIO_PATHS = {
34
+ // 实心圆形:两种状态共用,靠颜色区分
35
+ RadioButtonCircle: [
36
+ 'M512 65.983389c-245.919634 0-446.016611 200.095256-446.016611 446.016611 0 245.952318 200.064292 446.016611 446.016611 446.016611S958.016611 757.952318 958.016611 512C958.016611 266.080366 757.952318 65.983389 512 65.983389zM512 894.016611c-210.655557 0-382.016611-171.392017-382.016611-382.016611 0-210.655557 171.359333-382.016611 382.016611-382.016611 210.624593 0 382.016611 171.359333 382.016611 382.016611C894.016611 722.624593 722.624593 894.016611 512 894.016611z',
37
+ 'M512 352.00086c-88.223841 0-160.00086 71.775299-160.00086 159.99914s71.775299 160.00086 160.00086 160.00086 160.00086-71.775299 160.00086-160.00086S600.223841 352.00086 512 352.00086z',
38
+ ],
39
+ // 空心圆:未选中
40
+ RadioButtonCircleEmpty: [
41
+ 'M512 938.666667C276.362667 938.666667 85.333333 747.637333 85.333333 512S276.362667 85.333333 512 85.333333s426.666667 191.029333 426.666667 426.666667-191.029333 426.666667-426.666667 426.666667z m0-64c200.298667 0 362.666667-162.368 362.666667-362.666667S712.298667 149.333333 512 149.333333 149.333333 311.701333 149.333333 512s162.368 362.666667 362.666667 362.666667z',
42
+ ],
43
+ // 空心圆 + 勾:选中
44
+ RadioButtonCircleEmptyCheck: [
45
+ 'M512 85.333333c235.637333 0 426.666667 191.029333 426.666667 426.666667S747.637333 938.666667 512 938.666667 85.333333 747.637333 85.333333 512 276.362667 85.333333 512 85.333333z m182.613333 297.354667a32 32 0 0 0-45.258666 0.032L458.922667 573.44l-84.341334-83.989333a32 32 0 0 0-45.162666 45.344l106.986666 106.549333a32 32 0 0 0 45.226667-0.064l213.013333-213.333333a32 32 0 0 0-0.032-45.258667z',
46
+ ],
47
+ }
@@ -0,0 +1,58 @@
1
+ /**
2
+ * className -> Vue 组件 的注册表。
3
+ * key 与 schema 里的 `className`(也就是 component-meta.json 的 className)一一对应。
4
+ */
5
+ import Root from './Root.vue'
6
+ import Row from './Row.vue'
7
+ import Column from './Column.vue'
8
+ import Text from './Text.vue'
9
+ import Button from './Button.vue'
10
+ import Divider from './Divider.vue'
11
+ import Icon from './Icon.vue'
12
+ import Image from './Image.vue'
13
+ import MultiText from './MultiText.vue'
14
+ import ListLayout from './ListLayout.vue'
15
+ import GridLayout from './GridLayout.vue'
16
+ import Canvas from './Canvas.vue'
17
+ import Input from './Input.vue'
18
+ import ViewContainer from './ViewContainer.vue'
19
+ import AbsoluteLayout from './AbsoluteLayout.vue'
20
+ import CheckGroup from './CheckGroup.vue'
21
+ import RadioButton from './RadioButton.vue'
22
+ import ProgressSlider from './ProgressSlider.vue'
23
+ import Video from './Video.vue'
24
+ import Map from './Map.vue'
25
+ import MultiColumn from './MultiColumn.vue'
26
+
27
+ export const COMPONENTS = {
28
+ Root,
29
+ Row,
30
+ Column,
31
+ Text,
32
+ Button,
33
+ Divider,
34
+ Icon,
35
+ Image,
36
+ MultiText,
37
+ ListLayout,
38
+ GridLayout,
39
+ Canvas,
40
+ Input,
41
+ ViewContainer,
42
+ AbsoluteLayout,
43
+ CheckGroup,
44
+ RadioButton,
45
+ ProgressSlider,
46
+ Video,
47
+ Map,
48
+ MultiColumn,
49
+ }
50
+
51
+ /** 带作用域插槽的容器:插槽内容要按 value 逐项渲染,scope 里能取到 item 字段 */
52
+ export const SCOPED_SLOT_COMPONENTS = new Set(['ListLayout', 'GridLayout'])
53
+
54
+ export function getComponent(className) {
55
+ return COMPONENTS[className] || null
56
+ }
57
+
58
+ export default COMPONENTS
@@ -0,0 +1,64 @@
1
+ <!--
2
+ 背景图位置设置器:对应编辑器 style/BackgroundPositionStyle。
3
+ 左侧九宫格给常用位置,右侧两个带单位数值给自定义 X / Y(DSL 值形如 "50% 50%")。
4
+ -->
5
+ <template>
6
+ <div class="st-bgpos">
7
+ <SetGrid9 kind="BackgroundPositionStyle" :value="value" :disabled="disabled" @input="pickGrid" @change="$emit('change')" />
8
+ <div class="st-bgpos__xy">
9
+ <SetNumberStyle :value="x" :options="numOptions('X')" :disabled="disabled" @input="setX" @change="emitOut" />
10
+ <SetNumberStyle :value="y" :options="numOptions('Y')" :disabled="disabled" @input="setY" @change="emitOut" />
11
+ </div>
12
+ </div>
13
+ </template>
14
+
15
+ <script>
16
+ import { setterProps, setterEmits } from './props.js'
17
+ import SetGrid9 from './SetGrid9.vue'
18
+ import SetNumberStyle from './SetNumberStyle.vue'
19
+
20
+ const UNITS = [
21
+ { key: 'number', value: 'px' },
22
+ { key: 'percent', value: '%' },
23
+ ]
24
+
25
+ export default {
26
+ name: 'SetBgPosition',
27
+ components: { SetGrid9, SetNumberStyle },
28
+ props: setterProps,
29
+ emits: setterEmits,
30
+ data() {
31
+ return { x: '', y: '' }
32
+ },
33
+ watch: {
34
+ value: { immediate: true, handler() { this.parse() } },
35
+ },
36
+ methods: {
37
+ parse() {
38
+ const parts = String(this.value || '').split(/\s+/)
39
+ this.x = parts[0] || ''
40
+ this.y = parts[1] || ''
41
+ },
42
+ numOptions(placeholder) {
43
+ return { placeholder, iTypeList: UNITS }
44
+ },
45
+ pickGrid(v) {
46
+ this.$emit('input', v)
47
+ },
48
+ setX(v) {
49
+ this.x = v
50
+ this.emitValue()
51
+ },
52
+ setY(v) {
53
+ this.y = v
54
+ this.emitValue()
55
+ },
56
+ emitValue() {
57
+ this.$emit('input', `${this.x || '0'} ${this.y || '0'}`)
58
+ },
59
+ emitOut() {
60
+ this.$emit('change')
61
+ },
62
+ },
63
+ }
64
+ </script>
@@ -0,0 +1,90 @@
1
+ <!--
2
+ 背景图大小设置器:对应编辑器 style/BackgroundSizeStyle。
3
+ 下拉给 cover / contain,选「自定义」时展开宽高两个带单位数值(DSL 值形如 "auto auto")。
4
+ -->
5
+ <template>
6
+ <div class="st-bgsize">
7
+ <Dropdown
8
+ :value="preset"
9
+ :options="bgOptions"
10
+ size="sm"
11
+ block
12
+ :disabled="disabled"
13
+ @input="pickPreset($event)"
14
+ />
15
+ <div v-if="!preset" class="st-bgsize__xy">
16
+ <SetNumberStyle :value="x" :options="{ placeholder: '宽' }" :disabled="disabled" @input="setX" @change="emitOut" />
17
+ <SetNumberStyle :value="y" :options="{ placeholder: '高' }" :disabled="disabled" @input="setY" @change="emitOut" />
18
+ </div>
19
+ </div>
20
+ </template>
21
+
22
+ <script>
23
+ import { setterProps, setterEmits } from './props.js'
24
+ import SetNumberStyle from './SetNumberStyle.vue'
25
+ import Dropdown from '../Dropdown.vue'
26
+
27
+ const TYPES = [
28
+ { key: 'cover', desc: 'cover:保持纵横比,缩放到完全覆盖背景定位区域的最小尺寸' },
29
+ { key: 'contain', desc: 'contain:保持纵横比,缩放到能放进背景定位区域的最大尺寸' },
30
+ ]
31
+
32
+ export default {
33
+ name: 'SetBgSize',
34
+ components: { SetNumberStyle, Dropdown },
35
+ computed: {
36
+ bgOptions() {
37
+ return [{ key: '', value: '自定义' }].concat(
38
+ this.TYPES.map((t) => ({ key: t.key, value: t.key }))
39
+ )
40
+ },
41
+ },
42
+ props: setterProps,
43
+ emits: setterEmits,
44
+ data() {
45
+ return { TYPES, preset: '', x: '', y: '' }
46
+ },
47
+ watch: {
48
+ value: { immediate: true, handler() { this.parse() } },
49
+ },
50
+ methods: {
51
+ parse() {
52
+ const v = String(this.value || '')
53
+ const keys = TYPES.map((t) => t.key)
54
+ this.preset = keys.includes(v) ? v : ''
55
+ const parts = v.split(/\s+/)
56
+ if (parts.length >= 2) {
57
+ this.x = parts[0] || ''
58
+ this.y = parts[1] || ''
59
+ } else {
60
+ this.x = ''
61
+ this.y = ''
62
+ }
63
+ },
64
+ pickPreset(v) {
65
+ this.preset = v
66
+ if (!v) {
67
+ this.x = 'auto'
68
+ this.y = 'auto'
69
+ }
70
+ this.emitValue()
71
+ this.$emit('change')
72
+ },
73
+ setX(v) {
74
+ this.x = v
75
+ this.emitValue()
76
+ },
77
+ setY(v) {
78
+ this.y = v
79
+ this.emitValue()
80
+ },
81
+ emitValue() {
82
+ const out = this.preset ? this.preset : `${this.x || 'auto'} ${this.y || 'auto'}`
83
+ this.$emit('input', out)
84
+ },
85
+ emitOut() {
86
+ this.$emit('change')
87
+ },
88
+ },
89
+ }
90
+ </script>
@@ -0,0 +1,90 @@
1
+ <!--
2
+ 代码设置器:对应编辑器里 customAction 的脚本编辑框。
3
+ itemType === 'Code' 时使用。
4
+
5
+ 值形态:itemValue 是**对象** `{ code, compiled? }`(schema 实测形态),
6
+ 不是裸字符串。这里只改写 options.codeKey(默认 'code')那一个键,
7
+ 其余键(如线上 babel 产物 compiled)原样保留 —— 避免编辑器把不认识的
8
+ 字段擦掉造成回传丢数据。
9
+
10
+ 编辑器实例由 CodeJar 托管 DOM,因此**不能**用 :value 双向绑定重渲染,
11
+ 只在挂载时灌一次初值;外部值变化(切换节点/切换动作类型)通过 key 重建组件。
12
+ -->
13
+ <template>
14
+ <div class="st-code">
15
+ <div ref="editor" class="st-code__editor" :class="{ 'is-disabled': disabled }"></div>
16
+ <div class="st-code__foot">
17
+ <span class="st-code__hint">{{ lines }} 行 · {{ chars }} 字符</span>
18
+ </div>
19
+ </div>
20
+ </template>
21
+
22
+ <script>
23
+ import { CodeJar } from 'codejar'
24
+ import Prism from 'prismjs'
25
+ import 'prismjs/components/prism-javascript'
26
+ import { setterProps, setterEmits } from './props.js'
27
+
28
+ export default {
29
+ name: 'SetCode',
30
+ props: setterProps,
31
+ emits: setterEmits,
32
+ data() {
33
+ return { code: '' }
34
+ },
35
+ computed: {
36
+ codeKey() {
37
+ return this.options.codeKey || 'code'
38
+ },
39
+ lines() {
40
+ return this.code ? this.code.split('\n').length : 0
41
+ },
42
+ chars() {
43
+ return this.code.length
44
+ },
45
+ },
46
+ mounted() {
47
+ this.code = this.readCode()
48
+ this.$nextTick(() => this.initJar())
49
+ },
50
+ beforeUnmount() {
51
+ if (this._t) clearTimeout(this._t)
52
+ if (this._jar && this._jar.destroy) this._jar.destroy()
53
+ },
54
+ methods: {
55
+ readCode() {
56
+ const v = this.value
57
+ if (v == null) return ''
58
+ if (typeof v === 'string') return v
59
+ if (typeof v === 'object') return String(v[this.codeKey] || '')
60
+ return String(v)
61
+ },
62
+ initJar() {
63
+ const el = this.$refs.editor
64
+ if (!el) return
65
+ const highlight = (editor) => {
66
+ editor.innerHTML = Prism.highlight(editor.textContent, Prism.languages.javascript, 'javascript')
67
+ }
68
+ this._jar = CodeJar(el, highlight, {
69
+ tab: ' ',
70
+ indentOn: /[({[]$/,
71
+ addClosing: true,
72
+ history: true,
73
+ })
74
+ this._jar.updateCode(this.code)
75
+ this._jar.onUpdate((code) => this.onCode(code))
76
+ },
77
+ onCode(code) {
78
+ if (this.disabled) return
79
+ this.code = code
80
+ // 保留 compiled 等未知键,只覆写 codeKey
81
+ const base = this.value && typeof this.value === 'object' ? Object.assign({}, this.value) : {}
82
+ base[this.codeKey] = code
83
+ this.$emit('input', base)
84
+ // 代码输入频繁,change(触发重建预览)做防抖
85
+ if (this._t) clearTimeout(this._t)
86
+ this._t = setTimeout(() => this.$emit('change'), 400)
87
+ },
88
+ },
89
+ }
90
+ </script>