@lingxiteam/theme-utils 0.5.2 → 0.5.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.
Files changed (127) hide show
  1. package/package.json +1 -1
  2. package/dist/config/Button.d.ts +0 -113
  3. package/dist/config/Button.js +0 -277
  4. package/dist/config/Card.d.ts +0 -144
  5. package/dist/config/Card.js +0 -162
  6. package/dist/config/Cascader.d.ts +0 -196
  7. package/dist/config/Cascader.js +0 -225
  8. package/dist/config/Checkbox.d.ts +0 -162
  9. package/dist/config/Checkbox.js +0 -178
  10. package/dist/config/CheckboxGroup.d.ts +0 -184
  11. package/dist/config/CheckboxGroup.js +0 -192
  12. package/dist/config/Collapse.d.ts +0 -186
  13. package/dist/config/Collapse.js +0 -330
  14. package/dist/config/Container.d.ts +0 -275
  15. package/dist/config/Container.js +0 -301
  16. package/dist/config/DatePicker.d.ts +0 -179
  17. package/dist/config/DatePicker.js +0 -179
  18. package/dist/config/Description.d.ts +0 -106
  19. package/dist/config/Description.js +0 -126
  20. package/dist/config/Divider.d.ts +0 -61
  21. package/dist/config/Divider.js +0 -61
  22. package/dist/config/Form.d.ts +0 -3071
  23. package/dist/config/Form.js +0 -1358
  24. package/dist/config/Icon.d.ts +0 -55
  25. package/dist/config/Icon.js +0 -55
  26. package/dist/config/Input.d.ts +0 -159
  27. package/dist/config/Input.js +0 -159
  28. package/dist/config/InputNumber.d.ts +0 -154
  29. package/dist/config/InputNumber.js +0 -154
  30. package/dist/config/Link.d.ts +0 -128
  31. package/dist/config/Link.js +0 -120
  32. package/dist/config/MultipleSelect.d.ts +0 -167
  33. package/dist/config/MultipleSelect.js +0 -175
  34. package/dist/config/Radio.d.ts +0 -239
  35. package/dist/config/Radio.js +0 -261
  36. package/dist/config/RangePicker.d.ts +0 -182
  37. package/dist/config/RangePicker.js +0 -182
  38. package/dist/config/Select.d.ts +0 -190
  39. package/dist/config/Select.js +0 -198
  40. package/dist/config/StdUpload.d.ts +0 -197
  41. package/dist/config/StdUpload.js +0 -211
  42. package/dist/config/Switch.d.ts +0 -141
  43. package/dist/config/Switch.js +0 -151
  44. package/dist/config/Table.d.ts +0 -482
  45. package/dist/config/Table.js +0 -560
  46. package/dist/config/Tabs.d.ts +0 -230
  47. package/dist/config/Tabs.js +0 -970
  48. package/dist/config/Tag.d.ts +0 -173
  49. package/dist/config/Tag.js +0 -548
  50. package/dist/config/Text.d.ts +0 -34
  51. package/dist/config/Text.js +0 -34
  52. package/dist/config/TextArea.d.ts +0 -151
  53. package/dist/config/TextArea.js +0 -151
  54. package/dist/config/TimePicker.d.ts +0 -180
  55. package/dist/config/TimePicker.js +0 -180
  56. package/dist/config/Tree.d.ts +0 -151
  57. package/dist/config/Tree.js +0 -195
  58. package/dist/config/TreeSelect.d.ts +0 -197
  59. package/dist/config/TreeSelect.js +0 -213
  60. package/dist/css.d.ts +0 -6
  61. package/dist/css.js +0 -126
  62. package/dist/demo.d.ts +0 -5
  63. package/dist/demo.js +0 -79
  64. package/dist/h5config/Accordion.d.ts +0 -410
  65. package/dist/h5config/Accordion.js +0 -548
  66. package/dist/h5config/Button.d.ts +0 -142
  67. package/dist/h5config/Button.js +0 -253
  68. package/dist/h5config/Card.d.ts +0 -275
  69. package/dist/h5config/Card.js +0 -535
  70. package/dist/h5config/DAddressPicker.d.ts +0 -188
  71. package/dist/h5config/DAddressPicker.js +0 -230
  72. package/dist/h5config/DCheckbox.d.ts +0 -202
  73. package/dist/h5config/DCheckbox.js +0 -248
  74. package/dist/h5config/DForm.d.ts +0 -1597
  75. package/dist/h5config/DForm.js +0 -932
  76. package/dist/h5config/DMultiplePicker.d.ts +0 -189
  77. package/dist/h5config/DMultiplePicker.js +0 -235
  78. package/dist/h5config/DformDate.d.ts +0 -191
  79. package/dist/h5config/DformDate.js +0 -233
  80. package/dist/h5config/DformFile.d.ts +0 -277
  81. package/dist/h5config/DformFile.js +0 -292
  82. package/dist/h5config/DformImagePicker.d.ts +0 -138
  83. package/dist/h5config/DformImagePicker.js +0 -156
  84. package/dist/h5config/DformInput.d.ts +0 -189
  85. package/dist/h5config/DformInput.js +0 -231
  86. package/dist/h5config/DformInputNumber.d.ts +0 -173
  87. package/dist/h5config/DformInputNumber.js +0 -215
  88. package/dist/h5config/DformPicker.d.ts +0 -190
  89. package/dist/h5config/DformPicker.js +0 -236
  90. package/dist/h5config/DformRadio.d.ts +0 -210
  91. package/dist/h5config/DformRadio.js +0 -256
  92. package/dist/h5config/DformRangePicker.d.ts +0 -195
  93. package/dist/h5config/DformRangePicker.js +0 -237
  94. package/dist/h5config/DformSelect.d.ts +0 -198
  95. package/dist/h5config/DformSelect.js +0 -262
  96. package/dist/h5config/DformSwitch.d.ts +0 -145
  97. package/dist/h5config/DformSwitch.js +0 -163
  98. package/dist/h5config/DformTextArea.d.ts +0 -184
  99. package/dist/h5config/DformTextArea.js +0 -226
  100. package/dist/h5config/Divider.d.ts +0 -53
  101. package/dist/h5config/Divider.js +0 -90
  102. package/dist/h5config/FilterItems.d.ts +0 -154
  103. package/dist/h5config/FilterItems.js +0 -204
  104. package/dist/h5config/Grid.d.ts +0 -235
  105. package/dist/h5config/Grid.js +0 -278
  106. package/dist/h5config/Icon.d.ts +0 -54
  107. package/dist/h5config/Icon.js +0 -54
  108. package/dist/h5config/Link.d.ts +0 -51
  109. package/dist/h5config/Link.js +0 -51
  110. package/dist/h5config/LoadMore.d.ts +0 -527
  111. package/dist/h5config/LoadMore.js +0 -940
  112. package/dist/h5config/NoticeBarPlus.d.ts +0 -111
  113. package/dist/h5config/NoticeBarPlus.js +0 -141
  114. package/dist/h5config/SearchView.d.ts +0 -135
  115. package/dist/h5config/SearchView.js +0 -177
  116. package/dist/h5config/StaticTabs.d.ts +0 -121
  117. package/dist/h5config/StaticTabs.js +0 -180
  118. package/dist/h5config/Table.d.ts +0 -197
  119. package/dist/h5config/Table.js +0 -589
  120. package/dist/index.d.ts +0 -4
  121. package/dist/index.js +0 -4
  122. package/dist/lx-mobile.d.ts +0 -23
  123. package/dist/lx-mobile.js +0 -174
  124. package/dist/lx.d.ts +0 -24
  125. package/dist/lx.js +0 -139
  126. package/dist/utils.d.ts +0 -12
  127. package/dist/utils.js +0 -67
