ph-utils 0.12.6 → 0.12.8
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/lib/dom.d.ts +9 -0
- package/lib/dom.js +4 -0
- package/lib/theme.js +3 -0
- package/package.json +1 -1
package/lib/dom.d.ts
CHANGED
@@ -33,6 +33,15 @@ export declare function create(tag: string, option?: {
|
|
33
33
|
outerHTML?: string;
|
34
34
|
[index: string]: any;
|
35
35
|
}, ctx?: DocumentContext): HTMLElement;
|
36
|
+
/** 创建节点 */
|
37
|
+
export declare function $$(tag: string, option?: {
|
38
|
+
class?: FormatClassParam;
|
39
|
+
style?: FormatStyleParam;
|
40
|
+
textContent?: string;
|
41
|
+
innerHTML?: string;
|
42
|
+
outerHTML?: string;
|
43
|
+
[index: string]: any;
|
44
|
+
}, ctx?: DocumentContext): HTMLElement;
|
36
45
|
/**
|
37
46
|
* 根据选择器获取匹配的第一个 DOM 元素。
|
38
47
|
* @param selector - 选择器字符串或直接的 HTMLElement。
|
package/lib/dom.js
CHANGED
@@ -67,6 +67,10 @@ export function create(tag, option = {}, ctx) {
|
|
67
67
|
}
|
68
68
|
return $el;
|
69
69
|
}
|
70
|
+
/** 创建节点 */
|
71
|
+
export function $$(tag, option = {}, ctx) {
|
72
|
+
return create(tag, option, ctx);
|
73
|
+
}
|
70
74
|
/**
|
71
75
|
* 根据选择器获取匹配的第一个 DOM 元素。
|
72
76
|
* @param selector - 选择器字符串或直接的 HTMLElement。
|
package/lib/theme.js
CHANGED
@@ -130,10 +130,13 @@ export function initColorTheme() {
|
|
130
130
|
export async function toggleColorTheme(color) {
|
131
131
|
const vars = [
|
132
132
|
`--nt-primary-color: ${color};`,
|
133
|
+
`--l-primary-color: ${color};`,
|
133
134
|
`--nt-primary-color-dark1: ${adjust(color, 1, false)};`,
|
135
|
+
`--l-primary-color-dark1: ${adjust(color, 1, false)};`,
|
134
136
|
];
|
135
137
|
for (let i = 1; i <= 5; i++) {
|
136
138
|
vars.push(`--nt-primary-color-light${i}: ${adjust(color, i)};`);
|
139
|
+
vars.push(`--l-primary-color-light${i}: ${adjust(color, i)};`);
|
137
140
|
}
|
138
141
|
let $style = document.getElementById("color-theme-style");
|
139
142
|
if ($style == null) {
|