@yklyklpackages/message-card 0.5.0 → 0.6.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.
- package/dist/components/MessageCard.d.ts +4 -1
- package/dist/components/MessageCard.d.ts.map +1 -1
- package/dist/components/action/types.d.ts +2 -2
- package/dist/components/action/types.d.ts.map +1 -1
- package/dist/components/core/LayoutWrapper.d.ts.map +1 -1
- package/dist/components/core/LeafWrapper.d.ts.map +1 -1
- package/dist/components/message/MessageContainer.d.ts +3 -1
- package/dist/components/message/MessageContainer.d.ts.map +1 -1
- package/dist/components/theme/ScreenTheme375.d.ts.map +1 -1
- package/dist/components/theme/ThemeContext.d.ts +1 -0
- package/dist/components/theme/ThemeContext.d.ts.map +1 -1
- package/dist/components/theme/defaultTheme.d.ts.map +1 -1
- package/dist/components/utils/constants.d.ts +1 -0
- package/dist/components/utils/constants.d.ts.map +1 -1
- package/dist/components/utils/styleHelpers.d.ts.map +1 -1
- package/dist/index.cjs +99 -37
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +99 -37
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +99 -37
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -148,7 +148,7 @@ function JSONSafeParse(str, defaultValue) {
|
|
|
148
148
|
}
|
|
149
149
|
return defaultValue;
|
|
150
150
|
}
|
|
151
|
-
const defaultTheme$
|
|
151
|
+
const defaultTheme$2 = {
|
|
152
152
|
fontSize: {
|
|
153
153
|
FontSizes_JDH_Headline1: 46,
|
|
154
154
|
FontSizes_JDH_Headline2: 34,
|
|
@@ -165,6 +165,9 @@ const defaultTheme$1 = {
|
|
|
165
165
|
Color_JDH_Red_Price: "#FF0F23",
|
|
166
166
|
Color_JDH_Red_Discount: "#FF0F23",
|
|
167
167
|
Color_JDH_Green_Success: "#67CC52",
|
|
168
|
+
Color_JDH_Green_Background: "#17CB8E1F",
|
|
169
|
+
Color_JDH_Red_Background: "#FF0F231F",
|
|
170
|
+
Color_JDH_Yellow_Background: "#FF80001F",
|
|
168
171
|
Color_JDH_Gray_Headline: "#222222",
|
|
169
172
|
Color_JDH_Gray_Text: "#222222",
|
|
170
173
|
Color_JDH_Gray_SecondText: "#575859",
|
|
@@ -190,14 +193,68 @@ const defaultTheme$1 = {
|
|
|
190
193
|
Spacing_JDH_xxs: 4
|
|
191
194
|
},
|
|
192
195
|
borderRadius: {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
196
|
+
Radius_JDH_xxl: 32,
|
|
197
|
+
Radius_JDH_xl: 24,
|
|
198
|
+
Radius_JDH_lg: 16,
|
|
199
|
+
Radius_JDH_sm: 8,
|
|
200
|
+
Radius_JDH_xs: 6
|
|
201
|
+
},
|
|
202
|
+
components: {}
|
|
203
|
+
};
|
|
204
|
+
const defaultTheme$1 = {
|
|
205
|
+
fontSize: {
|
|
206
|
+
FontSizes_JDH_Headline1: 23,
|
|
207
|
+
FontSizes_JDH_Headline2: 17,
|
|
208
|
+
FontSizes_JDH_Title: 15,
|
|
209
|
+
FontSizes_JDH_Text: 14,
|
|
210
|
+
FontSizes_JDH_AccentText: 12,
|
|
211
|
+
FontSizes_JDH_TagText: 10
|
|
212
|
+
},
|
|
213
|
+
color: {
|
|
214
|
+
Color_JDH_Primary: "#17CB8E",
|
|
215
|
+
Color_JDH_Accent1: "#FF8000",
|
|
216
|
+
Color_JDH_Accent2: "#73B0FF",
|
|
217
|
+
Color_JDH_Red_Danger: "#FF0F23",
|
|
218
|
+
Color_JDH_Red_Price: "#FF0F23",
|
|
219
|
+
Color_JDH_Red_Discount: "#FF0F23",
|
|
220
|
+
Color_JDH_Green_Success: "#67CC52",
|
|
221
|
+
Color_JDH_Green_Background: "#17CB8E1F",
|
|
222
|
+
Color_JDH_Red_Background: "#FF0F231F",
|
|
223
|
+
Color_JDH_Yellow_Background: "#FF80001F",
|
|
224
|
+
Color_JDH_Gray_Headline: "#222222",
|
|
225
|
+
Color_JDH_Gray_Text: "#222222",
|
|
226
|
+
Color_JDH_Gray_SecondText: "#575859",
|
|
227
|
+
Color_JDH_Gray_AccentText: "#858687",
|
|
228
|
+
Color_JDH_Gray_DividingLine: "#D3D3D3",
|
|
229
|
+
Color_JDH_Gray_Background: "#F5F5F6",
|
|
230
|
+
Color_JDH_Gray_CardBackground: "#E5E9EB",
|
|
231
|
+
Color_JDH_Gray_Card: "#FFFFFF",
|
|
232
|
+
Color_JDH_Gray_Mask: "#00000080"
|
|
233
|
+
},
|
|
234
|
+
fontWeight: {
|
|
235
|
+
FontWeight_JDH_Normal: 400,
|
|
236
|
+
FontWeight_JDH_Medium: 500
|
|
237
|
+
},
|
|
238
|
+
space: {
|
|
239
|
+
Spacing_JDH_4xl: 16,
|
|
240
|
+
Spacing_JDH_xxxl: 14,
|
|
241
|
+
Spacing_JDH_xxl: 12,
|
|
242
|
+
Spacing_JDH_xl: 10,
|
|
243
|
+
Spacing_JDH_lg: 8,
|
|
244
|
+
Spacing_JDH_sm: 6,
|
|
245
|
+
Spacing_JDH_xs: 4,
|
|
246
|
+
Spacing_JDH_xxs: 2
|
|
247
|
+
},
|
|
248
|
+
borderRadius: {
|
|
249
|
+
Radius_JDH_xxl: 16,
|
|
250
|
+
Radius_JDH_xl: 12,
|
|
251
|
+
Radius_JDH_lg: 8,
|
|
252
|
+
Radius_JDH_sm: 4,
|
|
253
|
+
Radius_JDH_xs: 3
|
|
198
254
|
},
|
|
199
255
|
components: {}
|
|
200
256
|
};
|
|
257
|
+
const DEFAULT_SCALE = 0.5;
|
|
201
258
|
var __defProp$v = Object.defineProperty;
|
|
202
259
|
var __defProps$q = Object.defineProperties;
|
|
203
260
|
var __getOwnPropDescs$q = Object.getOwnPropertyDescriptors;
|
|
@@ -217,13 +274,14 @@ var __spreadValues$s = (a, b) => {
|
|
|
217
274
|
return a;
|
|
218
275
|
};
|
|
219
276
|
var __spreadProps$q = (a, b) => __defProps$q(a, __getOwnPropDescs$q(b));
|
|
220
|
-
const ThemeContext = createContext(defaultTheme$
|
|
277
|
+
const ThemeContext = createContext(defaultTheme$2);
|
|
221
278
|
const ThemeProvider = ({
|
|
279
|
+
scale = DEFAULT_SCALE,
|
|
222
280
|
theme,
|
|
223
281
|
children
|
|
224
282
|
}) => {
|
|
225
283
|
const merged = useMemo$1(() => {
|
|
226
|
-
const base = defaultTheme$1;
|
|
284
|
+
const base = scale <= DEFAULT_SCALE ? defaultTheme$2 : defaultTheme$1;
|
|
227
285
|
return __spreadProps$q(__spreadValues$s({}, base), {
|
|
228
286
|
fontSize: __spreadValues$s(__spreadValues$s({}, base.fontSize), (theme == null ? void 0 : theme.fontSize) || {}),
|
|
229
287
|
color: __spreadValues$s(__spreadValues$s({}, base.color), (theme == null ? void 0 : theme.color) || {}),
|
|
@@ -4556,6 +4614,7 @@ const fractionWidth = (percent) => ({
|
|
|
4556
4614
|
const buildItemContainerStyle = (index2, count, props, horizontal = false, scale = 1) => {
|
|
4557
4615
|
const style2 = __spreadValues$q({
|
|
4558
4616
|
width: (props == null ? void 0 : props.flexDirection) === "row" ? "auto" : "100%",
|
|
4617
|
+
flexDirection: props.direction || "column",
|
|
4559
4618
|
height: "auto",
|
|
4560
4619
|
boxSizing: "border-box",
|
|
4561
4620
|
display: "flex",
|
|
@@ -5459,6 +5518,16 @@ const LayoutWrapper = ({
|
|
|
5459
5518
|
if (!node2) return null;
|
|
5460
5519
|
const { layoutType, props, subType } = node2;
|
|
5461
5520
|
const layoutProps = props;
|
|
5521
|
+
if (typeof (customLayoutComponent == null ? void 0 : customLayoutComponent[subType]) !== "undefined") {
|
|
5522
|
+
return /* @__PURE__ */ jsx(
|
|
5523
|
+
CustomLayout,
|
|
5524
|
+
{
|
|
5525
|
+
customComponent: customLayoutComponent[subType],
|
|
5526
|
+
props: layoutProps,
|
|
5527
|
+
children
|
|
5528
|
+
}
|
|
5529
|
+
);
|
|
5530
|
+
}
|
|
5462
5531
|
switch (subType) {
|
|
5463
5532
|
case "full-row":
|
|
5464
5533
|
return /* @__PURE__ */ jsx(FullRowLayout, __spreadProps$c(__spreadValues$e({ props: layoutProps }, { originProps }), { children }));
|
|
@@ -5483,14 +5552,7 @@ const LayoutWrapper = ({
|
|
|
5483
5552
|
case "scroll-view":
|
|
5484
5553
|
return /* @__PURE__ */ jsx(ScrollViewLayout, __spreadProps$c(__spreadValues$e({}, node2), { children }));
|
|
5485
5554
|
default:
|
|
5486
|
-
return
|
|
5487
|
-
CustomLayout,
|
|
5488
|
-
{
|
|
5489
|
-
customComponent: customLayoutComponent[subType],
|
|
5490
|
-
props: layoutProps,
|
|
5491
|
-
children
|
|
5492
|
-
}
|
|
5493
|
-
) : /* @__PURE__ */ jsx(UnknownRenderer, { type: String(layoutType), prefix: "未知布局类型" });
|
|
5555
|
+
return /* @__PURE__ */ jsx(UnknownRenderer, { type: String(layoutType), prefix: "未知布局类型" });
|
|
5494
5556
|
}
|
|
5495
5557
|
};
|
|
5496
5558
|
const isPlainObject$1 = (obj) => Object.prototype.toString.call(obj) === "[object Object]";
|
|
@@ -29946,6 +30008,15 @@ const LeafWrapper = ({
|
|
|
29946
30008
|
);
|
|
29947
30009
|
if (!node2) return null;
|
|
29948
30010
|
const { renderType, props, subType } = node2;
|
|
30011
|
+
if (typeof (customRenderComponent == null ? void 0 : customRenderComponent[subType]) !== "undefined") {
|
|
30012
|
+
return /* @__PURE__ */ jsx(
|
|
30013
|
+
CustomRenderFromProps,
|
|
30014
|
+
{
|
|
30015
|
+
props,
|
|
30016
|
+
component: customRenderComponent[subType]
|
|
30017
|
+
}
|
|
30018
|
+
);
|
|
30019
|
+
}
|
|
29949
30020
|
switch (subType) {
|
|
29950
30021
|
case "text":
|
|
29951
30022
|
return /* @__PURE__ */ jsx(TextRender, __spreadValues$4({}, props));
|
|
@@ -30009,13 +30080,7 @@ const LeafWrapper = ({
|
|
|
30009
30080
|
return /* @__PURE__ */ jsx(CustomRenderFromIM, __spreadProps$3(__spreadValues$4({}, props), { originProps }));
|
|
30010
30081
|
}
|
|
30011
30082
|
default:
|
|
30012
|
-
return
|
|
30013
|
-
CustomRenderFromProps,
|
|
30014
|
-
{
|
|
30015
|
-
props,
|
|
30016
|
-
component: customRenderComponent[subType]
|
|
30017
|
-
}
|
|
30018
|
-
) : /* @__PURE__ */ jsx(UnknownRenderer, { type: String(renderType), prefix: "未知渲染类型" });
|
|
30083
|
+
return /* @__PURE__ */ jsx(UnknownRenderer, { type: String(renderType), prefix: "未知渲染类型" });
|
|
30019
30084
|
}
|
|
30020
30085
|
};
|
|
30021
30086
|
const ComponentRenderer = ({
|
|
@@ -30106,6 +30171,11 @@ const MessageContainer = (props) => {
|
|
|
30106
30171
|
} = props;
|
|
30107
30172
|
const { template, referenceComponentList, data } = component;
|
|
30108
30173
|
const { editorMode: editorMode2 } = useForEditor({});
|
|
30174
|
+
const responsiveValue = useMemo$1(() => {
|
|
30175
|
+
return {
|
|
30176
|
+
scale: props.devicePixelRatio ? 1 / props.devicePixelRatio : DEFAULT_SCALE
|
|
30177
|
+
};
|
|
30178
|
+
}, []);
|
|
30109
30179
|
const [values, setValues] = useState({});
|
|
30110
30180
|
const [dsValues, setDsValues] = useState({});
|
|
30111
30181
|
const [nodes, setNodes] = useState([]);
|
|
@@ -30175,7 +30245,7 @@ const MessageContainer = (props) => {
|
|
|
30175
30245
|
},
|
|
30176
30246
|
[onAction]
|
|
30177
30247
|
);
|
|
30178
|
-
const content = /* @__PURE__ */ jsx(
|
|
30248
|
+
const content = /* @__PURE__ */ jsx(ResponsiveContext.Provider, { value: responsiveValue, children: /* @__PURE__ */ jsx(
|
|
30179
30249
|
ActionProvider,
|
|
30180
30250
|
{
|
|
30181
30251
|
onAction,
|
|
@@ -30204,11 +30274,8 @@ const MessageContainer = (props) => {
|
|
|
30204
30274
|
)
|
|
30205
30275
|
] })
|
|
30206
30276
|
}
|
|
30207
|
-
);
|
|
30208
|
-
|
|
30209
|
-
return /* @__PURE__ */ jsx(ThemeProvider, { theme, children: content });
|
|
30210
|
-
}
|
|
30211
|
-
return content;
|
|
30277
|
+
) });
|
|
30278
|
+
return /* @__PURE__ */ jsx(ThemeProvider, { scale: responsiveValue.scale, theme, children: content });
|
|
30212
30279
|
};
|
|
30213
30280
|
var __defProp$5 = Object.defineProperty;
|
|
30214
30281
|
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -33911,11 +33978,6 @@ var __spreadValues$1 = (a, b) => {
|
|
|
33911
33978
|
};
|
|
33912
33979
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
33913
33980
|
const MessageCard = (props) => {
|
|
33914
|
-
const responsiveValue = useMemo$1(() => {
|
|
33915
|
-
return {
|
|
33916
|
-
scale: 0.5
|
|
33917
|
-
};
|
|
33918
|
-
}, []);
|
|
33919
33981
|
const {
|
|
33920
33982
|
templateJson,
|
|
33921
33983
|
templateData,
|
|
@@ -33926,7 +33988,7 @@ const MessageCard = (props) => {
|
|
|
33926
33988
|
theme
|
|
33927
33989
|
} = useMessageCardLogic(props);
|
|
33928
33990
|
const { data = {} } = props;
|
|
33929
|
-
return /* @__PURE__ */ jsx(
|
|
33991
|
+
return /* @__PURE__ */ jsx("div", { className: "message-card-wrapper", children: /* @__PURE__ */ jsx(
|
|
33930
33992
|
Render,
|
|
33931
33993
|
__spreadValues$1({
|
|
33932
33994
|
component: __spreadProps(__spreadValues$1({}, templateJson), {
|
|
@@ -33947,7 +34009,7 @@ const MessageCard = (props) => {
|
|
|
33947
34009
|
},
|
|
33948
34010
|
externalActions: props.externalActions
|
|
33949
34011
|
}, props)
|
|
33950
|
-
) })
|
|
34012
|
+
) });
|
|
33951
34013
|
};
|
|
33952
34014
|
const MessageCard_default = forwardRef(MessageCard);
|
|
33953
34015
|
var __defProp = Object.defineProperty;
|
|
@@ -33977,7 +34039,7 @@ export {
|
|
|
33977
34039
|
ThemeProvider,
|
|
33978
34040
|
createRenderComponent,
|
|
33979
34041
|
MessageCard_default as default,
|
|
33980
|
-
defaultTheme$
|
|
34042
|
+
defaultTheme$2 as defaultTheme,
|
|
33981
34043
|
isLayoutNode,
|
|
33982
34044
|
isRenderNode,
|
|
33983
34045
|
useTheme$1 as useTheme
|