openxiangda 1.0.35 → 1.0.36
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/README.md +2 -0
- package/lib/cli.js +1 -1
- package/openxiangda-skills/SKILL.md +1 -1
- package/openxiangda-skills/references/component-guide.md +10 -11
- package/openxiangda-skills/references/style-system.md +14 -18
- package/openxiangda-skills/references/troubleshooting.md +13 -13
- package/openxiangda-skills/skills/openxiangda-page/SKILL.md +2 -2
- package/package.json +1 -1
- package/packages/sdk/dist/runtime/index.cjs +67 -30
- package/packages/sdk/dist/runtime/index.cjs.map +1 -1
- package/packages/sdk/dist/runtime/index.mjs +67 -30
- package/packages/sdk/dist/runtime/index.mjs.map +1 -1
- package/packages/sdk/dist/styles/antd-theme.cjs +11 -3
- package/packages/sdk/dist/styles/antd-theme.cjs.map +1 -1
- package/packages/sdk/dist/styles/antd-theme.d.mts +2 -1
- package/packages/sdk/dist/styles/antd-theme.d.ts +2 -1
- package/packages/sdk/dist/styles/antd-theme.mjs +11 -3
- package/packages/sdk/dist/styles/antd-theme.mjs.map +1 -1
- package/packages/sdk/dist/styles/tailwind-preset.cjs +0 -1
- package/packages/sdk/dist/styles/tailwind-preset.cjs.map +1 -1
- package/packages/sdk/dist/styles/tailwind-preset.d.mts +0 -1
- package/packages/sdk/dist/styles/tailwind-preset.d.ts +0 -1
- package/packages/sdk/dist/styles/tailwind-preset.mjs +0 -1
- package/packages/sdk/dist/styles/tailwind-preset.mjs.map +1 -1
- package/packages/sdk/dist/styles/tokens.css +1 -0
- package/packages/sdk/src/build-source/scripts/build-forms.mjs +135 -50
- package/packages/sdk/src/build-source/scripts/build-pages.mjs +37 -10
- package/packages/sdk/src/build-source/scripts/register.mjs +2 -0
- package/packages/sdk/src/build-source/scripts/utils/load-config.mjs +3 -2
- package/packages/sdk/src/build-source/scripts/utils/register-payload.test.ts +2 -1
- package/packages/sdk/src/build-source/scripts/utils/tailwind-config.mjs +9 -7
- package/packages/sdk/src/build-source/scripts/utils/tailwind-config.test.ts +6 -4
- package/packages/sdk/src/build-source/src/cli.mjs +17 -0
- package/templates/sy-lowcode-app-workspace/app-workspace.config.ts +3 -3
- package/templates/sy-lowcode-app-workspace/postcss.config.cjs +0 -15
- package/templates/sy-lowcode-app-workspace/src/main.tsx +1 -12
|
@@ -1231,8 +1231,7 @@ var PageProvider = ({
|
|
|
1231
1231
|
};
|
|
1232
1232
|
|
|
1233
1233
|
// packages/sdk/src/styles/antd-theme.ts
|
|
1234
|
-
var
|
|
1235
|
-
cssVar: { prefix: "sy-ant" },
|
|
1234
|
+
var baseTheme = {
|
|
1236
1235
|
hashed: false,
|
|
1237
1236
|
token: {
|
|
1238
1237
|
colorPrimary: "#1677ff",
|
|
@@ -1260,6 +1259,14 @@ var antdTheme = {
|
|
|
1260
1259
|
Card: { paddingLG: 24 }
|
|
1261
1260
|
}
|
|
1262
1261
|
};
|
|
1262
|
+
var antdTheme = {
|
|
1263
|
+
...baseTheme,
|
|
1264
|
+
cssVar: { prefix: "ant" }
|
|
1265
|
+
};
|
|
1266
|
+
var legacyAntdTheme = {
|
|
1267
|
+
...baseTheme,
|
|
1268
|
+
cssVar: { prefix: "sy-ant" }
|
|
1269
|
+
};
|
|
1263
1270
|
|
|
1264
1271
|
// packages/sdk/src/runtime/react/createReactPage.tsx
|
|
1265
1272
|
import { Fragment, jsx as jsx2 } from "react/jsx-runtime";
|
|
@@ -1280,6 +1287,21 @@ var MESSAGE_METHODS = [
|
|
|
1280
1287
|
var createRuntimeRoot = (el) => {
|
|
1281
1288
|
return createRoot(el);
|
|
1282
1289
|
};
|
|
1290
|
+
var normalizeCssIsolation = (value) => {
|
|
1291
|
+
if (value === "namespace" || value === "shadow") return value;
|
|
1292
|
+
return "none";
|
|
1293
|
+
};
|
|
1294
|
+
var usesLegacyCssIsolation = (cssIsolation) => cssIsolation === "namespace" || cssIsolation === "shadow";
|
|
1295
|
+
var getRuntimeCssIsolation = (context) => normalizeCssIsolation(context.page?.capabilities?.cssIsolation);
|
|
1296
|
+
var getAntdRuntimeOptions = (cssIsolation) => {
|
|
1297
|
+
const legacy = usesLegacyCssIsolation(cssIsolation);
|
|
1298
|
+
return {
|
|
1299
|
+
prefixCls: legacy ? "sy-ant" : "ant",
|
|
1300
|
+
iconPrefixCls: legacy ? "sy-anticon" : "anticon",
|
|
1301
|
+
messagePrefixCls: legacy ? "sy-ant-message" : "ant-message",
|
|
1302
|
+
theme: legacy ? legacyAntdTheme : antdTheme
|
|
1303
|
+
};
|
|
1304
|
+
};
|
|
1283
1305
|
var isShadowRoot = (rootNode) => typeof ShadowRoot !== "undefined" && rootNode instanceof ShadowRoot;
|
|
1284
1306
|
var getStyleContainer = (el) => {
|
|
1285
1307
|
const rootNode = el.getRootNode?.();
|
|
@@ -1308,14 +1330,19 @@ var getRuntimeOverlayContainer = (el, portalContainer) => {
|
|
|
1308
1330
|
getTargetContainer: () => getRuntimeRoot(el)
|
|
1309
1331
|
};
|
|
1310
1332
|
};
|
|
1311
|
-
var createAntdConfig = (overlayContainer) =>
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1333
|
+
var createAntdConfig = (overlayContainer, cssIsolation) => {
|
|
1334
|
+
const antdOptions = getAntdRuntimeOptions(cssIsolation);
|
|
1335
|
+
return {
|
|
1336
|
+
locale: zhCN,
|
|
1337
|
+
prefixCls: antdOptions.prefixCls,
|
|
1338
|
+
iconPrefixCls: antdOptions.iconPrefixCls,
|
|
1339
|
+
theme: antdOptions.theme,
|
|
1340
|
+
...usesLegacyCssIsolation(cssIsolation) ? {
|
|
1341
|
+
getPopupContainer: overlayContainer.getPopupContainer,
|
|
1342
|
+
getTargetContainer: overlayContainer.getTargetContainer
|
|
1343
|
+
} : {}
|
|
1344
|
+
};
|
|
1345
|
+
};
|
|
1319
1346
|
var createPortalContainer = (el) => {
|
|
1320
1347
|
const rootNode = el.getRootNode?.();
|
|
1321
1348
|
const parent = isShadowRoot(rootNode) ? rootNode : el.ownerDocument?.body || document.body;
|
|
@@ -1365,11 +1392,12 @@ var registerAntdMessageApi = (api) => {
|
|
|
1365
1392
|
}
|
|
1366
1393
|
};
|
|
1367
1394
|
};
|
|
1368
|
-
var installRuntimePortalContainer = (el) => {
|
|
1395
|
+
var installRuntimePortalContainer = (el, cssIsolation) => {
|
|
1369
1396
|
const globalScope = globalThis;
|
|
1370
|
-
const portalContainer = createPortalContainer(el);
|
|
1397
|
+
const portalContainer = usesLegacyCssIsolation(cssIsolation) ? createPortalContainer(el) : null;
|
|
1371
1398
|
const stack = Array.isArray(globalScope[PORTAL_CONTAINER_STACK_GLOBAL]) ? globalScope[PORTAL_CONTAINER_STACK_GLOBAL] : [];
|
|
1372
|
-
|
|
1399
|
+
const stackTarget = portalContainer ?? el.ownerDocument?.body ?? document.body;
|
|
1400
|
+
stack.push(stackTarget);
|
|
1373
1401
|
globalScope[PORTAL_CONTAINER_STACK_GLOBAL] = stack;
|
|
1374
1402
|
globalScope[PORTAL_CONTAINER_RESOLVER_GLOBAL] = () => {
|
|
1375
1403
|
for (let index = stack.length - 1; index >= 0; index -= 1) {
|
|
@@ -1383,42 +1411,43 @@ var installRuntimePortalContainer = (el) => {
|
|
|
1383
1411
|
return {
|
|
1384
1412
|
container: portalContainer,
|
|
1385
1413
|
release: () => {
|
|
1386
|
-
const position = stack.lastIndexOf(
|
|
1414
|
+
const position = stack.lastIndexOf(stackTarget);
|
|
1387
1415
|
if (position >= 0) {
|
|
1388
1416
|
stack.splice(position, 1);
|
|
1389
1417
|
}
|
|
1390
|
-
portalContainer
|
|
1418
|
+
portalContainer?.remove();
|
|
1391
1419
|
}
|
|
1392
1420
|
};
|
|
1393
1421
|
};
|
|
1394
|
-
var installAntdStaticHolder = (el, portalContainer) => {
|
|
1422
|
+
var installAntdStaticHolder = (el, portalContainer, cssIsolation) => {
|
|
1395
1423
|
installAntdMessageProxy();
|
|
1424
|
+
const antdOptions = getAntdRuntimeOptions(cssIsolation);
|
|
1396
1425
|
const getMessageContainer = () => {
|
|
1397
1426
|
if (portalContainer?.isConnected) return portalContainer;
|
|
1398
|
-
return getRuntimeRoot(el);
|
|
1427
|
+
return usesLegacyCssIsolation(cssIsolation) ? getRuntimeRoot(el) : document.body;
|
|
1399
1428
|
};
|
|
1400
1429
|
ConfigProvider.config({
|
|
1401
|
-
prefixCls:
|
|
1402
|
-
iconPrefixCls:
|
|
1403
|
-
theme:
|
|
1430
|
+
prefixCls: antdOptions.prefixCls,
|
|
1431
|
+
iconPrefixCls: antdOptions.iconPrefixCls,
|
|
1432
|
+
theme: antdOptions.theme,
|
|
1404
1433
|
holderRender: (children) => {
|
|
1405
1434
|
if (!el.isConnected) {
|
|
1406
1435
|
return /* @__PURE__ */ jsx2(
|
|
1407
1436
|
ConfigProvider,
|
|
1408
1437
|
{
|
|
1409
|
-
prefixCls:
|
|
1410
|
-
iconPrefixCls:
|
|
1411
|
-
theme:
|
|
1438
|
+
prefixCls: antdOptions.prefixCls,
|
|
1439
|
+
iconPrefixCls: antdOptions.iconPrefixCls,
|
|
1440
|
+
theme: antdOptions.theme,
|
|
1412
1441
|
children
|
|
1413
1442
|
}
|
|
1414
1443
|
);
|
|
1415
1444
|
}
|
|
1416
1445
|
const overlayContainer = getRuntimeOverlayContainer(el, portalContainer);
|
|
1417
|
-
return /* @__PURE__ */ jsx2(StyleProvider, { hashPriority: "high", container: getStyleContainer(el), children: /* @__PURE__ */ jsx2(ConfigProvider, { ...createAntdConfig(overlayContainer), children }) });
|
|
1446
|
+
return /* @__PURE__ */ jsx2(StyleProvider, { hashPriority: "high", container: getStyleContainer(el), children: /* @__PURE__ */ jsx2(ConfigProvider, { ...createAntdConfig(overlayContainer, cssIsolation), children }) });
|
|
1418
1447
|
}
|
|
1419
1448
|
});
|
|
1420
1449
|
message.config({
|
|
1421
|
-
prefixCls:
|
|
1450
|
+
prefixCls: antdOptions.messagePrefixCls,
|
|
1422
1451
|
getContainer: getMessageContainer
|
|
1423
1452
|
});
|
|
1424
1453
|
};
|
|
@@ -1436,20 +1465,27 @@ var createReactPage = (AppComponent) => {
|
|
|
1436
1465
|
let currentContainer = null;
|
|
1437
1466
|
let releasePortalContainer = null;
|
|
1438
1467
|
let portalContainer = null;
|
|
1468
|
+
let currentCssIsolation = null;
|
|
1439
1469
|
const render = (el, context) => {
|
|
1440
|
-
|
|
1441
|
-
if (
|
|
1470
|
+
const cssIsolation = getRuntimeCssIsolation(context);
|
|
1471
|
+
if (usesLegacyCssIsolation(cssIsolation)) {
|
|
1472
|
+
el.classList.add(NAMESPACE_ROOT_CLASS);
|
|
1473
|
+
} else {
|
|
1474
|
+
el.classList.remove(NAMESPACE_ROOT_CLASS);
|
|
1475
|
+
}
|
|
1476
|
+
if (!root || currentContainer !== el || currentCssIsolation !== cssIsolation || usesLegacyCssIsolation(cssIsolation) && !portalContainer?.isConnected) {
|
|
1442
1477
|
root?.unmount();
|
|
1443
1478
|
releasePortalContainer?.();
|
|
1444
1479
|
root = createRuntimeRoot(el);
|
|
1445
1480
|
currentContainer = el;
|
|
1446
|
-
|
|
1481
|
+
currentCssIsolation = cssIsolation;
|
|
1482
|
+
const portalHandle = installRuntimePortalContainer(el, cssIsolation);
|
|
1447
1483
|
portalContainer = portalHandle.container;
|
|
1448
1484
|
releasePortalContainer = portalHandle.release;
|
|
1449
1485
|
}
|
|
1450
1486
|
const overlayContainer = getRuntimeOverlayContainer(el, portalContainer);
|
|
1451
|
-
installAntdStaticHolder(el, portalContainer);
|
|
1452
|
-
const antdConfig = createAntdConfig(overlayContainer);
|
|
1487
|
+
installAntdStaticHolder(el, portalContainer, cssIsolation);
|
|
1488
|
+
const antdConfig = createAntdConfig(overlayContainer, cssIsolation);
|
|
1453
1489
|
root.render(
|
|
1454
1490
|
/* @__PURE__ */ jsx2(StyleProvider, { hashPriority: "high", container: getStyleContainer(el), children: /* @__PURE__ */ jsx2(ConfigProvider, { ...antdConfig, children: /* @__PURE__ */ jsx2(AntdApp, { children: /* @__PURE__ */ jsx2(RuntimeMessageBridge, { children: /* @__PURE__ */ jsx2(PageProvider, { context, children: /* @__PURE__ */ jsx2(AppComponent, {}) }) }) }) }) })
|
|
1455
1491
|
);
|
|
@@ -1468,6 +1504,7 @@ var createReactPage = (AppComponent) => {
|
|
|
1468
1504
|
currentContainer = null;
|
|
1469
1505
|
releasePortalContainer = null;
|
|
1470
1506
|
portalContainer = null;
|
|
1507
|
+
currentCssIsolation = null;
|
|
1471
1508
|
}
|
|
1472
1509
|
};
|
|
1473
1510
|
};
|