@didaoktv/didaoui-uniapp 1.3.0 → 1.3.2

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.
@@ -147,7 +147,7 @@ export default {
147
147
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
148
148
  font-size: 16px;
149
149
  line-height: 1.6;
150
- color: #333;
150
+ color: var(--dd-fg, #{$dd-fg});
151
151
  padding: 16px;
152
152
  word-wrap: break-word;
153
153
 
@@ -195,7 +195,7 @@ export default {
195
195
 
196
196
  /* 链接样式 */
197
197
  :deep(a) {
198
- color: #007AFF;
198
+ color: var(--dd-link, #{$dd-link});
199
199
  text-decoration: none;
200
200
 
201
201
  &:hover {
@@ -226,15 +226,15 @@ export default {
226
226
  :deep(blockquote) {
227
227
  margin: 8px 0;
228
228
  padding: 0 10px;
229
- border-left: 4px solid #ccc;
230
- color: #666;
229
+ border-left: 4px solid var(--dd-border-default, #{$dd-border-default});
230
+ color: var(--dd-text-secondary, #{$dd-text-secondary});
231
231
  }
232
232
 
233
233
  /* 代码样式 */
234
234
  :deep(&-code) {
235
235
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
236
236
  font-size: 14px;
237
- background-color: #f6f8fa;
237
+ background-color: var(--dd-surface-container, #{$dd-surface-container});
238
238
  padding: 3px 6px;
239
239
  border-radius: 3px;
240
240
  display: flex;
@@ -247,7 +247,7 @@ export default {
247
247
  :deep(pre) {
248
248
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
249
249
  font-size: 14px;
250
- background-color: #f6f8fa;
250
+ background-color: var(--dd-surface-container, #{$dd-surface-container});
251
251
  padding: 16px;
252
252
  overflow: auto;
253
253
  border-radius: 6px;
@@ -293,36 +293,12 @@ export default {
293
293
  height: 1px;
294
294
  padding: 0;
295
295
  margin: 24px 0;
296
- background-color: #e1e4e8;
296
+ background-color: var(--dd-rule, #{$dd-rule});
297
297
  border: 0;
298
298
  }
299
-
300
- /* 深色主题 */
301
- &.dark {
302
- color: #ccc;
303
- background-color: #1e1e1e;
304
-
305
- :deep(&-code) {
306
- background-color: #2d2d2d;
307
- color: #dcdcdc;
308
- }
309
-
310
- :deep(pre) {
311
- background-color: #2d2d2d;
312
- color: #dcdcdc;
313
- }
314
-
315
- :deep(blockquote) {
316
- margin: 8px 0;
317
- padding: 0 10px;
318
- border-left: 4px solid #ccc;
319
- color: #bbb;
320
- }
321
-
322
- :deep(a) {
323
- color: #4da6ff;
324
- }
325
- }
299
+ // ponytail: .dark 本地类已废弃——CSS 变量随全局 .light/.dark 自动翻转,
300
+ // 保留空块避免消费方 class="dark" 断裂,升级路径:下个大版本直接删
301
+ &.dark {}
326
302
  }
327
303
 
328
304
  /* 代码块行号样式 */
@@ -92,7 +92,7 @@ function onTouchMove() {
92
92
  .dd-overlay {
93
93
  position: fixed;
94
94
  inset: 0;
95
- background: rgba(0, 0, 0, 0.7);
95
+ background: var(--dd-color-overlay-strong, #{$dd-color-overlay-strong});
96
96
  display: flex;
97
97
  align-items: center;
98
98
  justify-content: center;
@@ -77,18 +77,25 @@ const config = {
77
77
  }
78
78
  const tagSelector = {}
79
79
  let windowWidth, system
80
- // #ifdef MP-WEIXIN
81
- if (uni.canIUse('getWindowInfo')) {
82
- windowWidth = uni.getWindowInfo().windowWidth
83
- system = uni.getDeviceInfo().system
84
- } else {
85
- // #endif
80
+ // ponytail: 不能在模块顶层调用 uni.*——H5 下组件库 ESM 求值早于 uni-h5 运行时挂载 window.uni,
81
+ // 会抛 "uni is not defined";改为首次使用时惰性初始化
82
+ function initSystemInfo () {
83
+ if (windowWidth !== undefined) {
84
+ return
85
+ }
86
+ // #ifdef MP-WEIXIN
87
+ if (uni.canIUse('getWindowInfo')) {
88
+ windowWidth = uni.getWindowInfo().windowWidth
89
+ system = uni.getDeviceInfo().system
90
+ return
91
+ }
92
+ // #endif
86
93
  const systemInfo = uni.getSystemInfoSync()
87
94
  windowWidth = systemInfo.windowWidth
88
95
  // #ifdef MP-WEIXIN
89
96
  system = systemInfo.system
97
+ // #endif
90
98
  }
91
- // #endif
92
99
  const blankChar = makeMap(' ,\r,\n,\t,\f')
93
100
  let idIndex = 0
94
101
 
@@ -310,6 +317,7 @@ Parser.prototype.parseStyle = function (node) {
310
317
  }
311
318
  } else if (value.includes('rpx')) {
312
319
  // 转换 rpx(rich-text 内部不支持 rpx)
320
+ initSystemInfo()
313
321
  value = value.replace(/[0-9.]+\s*rpx/g, $ => parseFloat($) * windowWidth / 750 + 'px')
314
322
  }
315
323
  styleObj[key] = value
@@ -556,6 +564,7 @@ Parser.prototype.onOpenTag = function (selfClose) {
556
564
  }
557
565
  // #endif
558
566
  // 设置的宽度超出屏幕,为避免变形,高度转为自动
567
+ initSystemInfo()
559
568
  if (parseInt(styleObj.width) > windowWidth) {
560
569
  styleObj.height = undefined
561
570
  }
@@ -790,6 +799,7 @@ Parser.prototype.popNode = function () {
790
799
 
791
800
  Object.assign(styleObj, this.parseStyle(node))
792
801
 
802
+ initSystemInfo()
793
803
  if (node.name !== 'table' && parseInt(styleObj.width) > windowWidth) {
794
804
  styleObj['max-width'] = '100%'
795
805
  styleObj['box-sizing'] = 'border-box'
@@ -1186,6 +1196,7 @@ Parser.prototype.onText = function (text) {
1186
1196
  node.text = decodeEntity(text)
1187
1197
  if (this.hook(node)) {
1188
1198
  // #ifdef MP-WEIXIN
1199
+ initSystemInfo()
1189
1200
  if (this.options.selectable === 'force' && system.includes('iOS') && !uni.canIUse('rich-text.user-select')) {
1190
1201
  this.expose()
1191
1202
  }
@@ -113,14 +113,15 @@ function onConfirm() {
113
113
  @import '../../scss/variables';
114
114
  @import '../../scss/mixins';
115
115
  :deep(.uni-picker-view-mask) {
116
- background-image: linear-gradient(180deg, hsl(0deg 0% 9% / 95%), hsl(0deg 0% 9% / 60%)), linear-gradient(0deg, hsl(0deg 0% 9% / 95%), hsl(0deg 0% 9% / 60%));
116
+ background-image: linear-gradient(180deg, var(--dd-surface-container, #{$dd-surface-container}), transparent 60%),
117
+ linear-gradient(0deg, var(--dd-surface-container, #{$dd-surface-container}), transparent 60%);
117
118
  }
118
119
  .dd-picker {
119
120
  &__mask {
120
121
  position: fixed;
121
122
  inset: 0;
122
123
  z-index: $dd-z-index-overlay;
123
- background: rgba(0, 0, 0, 0.7);
124
+ background: var(--dd-color-overlay-strong, #{$dd-color-overlay-strong});
124
125
  opacity: 0;
125
126
  pointer-events: none;
126
127
  @include dd-transition(opacity 0.3s);
@@ -121,7 +121,7 @@ function stepStatus(i: number): 'done' | 'current' | 'pending' {
121
121
  &__track {
122
122
  flex: 1;
123
123
  height: 12rpx;
124
- background: #2a2a2a;
124
+ background: var(--dd-surface-container-high, #{$dd-surface-container-high});
125
125
  border-radius: $dd-radius-full;
126
126
  overflow: hidden;
127
127
  position: relative;
@@ -207,7 +207,7 @@ function stepStatus(i: number): 'done' | 'current' | 'pending' {
207
207
  width: 24rpx;
208
208
  height: 24rpx;
209
209
  border-radius: 50%;
210
- background: #2a2a2a;
210
+ background: var(--dd-surface-container-high, #{$dd-surface-container-high});
211
211
  flex-shrink: 0;
212
212
  @include dd-transition(all 0.3s ease);
213
213
 
@@ -226,7 +226,7 @@ function stepStatus(i: number): 'done' | 'current' | 'pending' {
226
226
  flex: 1;
227
227
  height: $dd-space-1;
228
228
  margin: 0 $dd-space-1;
229
- background: #2a2a2a;
229
+ background: var(--dd-surface-container-high, #{$dd-surface-container-high});
230
230
  @include dd-transition(background 0.3s ease);
231
231
 
232
232
  &--done {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@didaoktv/didaoui-uniapp",
3
- "version": "1.3.0",
3
+ "version": "1.3.2",
4
4
  "description": "帝到KTV UniApp 组件库",
5
5
  "main": "index.ts",
6
6
  "types": "index.ts",