@@ -1,197 +0,0 @@
1
- export declare const TreeSelect: {
2
- type: string;
3
- hasPrefixClass: boolean;
4
- variable: {
5
- labelTextColor: {
6
- type: string;
7
- label: string;
8
- groupsName: string;
9
- desc: string;
10
- canEdit: boolean;
11
- extendsKey: string;
12
- };
13
- labelFontSize: {
14
- type: string;
15
- label: string;
16
- groupsName: string;
17
- desc: string;
18
- canEdit: boolean;
19
- extendsKey: string;
20
- };
21
- labelLineHeight: {
22
- type: string;
23
- label: string;
24
- groupsName: string;
25
- desc: string;
26
- canEdit: boolean;
27
- extendsKey: string;
28
- };
29
- textColor: {
30
- type: string;
31
- label: string;
32
- groupsName: string;
33
- desc: string;
34
- canEdit: boolean;
35
- extendsKey: string;
36
- };
37
- fontSize: {
38
- type: string;
39
- label: string;
40
- groupsName: string;
41
- desc: string;
42
- canEdit: boolean;
43
- extendsKey: string;
44
- };
45
- itemBorderRadius: {
46
- type: string;
47
- label: string;
48
- groupsName: string;
49
- desc: string;
50
- canEdit: boolean;
51
- extendsKey: string;
52
- };
53
- itemBorderColor: {
54
- type: string;
55
- label: string;
56
- groupsName: string;
57
- desc: string;
58
- canEdit: boolean;
59
- extendsKey: string;
60
- };
61
- itemHoverBorderColor: {
62
- type: string;
63
- label: string;
64
- groupsName: string;
65
- hidden: boolean;
66
- desc: string;
67
- canEdit: boolean;
68
- extendsKey: string;
69
- };
70
- iconColor: {
71
- type: string;
72
- label: string;
73
- groupsName: string;
74
- };
75
- iconFontSize: {
76
- type: string;
77
- label: string;
78
- groupsName: string;
79
- desc: string;
80
- };
81
- iconTop: {
82
- type: string;
83
- label: string;
84
- groupsName: string;
85
- };
86
- };
87
- groupsName: string;
88
- icon: string;
89
- title: string;
90
- defaultValue: {
91
- iconFontSize: string;
92
- iconColor: string;
93
- iconTop: string;
94
- }[];
95
- tpl: string;
96
- components: {
97
- id: string;
98
- label: string;
99
- compName: string;
100
- type: string;
101
- compType: number;
102
- compLib: string;
103
- props: {
104
- name: string;
105
- colSpan: number;
106
- labelCol: number;
107
- wrapperCol: number;
108
- layout: string;
109
- colon: boolean;
110
- labelAlign: string;
111
- basicStatus: number;
112
- colSpace: number;
113
- rowSpace: number;
114
- formCode: string;
115
- };
116
- style: {
117
- padding: string;
118
- };
119
- isContainer: boolean;
120
- isBusiObjContainer: boolean;
121
- cmdgroup: string[];
122
- platform: string;
123
- icon: string;
124
- description: string;
125
- image: string;
126
- groupsName: string;
127
- engineApi: string[];
128
- setEvents: never[];
129
- isLabelDropBoxChild: boolean;
130
- components: {
131
- id: string;
132
- label: string;
133
- compName: string;
134
- type: string;
135
- compType: number;
136
- compLib: string;
137
- props: {
138
- name: string;
139
- filter: string;
140
- basicStatus: number;
141
- titleTip: string;
142
- tipSize: string;
143
- tipWidth: string;
144
- tipHeight: string;
145
- selfSpan: string;
146
- labelCol: number;
147
- wrapperCol: number;
148
- treeDefaultExpandAll: boolean;
149
- size: string;
150
- showSearch: boolean;
151
- treeNodeFilterProp: string;
152
- treeData: {
153
- title: string;
154
- key: string;
155
- $$isParent: boolean;
156
- selectable: boolean;
157
- children: ({
158
- title: string;
159
- key: string;
160
- selectable: boolean;
161
- children: never[];
162
- value: string;
163
- } | {
164
- title: string;
165
- key: string;
166
- selectable: boolean;
167
- value: string;
168
- children?: undefined;
169
- })[];
170
- value: string;
171
- }[];
172
- allowClear: boolean;
173
- formItemIndex: number;
174
- fieldName: string;
175
- };
176
- style: {};
177
- isContainer: boolean;
178
- isBusiObjContainer: boolean;
179
- cmdgroup: string[];
180
- platform: string;
181
- fieldProps: {
182
- trigger: string;
183
- valuePropName: string;
184
- };
185
- engineApi: string[];
186
- icon: string;
187
- description: string;
188
- image: string;
189
- groupsName: string;
190
- setEvents: never[];
191
- isLabelDropBoxChild: boolean;
192
- components: never[];
193
- path: string[];
194
- }[];
195
- path: string[];
196
- }[];
197
- };
@@ -1,213 +0,0 @@
1
- export var TreeSelect = {
2
- type: 'TreeSelect',
3
- hasPrefixClass: true,
4
- variable: {
5
- labelTextColor: {
6
- type: 'color',
7
- label: '标题颜色',
8
- groupsName: '标题',
9
- desc: '继承自表单,此处不可编辑',
10
- canEdit: false,
11
- extendsKey: 'Form'
12
- },
13
- labelFontSize: {
14
- type: 'px',
15
- label: '标题尺寸',
16
- groupsName: '标题',
17
- desc: '继承自表单,此处不可编辑',
18
- canEdit: false,
19
- extendsKey: 'Form'
20
- },
21
- labelLineHeight: {
22
- type: 'px',
23
- label: '标题行高',
24
- groupsName: '标题',
25
- desc: '继承自表单,此处不可编辑',
26
- canEdit: false,
27
- extendsKey: 'Form'
28
- },
29
- textColor: {
30
- type: 'color',
31
- label: '文本颜色',
32
- groupsName: '文字',
33
- desc: '继承自表单,此处不可编辑',
34
- canEdit: false,
35
- extendsKey: 'Form'
36
- },
37
- fontSize: {
38
- type: 'px',
39
- label: '文本尺寸',
40
- groupsName: '文字',
41
- desc: '继承自表单,此处不可编辑',
42
- canEdit: false,
43
- extendsKey: 'Form'
44
- },
45
- itemBorderRadius: {
46
- type: 'px',
47
- label: '圆角',
48
- groupsName: '边框',
49
- desc: '继承自表单,此处不可编辑',
50
- canEdit: false,
51
- extendsKey: 'Form'
52
- },
53
- itemBorderColor: {
54
- type: 'color',
55
- label: '颜色',
56
- groupsName: '边框',
57
- desc: '继承自表单,此处不可编辑',
58
- canEdit: false,
59
- extendsKey: 'Form'
60
- },
61
- itemHoverBorderColor: {
62
- type: 'color',
63
- label: '组件激活边框颜色',
64
- groupsName: '边框',
65
- hidden: true,
66
- desc: '继承自表单,此处不可编辑',
67
- canEdit: false,
68
- extendsKey: 'Form'
69
- },
70
- iconColor: {
71
- type: 'color',
72
- label: '后缀图标颜色',
73
- groupsName: '其他'
74
- },
75
- iconFontSize: {
76
- type: 'px',
77
- label: '后缀图标尺寸',
78
- groupsName: '其他',
79
- desc: '请根据实际【文本尺寸】调整,不宜与【文本尺寸】大小差异过大'
80
- },
81
- iconTop: {
82
- type: 'px',
83
- label: '后缀图标向下偏移',
84
- groupsName: '其他'
85
- }
86
- },
87
- groupsName: '数据录入',
88
- icon: 'icon-ico-comp-treeSelect',
89
- title: '树选择',
90
- defaultValue: [{
91
- iconFontSize: '12px',
92
- iconColor: 'rgba(28,36,46,.25)',
93
- iconTop: '16px'
94
- }],
95
- tpl: ".pcFactory-from-component{\n .ued-treeSelect-wrap {\n .pcfactory-select-arrow{\n color: iconColor;\n width: iconFontSize;\n height: iconFontSize;\n top: iconTop;\n .anticon>svg{\n width: iconFontSize;\n height: iconFontSize;\n }\n }\n .pcfactory-select-clear {\n color: iconColor;\n width: iconFontSize;\n height: iconFontSize;\n top: iconTop;\n .anticon>svg{\n width: iconFontSize;\n height: iconFontSize;\n }\n }\n }}",
96
- components: [{
97
- id: 'Form_180373',
98
- label: '表单',
99
- compName: 'Form',
100
- type: 'Form',
101
- compType: 0,
102
- compLib: 'comm',
103
- props: {
104
- name: '表单',
105
- colSpan: 12,
106
- labelCol: 8,
107
- wrapperCol: 16,
108
- layout: 'vertical',
109
- colon: true,
110
- labelAlign: 'right',
111
- basicStatus: 1,
112
- colSpace: 16,
113
- rowSpace: 16,
114
- formCode: 'Code_Form_180373'
115
- },
116
- style: {
117
- padding: '0px 0px 0px 0px'
118
- },
119
- isContainer: true,
120
- isBusiObjContainer: true,
121
- cmdgroup: ['basic'],
122
- platform: 'pc',
123
- icon: 'Form',
124
- description: '',
125
- image: '',
126
- groupsName: '容器',
127
- engineApi: ['service.downloadFileByFileCode', 'getVisible', 'stateListener'],
128
- setEvents: [],
129
- isLabelDropBoxChild: false,
130
- components: [{
131
- id: 'TreeSelect_357899',
132
- label: '树选择',
133
- compName: 'TreeSelect',
134
- type: 'TreeSelect',
135
- compType: 2,
136
- compLib: 'comm',
137
- props: {
138
- name: '树选择',
139
- filter: 'local',
140
- basicStatus: 1,
141
- titleTip: 'notext',
142
- tipSize: 'default',
143
- tipWidth: '240px',
144
- tipHeight: 'auto',
145
- selfSpan: '',
146
- labelCol: 8,
147
- wrapperCol: 16,
148
- treeDefaultExpandAll: true,
149
- size: 'default',
150
- showSearch: false,
151
- treeNodeFilterProp: 'title',
152
- treeData: [{
153
- title: '标题1',
154
- key: '982968',
155
- $$isParent: true,
156
- selectable: true,
157
- children: [{
158
- title: '副标题1',
159
- key: '223275',
160
- selectable: true,
161
- children: [],
162
- value: '223275'
163
- }, {
164
- title: '副标题2',
165
- key: '6154336',
166
- selectable: true,
167
- value: '6154336'
168
- }],
169
- value: '982968'
170
- }, {
171
- title: '标题2',
172
- key: '589191',
173
- $$isParent: true,
174
- selectable: true,
175
- children: [{
176
- title: '副标题21',
177
- key: '974854',
178
- selectable: true,
179
- value: '974854'
180
- }, {
181
- title: '副标题22',
182
- key: '555559',
183
- selectable: true,
184
- value: '555559'
185
- }],
186
- value: '589191'
187
- }],
188
- allowClear: true,
189
- formItemIndex: 0,
190
- fieldName: '32'
191
- },
192
- style: {},
193
- isContainer: false,
194
- isBusiObjContainer: false,
195
- cmdgroup: ['basic'],
196
- platform: 'pc',
197
- fieldProps: {
198
- trigger: 'onChange',
199
- valuePropName: 'value'
200
- },
201
- engineApi: ['service.commonFetch'],
202
- icon: 'TreeSelect',
203
- description: '',
204
- image: '',
205
- groupsName: '数据录入',
206
- setEvents: [],
207
- isLabelDropBoxChild: false,
208
- components: [],
209
- path: ['998509', 'Form_180373']
210
- }],
211
- path: ['998509']
212
- }]
213
- };
package/dist/css.d.ts DELETED
@@ -1,6 +0,0 @@
1
- export declare function stringifyCss(tpl: string, values: any): string;
2
- export declare function parseCss(tpl: string, a: string): any;
3
- export declare function normalizeCSS(css: string, selector?: string): string;
4
- export declare function prefixAnyCSS(css: string, prefix?: string, hasPrefix?: boolean): string;
5
- export declare function insertRules(id: string, rules: string, selector?: HTMLHeadElement): void;
6
- export declare function insertLink(id: string, href: string, insertBefore?: boolean): void;
package/dist/css.js DELETED
@@ -1,126 +0,0 @@
1
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
- function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
4
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
5
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
6
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
7
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
8
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
9
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
10
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
11
- import { compile, stringify, serialize } from 'stylis';
12
- export function stringifyCss(tpl, values) {
13
- if (!tpl) return '';
14
- var result = tpl;
15
-
16
- // eslint-disable-next-line guard-for-in
17
- for (var key in values) {
18
- var value = values[key];
19
- var regex = new RegExp("".concat(key, "\\b"), 'g');
20
- result = result.replace(regex, value);
21
- }
22
- return result;
23
- }
24
- export function parseCss(tpl, a) {
25
- if (!tpl) return {};
26
- var tplRegex = /\.(\w+)\s*{\s*(.*?)\s*}/g;
27
- var tplMatches = _toConsumableArray(tpl.matchAll(tplRegex));
28
- var aRegex = /\.(\w+)\s*{\s*(.*?)\s*}/g;
29
- var aMatches = _toConsumableArray(a.matchAll(aRegex));
30
- var result = {};
31
- // eslint-disable-next-line
32
- var _loop = function _loop() {
33
- var tplMatch = tplMatches[i];
34
- var tplSelector = tplMatch[1];
35
- var tplStyles = tplMatch[2].split(';').map(function (style) {
36
- return style.trim();
37
- }).filter(Boolean);
38
- var aMatch = aMatches.find(function (match) {
39
- return match[1] === tplSelector;
40
- });
41
- if (aMatch) {
42
- var aStyles = aMatch[2].split(';').map(function (style) {
43
- return style.trim();
44
- }).filter(Boolean);
45
- // eslint-disable-next-line
46
- var _loop2 = function _loop2() {
47
- var tplStyle = tplStyles[j];
48
- var _tplStyle$split$map = tplStyle.split(':').map(function (item) {
49
- return item.trim();
50
- }),
51
- _tplStyle$split$map2 = _slicedToArray(_tplStyle$split$map, 2),
52
- tplKey = _tplStyle$split$map2[0],
53
- tplValue = _tplStyle$split$map2[1];
54
- var aStyle = aStyles.find(function (style) {
55
- return style.startsWith(tplKey);
56
- });
57
- if (aStyle) {
58
- var _aStyle$split$map = aStyle.split(':').map(function (item) {
59
- return item.trim();
60
- }),
61
- _aStyle$split$map2 = _slicedToArray(_aStyle$split$map, 2),
62
- aValue = _aStyle$split$map2[1];
63
- result[tplValue] = aValue;
64
- }
65
- };
66
- for (var j = 0; j < tplStyles.length; j++) {
67
- _loop2();
68
- }
69
- }
70
- };
71
- for (var i = 0; i < tplMatches.length; i++) {
72
- _loop();
73
- }
74
- return result;
75
- }
76
- export function normalizeCSS(css, selector) {
77
- var mergeCss = css;
78
- if (selector) {
79
- var hasD = selector.startsWith('.') || selector.startsWith('#');
80
- mergeCss = "".concat(hasD ? '' : '.').concat(selector, " {").concat(css, "}");
81
- }
82
- var compiled = compile(mergeCss);
83
- return serialize(compiled, stringify);
84
- }
85
-
86
- // 这个解法不是特别好,但是组件有些是有嵌套的 div 有些是没有嵌套,所以给可用的 class 添加一个 &. 的样式前缀
87
- export function prefixAnyCSS(css, prefix, hasPrefix) {
88
- if (prefix) {
89
- var hasD = prefix.startsWith('.') || prefix.startsWith('#');
90
- var prefixCss = "".concat(hasD ? '' : '.').concat(prefix);
91
- if (hasPrefix) return "".concat(prefixCss).concat(css);
92
- return css.split('\n').map(function (i) {
93
- if (i.trimStart().startsWith('.')) {
94
- return "".concat(prefixCss).concat(i.trimStart());
95
- }
96
- return i;
97
- }).join('\n');
98
- }
99
- return css;
100
- }
101
- export function insertRules(id, rules) {
102
- var selector = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : document.head;
103
- var style = document.getElementById(id);
104
- if (!style) {
105
- style = document.createElement('style');
106
- style.id = id;
107
- (selector !== null && selector !== void 0 ? selector : document.head).appendChild(style);
108
- style.innerHTML = rules;
109
- } else {
110
- style.innerHTML = rules;
111
- }
112
- }
113
- export function insertLink(id, href) {
114
- var insertBefore = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
115
- if (document.getElementById(id)) return;
116
- var link = document.createElement('link');
117
- link.id = id;
118
- link.type = 'text/css';
119
- link.rel = 'stylesheet';
120
- link.href = href;
121
- if (insertBefore) {
122
- document.body.insertBefore(link, document.body.firstElementChild);
123
- } else {
124
- document.head.appendChild(link);
125
- }
126
- }
package/dist/demo.d.ts DELETED
@@ -1,5 +0,0 @@
1
- export declare const ASSETS_CSS_TPL: any;
2
- export declare const ASSETS_COMPONENT_LIST: unknown[];
3
- export declare function getItemByType(type: string): any;
4
- export declare function stringifyCssByType(type: string, values: any): string;
5
- export declare function parseCssByType(type: string, css: string): any;
package/dist/demo.js DELETED
@@ -1,79 +0,0 @@
1
- import { stringifyCss, parseCss } from "./css";
2
- import { objToListByGroupsName } from "./utils";
3
- export var ASSETS_CSS_TPL = {
4
- // 演示,并非真正的组件
5
- Root: {
6
- type: 'Root',
7
- variable: {
8
- backgroundColor: {
9
- type: 'color',
10
- label: '背景颜色',
11
- groupsName: '背景'
12
- },
13
- fontSize: {
14
- type: 'px',
15
- label: '文本字号',
16
- groupsName: '标签统一设置'
17
- },
18
- borderLeftWidth: {
19
- type: 'select',
20
- label: '边框圆角',
21
- groupsName: '组件统一设置',
22
- desc: '说明',
23
- options: ['2px', '3px', '5px']
24
- }
25
- },
26
- groupsName: '页面',
27
- icon: 'root',
28
- title: '根节点',
29
- defaultValue: [{
30
- backgroundColor: 'red',
31
- fontSize: '12px',
32
- borderLeftWidth: '2px'
33
- }, {
34
- backgroundColor: 'blue',
35
- fontSize: '14px',
36
- borderLeftWidth: '5px'
37
- }],
38
- tpl: '.engine-dynamicPage-view_box>div{ background-color: backgroundColor; font-size:fontSize; border-left-width:borderLeftWidth; }'
39
- },
40
- RootItem: {
41
- canEdit: false,
42
- extendsKey: 'Root',
43
- variable: {
44
- backgroundColor: {
45
- type: 'color',
46
- label: '背景颜色',
47
- groupsName: '背景'
48
- },
49
- fontSize: {
50
- type: 'px',
51
- label: '文本字号',
52
- groupsName: '标签统一设置'
53
- },
54
- borderLeftWidth: {
55
- type: 'select',
56
- label: '边框圆角',
57
- groupsName: '组件统一设置',
58
- options: ['2px', '3px', '5px']
59
- }
60
- },
61
- title: '子节点'
62
- }
63
- };
64
- export var ASSETS_COMPONENT_LIST = objToListByGroupsName(Object.values(ASSETS_CSS_TPL));
65
- export function getItemByType(type) {
66
- var com = ASSETS_CSS_TPL[type];
67
- if (!type || !com) return {
68
- tpl: ''
69
- };
70
- return com;
71
- }
72
- export function stringifyCssByType(type, values) {
73
- var item = getItemByType(type);
74
- return stringifyCss(item.tpl, values);
75
- }
76
- export function parseCssByType(type, css) {
77
- var item = getItemByType(type);
78
- return parseCss(item.tpl, css);
79
- }