openxiangda 1.0.1 → 1.0.3
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/package.json +1 -1
- package/packages/sdk/dist/build/index.cjs +68 -0
- package/packages/sdk/dist/build/index.cjs.map +1 -1
- package/packages/sdk/dist/build/index.d.mts +9 -1
- package/packages/sdk/dist/build/index.d.ts +9 -1
- package/packages/sdk/dist/build/index.mjs +68 -0
- package/packages/sdk/dist/build/index.mjs.map +1 -1
- package/packages/sdk/dist/components/index.cjs +40 -13
- package/packages/sdk/dist/components/index.cjs.map +1 -1
- package/packages/sdk/dist/components/index.mjs +40 -13
- package/packages/sdk/dist/components/index.mjs.map +1 -1
- package/packages/sdk/dist/runtime/index.cjs +100 -25
- package/packages/sdk/dist/runtime/index.cjs.map +1 -1
- package/packages/sdk/dist/runtime/index.mjs +100 -25
- package/packages/sdk/dist/runtime/index.mjs.map +1 -1
- package/packages/sdk/src/build-source/scripts/build-forms.mjs +155 -36
- package/packages/sdk/src/build-source/scripts/build-pages.mjs +27 -4
- package/packages/sdk/src/build-source/scripts/utils/namespace-css.mjs +21 -5
- package/packages/sdk/src/build-source/scripts/utils/namespace-css.test.ts +29 -0
- package/packages/sdk/src/build-source/scripts/utils/tailwind-config.mjs +51 -1
- package/packages/sdk/src/build-source/scripts/utils/tailwind-config.test.ts +31 -2
- package/templates/sy-lowcode-app-workspace/postcss.config.cjs +22 -4
package/package.json
CHANGED
|
@@ -20,10 +20,78 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// packages/sdk/src/build/index.ts
|
|
21
21
|
var build_exports = {};
|
|
22
22
|
__export(build_exports, {
|
|
23
|
+
createNamespaceCssPlugin: () => createNamespaceCssPlugin,
|
|
24
|
+
createOpenXiangdaNamespaceCssPlugin: () => createOpenXiangdaNamespaceCssPlugin,
|
|
23
25
|
defineAppWorkspaceConfig: () => defineAppWorkspaceConfig
|
|
24
26
|
});
|
|
25
27
|
module.exports = __toCommonJS(build_exports);
|
|
26
28
|
function defineAppWorkspaceConfig(config) {
|
|
27
29
|
return config;
|
|
28
30
|
}
|
|
31
|
+
var DEFAULT_NAMESPACE_PREFIX = ".sy-app-workspace";
|
|
32
|
+
function splitCssSelectors(selector) {
|
|
33
|
+
const selectors = [];
|
|
34
|
+
let depth = 0;
|
|
35
|
+
let quote = "";
|
|
36
|
+
let current = "";
|
|
37
|
+
for (const char of selector) {
|
|
38
|
+
if (quote) {
|
|
39
|
+
current += char;
|
|
40
|
+
if (char === quote) quote = "";
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
if (char === '"' || char === "'") {
|
|
44
|
+
quote = char;
|
|
45
|
+
current += char;
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
if (char === "(" || char === "[") depth += 1;
|
|
49
|
+
if (char === ")" || char === "]") depth -= 1;
|
|
50
|
+
if (char === "," && depth === 0) {
|
|
51
|
+
selectors.push(current.trim());
|
|
52
|
+
current = "";
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
current += char;
|
|
56
|
+
}
|
|
57
|
+
if (current.trim()) selectors.push(current.trim());
|
|
58
|
+
return selectors;
|
|
59
|
+
}
|
|
60
|
+
function shouldSkipNamespace(selector, prefix) {
|
|
61
|
+
if (!selector || selector.includes(prefix)) return true;
|
|
62
|
+
if (/^(html|body|:root)(\b|:|\[|$)/.test(selector)) return true;
|
|
63
|
+
if (/^(@|from\b|to\b|\d+%)/.test(selector)) return true;
|
|
64
|
+
if (/^\.(ant|sy-ant|anticon|adm)-/.test(selector)) return true;
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
function createAntdSelectorAlias(selector) {
|
|
68
|
+
const aliased = selector.replace(/(^|[^A-Za-z0-9_-])\.ant-/g, "$1.sy-ant-").replace(/(^|[^A-Za-z0-9_-])\.anticon-/g, "$1.sy-anticon-").replace(/(^|[^A-Za-z0-9_-])\.anticon(?=$|[^A-Za-z0-9_-])/g, "$1.sy-anticon");
|
|
69
|
+
return aliased === selector ? null : aliased;
|
|
70
|
+
}
|
|
71
|
+
function createOpenXiangdaNamespaceCssPlugin(prefix = DEFAULT_NAMESPACE_PREFIX) {
|
|
72
|
+
return {
|
|
73
|
+
postcssPlugin: "openxiangda-namespace-css",
|
|
74
|
+
Rule(rule) {
|
|
75
|
+
if (!rule.selector) return;
|
|
76
|
+
let parent = rule.parent;
|
|
77
|
+
while (parent) {
|
|
78
|
+
if (parent.type === "atrule" && /keyframes$/i.test(parent.name)) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
parent = parent.parent;
|
|
82
|
+
}
|
|
83
|
+
rule.selector = Array.from(
|
|
84
|
+
new Set(
|
|
85
|
+
splitCssSelectors(rule.selector).flatMap((selector) => {
|
|
86
|
+
const scopedSelector = shouldSkipNamespace(selector, prefix) ? selector : `${prefix} ${selector}`;
|
|
87
|
+
const antdAlias = createAntdSelectorAlias(scopedSelector);
|
|
88
|
+
return antdAlias ? [scopedSelector, antdAlias] : [scopedSelector];
|
|
89
|
+
})
|
|
90
|
+
)
|
|
91
|
+
).join(", ");
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
createOpenXiangdaNamespaceCssPlugin.postcss = true;
|
|
96
|
+
var createNamespaceCssPlugin = createOpenXiangdaNamespaceCssPlugin;
|
|
29
97
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/build/index.ts"],"sourcesContent":["export type CssIsolation = 'namespace' | 'shadow' | 'none';\n\nexport interface AppWorkspaceConfig {\n appType?: string;\n appName?: string;\n platformUrl?: string;\n servicePrefix?: string;\n appKey?: string;\n appSecret?: string;\n userId?: string;\n version?: string;\n buildId?: string;\n oss?: {\n region?: string;\n bucket?: string;\n accessKeyId?: string;\n accessKeySecret?: string;\n pathPrefix?: string;\n corsOrigins?: string[];\n skipCors?: boolean;\n };\n defaults?: {\n protocolVersion?: string;\n frameworkVersion?: string;\n cssIsolation?: CssIsolation;\n formMenuParentId?: string;\n formMenuIcon?: string;\n pageMenuParentId?: string;\n pageMenuIcon?: string;\n formBuilderVersion?: string;\n };\n forms?: { dir?: string };\n pages?: { dir?: string };\n}\n\nexport function defineAppWorkspaceConfig<T extends AppWorkspaceConfig>(config: T): T {\n return config;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAmCO,SAAS,yBAAuD,QAAc;AACnF,SAAO;AACT;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/build/index.ts"],"sourcesContent":["export type CssIsolation = 'namespace' | 'shadow' | 'none';\n\nexport interface AppWorkspaceConfig {\n appType?: string;\n appName?: string;\n platformUrl?: string;\n servicePrefix?: string;\n appKey?: string;\n appSecret?: string;\n userId?: string;\n version?: string;\n buildId?: string;\n oss?: {\n region?: string;\n bucket?: string;\n accessKeyId?: string;\n accessKeySecret?: string;\n pathPrefix?: string;\n corsOrigins?: string[];\n skipCors?: boolean;\n };\n defaults?: {\n protocolVersion?: string;\n frameworkVersion?: string;\n cssIsolation?: CssIsolation;\n formMenuParentId?: string;\n formMenuIcon?: string;\n pageMenuParentId?: string;\n pageMenuIcon?: string;\n formBuilderVersion?: string;\n };\n forms?: { dir?: string };\n pages?: { dir?: string };\n}\n\nexport function defineAppWorkspaceConfig<T extends AppWorkspaceConfig>(config: T): T {\n return config;\n}\n\nconst DEFAULT_NAMESPACE_PREFIX = '.sy-app-workspace';\n\nfunction splitCssSelectors(selector: string) {\n const selectors: string[] = [];\n let depth = 0;\n let quote = '';\n let current = '';\n for (const char of selector) {\n if (quote) {\n current += char;\n if (char === quote) quote = '';\n continue;\n }\n if (char === '\"' || char === \"'\") {\n quote = char;\n current += char;\n continue;\n }\n if (char === '(' || char === '[') depth += 1;\n if (char === ')' || char === ']') depth -= 1;\n if (char === ',' && depth === 0) {\n selectors.push(current.trim());\n current = '';\n continue;\n }\n current += char;\n }\n if (current.trim()) selectors.push(current.trim());\n return selectors;\n}\n\nfunction shouldSkipNamespace(selector: string, prefix: string) {\n if (!selector || selector.includes(prefix)) return true;\n if (/^(html|body|:root)(\\b|:|\\[|$)/.test(selector)) return true;\n if (/^(@|from\\b|to\\b|\\d+%)/.test(selector)) return true;\n if (/^\\.(ant|sy-ant|anticon|adm)-/.test(selector)) return true;\n return false;\n}\n\nfunction createAntdSelectorAlias(selector: string) {\n const aliased = selector\n .replace(/(^|[^A-Za-z0-9_-])\\.ant-/g, '$1.sy-ant-')\n .replace(/(^|[^A-Za-z0-9_-])\\.anticon-/g, '$1.sy-anticon-')\n .replace(/(^|[^A-Za-z0-9_-])\\.anticon(?=$|[^A-Za-z0-9_-])/g, '$1.sy-anticon');\n return aliased === selector ? null : aliased;\n}\n\nexport function createOpenXiangdaNamespaceCssPlugin(\n prefix = DEFAULT_NAMESPACE_PREFIX,\n) {\n return {\n postcssPlugin: 'openxiangda-namespace-css',\n Rule(rule: { selector?: string; parent?: any }) {\n if (!rule.selector) return;\n let parent = rule.parent;\n while (parent) {\n if (parent.type === 'atrule' && /keyframes$/i.test(parent.name)) {\n return;\n }\n parent = parent.parent;\n }\n rule.selector = Array.from(\n new Set(\n splitCssSelectors(rule.selector).flatMap((selector) => {\n const scopedSelector = shouldSkipNamespace(selector, prefix)\n ? selector\n : `${prefix} ${selector}`;\n const antdAlias = createAntdSelectorAlias(scopedSelector);\n return antdAlias ? [scopedSelector, antdAlias] : [scopedSelector];\n }),\n ),\n ).join(', ');\n },\n };\n}\n\n(createOpenXiangdaNamespaceCssPlugin as any).postcss = true;\n\nexport const createNamespaceCssPlugin = createOpenXiangdaNamespaceCssPlugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAmCO,SAAS,yBAAuD,QAAc;AACnF,SAAO;AACT;AAEA,IAAM,2BAA2B;AAEjC,SAAS,kBAAkB,UAAkB;AAC3C,QAAM,YAAsB,CAAC;AAC7B,MAAI,QAAQ;AACZ,MAAI,QAAQ;AACZ,MAAI,UAAU;AACd,aAAW,QAAQ,UAAU;AAC3B,QAAI,OAAO;AACT,iBAAW;AACX,UAAI,SAAS,MAAO,SAAQ;AAC5B;AAAA,IACF;AACA,QAAI,SAAS,OAAO,SAAS,KAAK;AAChC,cAAQ;AACR,iBAAW;AACX;AAAA,IACF;AACA,QAAI,SAAS,OAAO,SAAS,IAAK,UAAS;AAC3C,QAAI,SAAS,OAAO,SAAS,IAAK,UAAS;AAC3C,QAAI,SAAS,OAAO,UAAU,GAAG;AAC/B,gBAAU,KAAK,QAAQ,KAAK,CAAC;AAC7B,gBAAU;AACV;AAAA,IACF;AACA,eAAW;AAAA,EACb;AACA,MAAI,QAAQ,KAAK,EAAG,WAAU,KAAK,QAAQ,KAAK,CAAC;AACjD,SAAO;AACT;AAEA,SAAS,oBAAoB,UAAkB,QAAgB;AAC7D,MAAI,CAAC,YAAY,SAAS,SAAS,MAAM,EAAG,QAAO;AACnD,MAAI,gCAAgC,KAAK,QAAQ,EAAG,QAAO;AAC3D,MAAI,wBAAwB,KAAK,QAAQ,EAAG,QAAO;AACnD,MAAI,+BAA+B,KAAK,QAAQ,EAAG,QAAO;AAC1D,SAAO;AACT;AAEA,SAAS,wBAAwB,UAAkB;AACjD,QAAM,UAAU,SACb,QAAQ,6BAA6B,YAAY,EACjD,QAAQ,iCAAiC,gBAAgB,EACzD,QAAQ,oDAAoD,eAAe;AAC9E,SAAO,YAAY,WAAW,OAAO;AACvC;AAEO,SAAS,oCACd,SAAS,0BACT;AACA,SAAO;AAAA,IACL,eAAe;AAAA,IACf,KAAK,MAA2C;AAC9C,UAAI,CAAC,KAAK,SAAU;AACpB,UAAI,SAAS,KAAK;AAClB,aAAO,QAAQ;AACb,YAAI,OAAO,SAAS,YAAY,cAAc,KAAK,OAAO,IAAI,GAAG;AAC/D;AAAA,QACF;AACA,iBAAS,OAAO;AAAA,MAClB;AACA,WAAK,WAAW,MAAM;AAAA,QACpB,IAAI;AAAA,UACF,kBAAkB,KAAK,QAAQ,EAAE,QAAQ,CAAC,aAAa;AACrD,kBAAM,iBAAiB,oBAAoB,UAAU,MAAM,IACvD,WACA,GAAG,MAAM,IAAI,QAAQ;AACzB,kBAAM,YAAY,wBAAwB,cAAc;AACxD,mBAAO,YAAY,CAAC,gBAAgB,SAAS,IAAI,CAAC,cAAc;AAAA,UAClE,CAAC;AAAA,QACH;AAAA,MACF,EAAE,KAAK,IAAI;AAAA,IACb;AAAA,EACF;AACF;AAEC,oCAA4C,UAAU;AAEhD,IAAM,2BAA2B;","names":[]}
|
|
@@ -36,5 +36,13 @@ interface AppWorkspaceConfig {
|
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
38
|
declare function defineAppWorkspaceConfig<T extends AppWorkspaceConfig>(config: T): T;
|
|
39
|
+
declare function createOpenXiangdaNamespaceCssPlugin(prefix?: string): {
|
|
40
|
+
postcssPlugin: string;
|
|
41
|
+
Rule(rule: {
|
|
42
|
+
selector?: string;
|
|
43
|
+
parent?: any;
|
|
44
|
+
}): void;
|
|
45
|
+
};
|
|
46
|
+
declare const createNamespaceCssPlugin: typeof createOpenXiangdaNamespaceCssPlugin;
|
|
39
47
|
|
|
40
|
-
export { type AppWorkspaceConfig, type CssIsolation, defineAppWorkspaceConfig };
|
|
48
|
+
export { type AppWorkspaceConfig, type CssIsolation, createNamespaceCssPlugin, createOpenXiangdaNamespaceCssPlugin, defineAppWorkspaceConfig };
|
|
@@ -36,5 +36,13 @@ interface AppWorkspaceConfig {
|
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
38
|
declare function defineAppWorkspaceConfig<T extends AppWorkspaceConfig>(config: T): T;
|
|
39
|
+
declare function createOpenXiangdaNamespaceCssPlugin(prefix?: string): {
|
|
40
|
+
postcssPlugin: string;
|
|
41
|
+
Rule(rule: {
|
|
42
|
+
selector?: string;
|
|
43
|
+
parent?: any;
|
|
44
|
+
}): void;
|
|
45
|
+
};
|
|
46
|
+
declare const createNamespaceCssPlugin: typeof createOpenXiangdaNamespaceCssPlugin;
|
|
39
47
|
|
|
40
|
-
export { type AppWorkspaceConfig, type CssIsolation, defineAppWorkspaceConfig };
|
|
48
|
+
export { type AppWorkspaceConfig, type CssIsolation, createNamespaceCssPlugin, createOpenXiangdaNamespaceCssPlugin, defineAppWorkspaceConfig };
|
|
@@ -2,7 +2,75 @@
|
|
|
2
2
|
function defineAppWorkspaceConfig(config) {
|
|
3
3
|
return config;
|
|
4
4
|
}
|
|
5
|
+
var DEFAULT_NAMESPACE_PREFIX = ".sy-app-workspace";
|
|
6
|
+
function splitCssSelectors(selector) {
|
|
7
|
+
const selectors = [];
|
|
8
|
+
let depth = 0;
|
|
9
|
+
let quote = "";
|
|
10
|
+
let current = "";
|
|
11
|
+
for (const char of selector) {
|
|
12
|
+
if (quote) {
|
|
13
|
+
current += char;
|
|
14
|
+
if (char === quote) quote = "";
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
17
|
+
if (char === '"' || char === "'") {
|
|
18
|
+
quote = char;
|
|
19
|
+
current += char;
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
if (char === "(" || char === "[") depth += 1;
|
|
23
|
+
if (char === ")" || char === "]") depth -= 1;
|
|
24
|
+
if (char === "," && depth === 0) {
|
|
25
|
+
selectors.push(current.trim());
|
|
26
|
+
current = "";
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
current += char;
|
|
30
|
+
}
|
|
31
|
+
if (current.trim()) selectors.push(current.trim());
|
|
32
|
+
return selectors;
|
|
33
|
+
}
|
|
34
|
+
function shouldSkipNamespace(selector, prefix) {
|
|
35
|
+
if (!selector || selector.includes(prefix)) return true;
|
|
36
|
+
if (/^(html|body|:root)(\b|:|\[|$)/.test(selector)) return true;
|
|
37
|
+
if (/^(@|from\b|to\b|\d+%)/.test(selector)) return true;
|
|
38
|
+
if (/^\.(ant|sy-ant|anticon|adm)-/.test(selector)) return true;
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
function createAntdSelectorAlias(selector) {
|
|
42
|
+
const aliased = selector.replace(/(^|[^A-Za-z0-9_-])\.ant-/g, "$1.sy-ant-").replace(/(^|[^A-Za-z0-9_-])\.anticon-/g, "$1.sy-anticon-").replace(/(^|[^A-Za-z0-9_-])\.anticon(?=$|[^A-Za-z0-9_-])/g, "$1.sy-anticon");
|
|
43
|
+
return aliased === selector ? null : aliased;
|
|
44
|
+
}
|
|
45
|
+
function createOpenXiangdaNamespaceCssPlugin(prefix = DEFAULT_NAMESPACE_PREFIX) {
|
|
46
|
+
return {
|
|
47
|
+
postcssPlugin: "openxiangda-namespace-css",
|
|
48
|
+
Rule(rule) {
|
|
49
|
+
if (!rule.selector) return;
|
|
50
|
+
let parent = rule.parent;
|
|
51
|
+
while (parent) {
|
|
52
|
+
if (parent.type === "atrule" && /keyframes$/i.test(parent.name)) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
parent = parent.parent;
|
|
56
|
+
}
|
|
57
|
+
rule.selector = Array.from(
|
|
58
|
+
new Set(
|
|
59
|
+
splitCssSelectors(rule.selector).flatMap((selector) => {
|
|
60
|
+
const scopedSelector = shouldSkipNamespace(selector, prefix) ? selector : `${prefix} ${selector}`;
|
|
61
|
+
const antdAlias = createAntdSelectorAlias(scopedSelector);
|
|
62
|
+
return antdAlias ? [scopedSelector, antdAlias] : [scopedSelector];
|
|
63
|
+
})
|
|
64
|
+
)
|
|
65
|
+
).join(", ");
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
createOpenXiangdaNamespaceCssPlugin.postcss = true;
|
|
70
|
+
var createNamespaceCssPlugin = createOpenXiangdaNamespaceCssPlugin;
|
|
5
71
|
export {
|
|
72
|
+
createNamespaceCssPlugin,
|
|
73
|
+
createOpenXiangdaNamespaceCssPlugin,
|
|
6
74
|
defineAppWorkspaceConfig
|
|
7
75
|
};
|
|
8
76
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/build/index.ts"],"sourcesContent":["export type CssIsolation = 'namespace' | 'shadow' | 'none';\n\nexport interface AppWorkspaceConfig {\n appType?: string;\n appName?: string;\n platformUrl?: string;\n servicePrefix?: string;\n appKey?: string;\n appSecret?: string;\n userId?: string;\n version?: string;\n buildId?: string;\n oss?: {\n region?: string;\n bucket?: string;\n accessKeyId?: string;\n accessKeySecret?: string;\n pathPrefix?: string;\n corsOrigins?: string[];\n skipCors?: boolean;\n };\n defaults?: {\n protocolVersion?: string;\n frameworkVersion?: string;\n cssIsolation?: CssIsolation;\n formMenuParentId?: string;\n formMenuIcon?: string;\n pageMenuParentId?: string;\n pageMenuIcon?: string;\n formBuilderVersion?: string;\n };\n forms?: { dir?: string };\n pages?: { dir?: string };\n}\n\nexport function defineAppWorkspaceConfig<T extends AppWorkspaceConfig>(config: T): T {\n return config;\n}\n"],"mappings":";AAmCO,SAAS,yBAAuD,QAAc;AACnF,SAAO;AACT;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/build/index.ts"],"sourcesContent":["export type CssIsolation = 'namespace' | 'shadow' | 'none';\n\nexport interface AppWorkspaceConfig {\n appType?: string;\n appName?: string;\n platformUrl?: string;\n servicePrefix?: string;\n appKey?: string;\n appSecret?: string;\n userId?: string;\n version?: string;\n buildId?: string;\n oss?: {\n region?: string;\n bucket?: string;\n accessKeyId?: string;\n accessKeySecret?: string;\n pathPrefix?: string;\n corsOrigins?: string[];\n skipCors?: boolean;\n };\n defaults?: {\n protocolVersion?: string;\n frameworkVersion?: string;\n cssIsolation?: CssIsolation;\n formMenuParentId?: string;\n formMenuIcon?: string;\n pageMenuParentId?: string;\n pageMenuIcon?: string;\n formBuilderVersion?: string;\n };\n forms?: { dir?: string };\n pages?: { dir?: string };\n}\n\nexport function defineAppWorkspaceConfig<T extends AppWorkspaceConfig>(config: T): T {\n return config;\n}\n\nconst DEFAULT_NAMESPACE_PREFIX = '.sy-app-workspace';\n\nfunction splitCssSelectors(selector: string) {\n const selectors: string[] = [];\n let depth = 0;\n let quote = '';\n let current = '';\n for (const char of selector) {\n if (quote) {\n current += char;\n if (char === quote) quote = '';\n continue;\n }\n if (char === '\"' || char === \"'\") {\n quote = char;\n current += char;\n continue;\n }\n if (char === '(' || char === '[') depth += 1;\n if (char === ')' || char === ']') depth -= 1;\n if (char === ',' && depth === 0) {\n selectors.push(current.trim());\n current = '';\n continue;\n }\n current += char;\n }\n if (current.trim()) selectors.push(current.trim());\n return selectors;\n}\n\nfunction shouldSkipNamespace(selector: string, prefix: string) {\n if (!selector || selector.includes(prefix)) return true;\n if (/^(html|body|:root)(\\b|:|\\[|$)/.test(selector)) return true;\n if (/^(@|from\\b|to\\b|\\d+%)/.test(selector)) return true;\n if (/^\\.(ant|sy-ant|anticon|adm)-/.test(selector)) return true;\n return false;\n}\n\nfunction createAntdSelectorAlias(selector: string) {\n const aliased = selector\n .replace(/(^|[^A-Za-z0-9_-])\\.ant-/g, '$1.sy-ant-')\n .replace(/(^|[^A-Za-z0-9_-])\\.anticon-/g, '$1.sy-anticon-')\n .replace(/(^|[^A-Za-z0-9_-])\\.anticon(?=$|[^A-Za-z0-9_-])/g, '$1.sy-anticon');\n return aliased === selector ? null : aliased;\n}\n\nexport function createOpenXiangdaNamespaceCssPlugin(\n prefix = DEFAULT_NAMESPACE_PREFIX,\n) {\n return {\n postcssPlugin: 'openxiangda-namespace-css',\n Rule(rule: { selector?: string; parent?: any }) {\n if (!rule.selector) return;\n let parent = rule.parent;\n while (parent) {\n if (parent.type === 'atrule' && /keyframes$/i.test(parent.name)) {\n return;\n }\n parent = parent.parent;\n }\n rule.selector = Array.from(\n new Set(\n splitCssSelectors(rule.selector).flatMap((selector) => {\n const scopedSelector = shouldSkipNamespace(selector, prefix)\n ? selector\n : `${prefix} ${selector}`;\n const antdAlias = createAntdSelectorAlias(scopedSelector);\n return antdAlias ? [scopedSelector, antdAlias] : [scopedSelector];\n }),\n ),\n ).join(', ');\n },\n };\n}\n\n(createOpenXiangdaNamespaceCssPlugin as any).postcss = true;\n\nexport const createNamespaceCssPlugin = createOpenXiangdaNamespaceCssPlugin;\n"],"mappings":";AAmCO,SAAS,yBAAuD,QAAc;AACnF,SAAO;AACT;AAEA,IAAM,2BAA2B;AAEjC,SAAS,kBAAkB,UAAkB;AAC3C,QAAM,YAAsB,CAAC;AAC7B,MAAI,QAAQ;AACZ,MAAI,QAAQ;AACZ,MAAI,UAAU;AACd,aAAW,QAAQ,UAAU;AAC3B,QAAI,OAAO;AACT,iBAAW;AACX,UAAI,SAAS,MAAO,SAAQ;AAC5B;AAAA,IACF;AACA,QAAI,SAAS,OAAO,SAAS,KAAK;AAChC,cAAQ;AACR,iBAAW;AACX;AAAA,IACF;AACA,QAAI,SAAS,OAAO,SAAS,IAAK,UAAS;AAC3C,QAAI,SAAS,OAAO,SAAS,IAAK,UAAS;AAC3C,QAAI,SAAS,OAAO,UAAU,GAAG;AAC/B,gBAAU,KAAK,QAAQ,KAAK,CAAC;AAC7B,gBAAU;AACV;AAAA,IACF;AACA,eAAW;AAAA,EACb;AACA,MAAI,QAAQ,KAAK,EAAG,WAAU,KAAK,QAAQ,KAAK,CAAC;AACjD,SAAO;AACT;AAEA,SAAS,oBAAoB,UAAkB,QAAgB;AAC7D,MAAI,CAAC,YAAY,SAAS,SAAS,MAAM,EAAG,QAAO;AACnD,MAAI,gCAAgC,KAAK,QAAQ,EAAG,QAAO;AAC3D,MAAI,wBAAwB,KAAK,QAAQ,EAAG,QAAO;AACnD,MAAI,+BAA+B,KAAK,QAAQ,EAAG,QAAO;AAC1D,SAAO;AACT;AAEA,SAAS,wBAAwB,UAAkB;AACjD,QAAM,UAAU,SACb,QAAQ,6BAA6B,YAAY,EACjD,QAAQ,iCAAiC,gBAAgB,EACzD,QAAQ,oDAAoD,eAAe;AAC9E,SAAO,YAAY,WAAW,OAAO;AACvC;AAEO,SAAS,oCACd,SAAS,0BACT;AACA,SAAO;AAAA,IACL,eAAe;AAAA,IACf,KAAK,MAA2C;AAC9C,UAAI,CAAC,KAAK,SAAU;AACpB,UAAI,SAAS,KAAK;AAClB,aAAO,QAAQ;AACb,YAAI,OAAO,SAAS,YAAY,cAAc,KAAK,OAAO,IAAI,GAAG;AAC/D;AAAA,QACF;AACA,iBAAS,OAAO;AAAA,MAClB;AACA,WAAK,WAAW,MAAM;AAAA,QACpB,IAAI;AAAA,UACF,kBAAkB,KAAK,QAAQ,EAAE,QAAQ,CAAC,aAAa;AACrD,kBAAM,iBAAiB,oBAAoB,UAAU,MAAM,IACvD,WACA,GAAG,MAAM,IAAI,QAAQ;AACzB,kBAAM,YAAY,wBAAwB,cAAc;AACxD,mBAAO,YAAY,CAAC,gBAAgB,SAAS,IAAI,CAAC,cAAc;AAAA,UAClE,CAAC;AAAA,QACH;AAAA,MACF,EAAE,KAAK,IAAI;AAAA,IACb;AAAA,EACF;AACF;AAEC,oCAA4C,UAAU;AAEhD,IAAM,2BAA2B;","names":[]}
|
|
@@ -46495,27 +46495,54 @@ var isProcessFormType = (formType) => {
|
|
|
46495
46495
|
};
|
|
46496
46496
|
function resolveDataManagementPopupContainer(rootEl, triggerNode) {
|
|
46497
46497
|
if (rootEl) {
|
|
46498
|
-
|
|
46499
|
-
if (typeof ShadowRoot !== "undefined" && rootNode instanceof ShadowRoot) {
|
|
46500
|
-
return resolveDataManagementPortalContainer(rootEl);
|
|
46501
|
-
}
|
|
46498
|
+
return resolveDataManagementPortalContainer(rootEl);
|
|
46502
46499
|
}
|
|
46503
|
-
return triggerNode?.ownerDocument?.body ||
|
|
46500
|
+
return triggerNode?.ownerDocument?.body || (typeof document !== "undefined" ? document.body : void 0);
|
|
46504
46501
|
}
|
|
46505
46502
|
var DATA_MANAGEMENT_PORTAL_ATTR = "data-sy-data-management-portal";
|
|
46506
|
-
|
|
46507
|
-
|
|
46503
|
+
var DATA_MANAGEMENT_PORTAL_NAMESPACE_CLASS = "sy-app-workspace";
|
|
46504
|
+
var DATA_MANAGEMENT_PORTAL_OWNER_ATTR = "data-sy-data-management-portal-owner";
|
|
46505
|
+
var dataManagementPortalOwnerIds = /* @__PURE__ */ new WeakMap();
|
|
46506
|
+
var dataManagementPortalOwnerSeed = 0;
|
|
46507
|
+
function markDataManagementPortal(portal, ownerId) {
|
|
46508
|
+
portal.classList.add(DATA_MANAGEMENT_PORTAL_NAMESPACE_CLASS);
|
|
46509
|
+
if (ownerId) {
|
|
46510
|
+
portal.setAttribute(DATA_MANAGEMENT_PORTAL_OWNER_ATTR, ownerId);
|
|
46511
|
+
}
|
|
46512
|
+
return portal;
|
|
46513
|
+
}
|
|
46514
|
+
function getDataManagementPortalOwnerId(rootEl) {
|
|
46515
|
+
let ownerId = dataManagementPortalOwnerIds.get(rootEl);
|
|
46516
|
+
if (!ownerId) {
|
|
46517
|
+
dataManagementPortalOwnerSeed += 1;
|
|
46518
|
+
ownerId = `data_management_${dataManagementPortalOwnerSeed}`;
|
|
46519
|
+
dataManagementPortalOwnerIds.set(rootEl, ownerId);
|
|
46520
|
+
}
|
|
46521
|
+
return ownerId;
|
|
46522
|
+
}
|
|
46523
|
+
function getDataManagementPortalParent(rootEl) {
|
|
46508
46524
|
const rootNode = rootEl.getRootNode?.();
|
|
46509
46525
|
if (typeof ShadowRoot !== "undefined" && rootNode instanceof ShadowRoot) {
|
|
46510
|
-
|
|
46511
|
-
if (existing) return existing;
|
|
46512
|
-
const portal = rootEl.ownerDocument.createElement("div");
|
|
46513
|
-
portal.setAttribute(DATA_MANAGEMENT_PORTAL_ATTR, "");
|
|
46514
|
-
rootNode.appendChild(portal);
|
|
46515
|
-
return portal;
|
|
46526
|
+
return rootNode;
|
|
46516
46527
|
}
|
|
46517
46528
|
return rootEl.ownerDocument.body;
|
|
46518
46529
|
}
|
|
46530
|
+
function resolveDataManagementPortalContainer(rootEl) {
|
|
46531
|
+
if (!rootEl) return typeof document !== "undefined" ? document.body : void 0;
|
|
46532
|
+
const ownerId = getDataManagementPortalOwnerId(rootEl);
|
|
46533
|
+
const parent = getDataManagementPortalParent(rootEl);
|
|
46534
|
+
const existing = parent.querySelector(
|
|
46535
|
+
`[${DATA_MANAGEMENT_PORTAL_ATTR}][${DATA_MANAGEMENT_PORTAL_OWNER_ATTR}="${ownerId}"]`
|
|
46536
|
+
) || parent.querySelector(
|
|
46537
|
+
`[${DATA_MANAGEMENT_PORTAL_ATTR}]:not([${DATA_MANAGEMENT_PORTAL_OWNER_ATTR}])`
|
|
46538
|
+
);
|
|
46539
|
+
if (existing) return markDataManagementPortal(existing, ownerId);
|
|
46540
|
+
const portal = rootEl.ownerDocument.createElement("div");
|
|
46541
|
+
portal.setAttribute(DATA_MANAGEMENT_PORTAL_ATTR, "");
|
|
46542
|
+
markDataManagementPortal(portal, ownerId);
|
|
46543
|
+
parent.appendChild(portal);
|
|
46544
|
+
return portal;
|
|
46545
|
+
}
|
|
46519
46546
|
var inferBasePath2 = (appType) => {
|
|
46520
46547
|
if (typeof window === "undefined") return "";
|
|
46521
46548
|
const pathname = window.location?.pathname || "";
|