@varlet/ui 3.5.4 → 3.6.0-alpha.1728498016952
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/es/action-sheet/style/index.mjs +1 -1
- package/es/code/Code.mjs +67 -0
- package/es/code/CodeSfc.css +0 -0
- package/es/code/code.css +1 -0
- package/es/code/index.mjs +12 -0
- package/es/code/props.mjs +16 -0
- package/es/code/style/index.mjs +3 -0
- package/es/highlighter-provider/HighlighterProvider.mjs +26 -0
- package/es/highlighter-provider/index.mjs +11 -0
- package/es/highlighter-provider/props.mjs +11 -0
- package/es/highlighter-provider/provide.mjs +17 -0
- package/es/highlighter-provider/style/index.mjs +0 -0
- package/es/index.bundle.mjs +13 -1
- package/es/index.mjs +11 -1
- package/es/snackbar/style/index.mjs +1 -1
- package/es/style.css +1 -1
- package/es/style.mjs +2 -0
- package/es/themes/dark/code.mjs +7 -0
- package/es/themes/dark/index.mjs +3 -2
- package/es/themes/md3-dark/code.mjs +7 -0
- package/es/themes/md3-dark/index.mjs +3 -2
- package/es/themes/md3-light/code.mjs +7 -0
- package/es/themes/md3-light/index.mjs +3 -2
- package/es/varlet.esm.js +4547 -4436
- package/highlight/web-types.en-US.json +74 -1
- package/highlight/web-types.zh-CN.json +74 -1
- package/lib/style.css +1 -1
- package/lib/varlet.cjs.js +1711 -1574
- package/package.json +13 -12
- package/types/code.d.ts +18 -0
- package/types/highlighterProvider.d.ts +26 -0
- package/types/index.d.ts +4 -0
- package/types/styleVars.d.ts +2 -0
- package/umd/varlet.js +8 -8
package/es/code/Code.mjs
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
var __async = (__this, __arguments, generator) => {
|
|
2
|
+
return new Promise((resolve, reject) => {
|
|
3
|
+
var fulfilled = (value) => {
|
|
4
|
+
try {
|
|
5
|
+
step(generator.next(value));
|
|
6
|
+
} catch (e) {
|
|
7
|
+
reject(e);
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
var rejected = (value) => {
|
|
11
|
+
try {
|
|
12
|
+
step(generator.throw(value));
|
|
13
|
+
} catch (e) {
|
|
14
|
+
reject(e);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
import { computed, defineComponent, ref, watch } from "vue";
|
|
22
|
+
import { createNamespace } from "../utils/components.mjs";
|
|
23
|
+
import { props } from "./props.mjs";
|
|
24
|
+
import { injectHighlighterProvider } from "../highlighter-provider/provide.mjs";
|
|
25
|
+
const { name, n, classes } = createNamespace("code");
|
|
26
|
+
import { normalizeClass as _normalizeClass, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
|
|
27
|
+
const _hoisted_1 = ["innerHTML"];
|
|
28
|
+
function __render__(_ctx, _cache) {
|
|
29
|
+
return _openBlock(), _createElementBlock("div", {
|
|
30
|
+
class: _normalizeClass(_ctx.classes(_ctx.n(), [_ctx.wordWrap, _ctx.n("--word-wrap")])),
|
|
31
|
+
innerHTML: _ctx.highlightedCode
|
|
32
|
+
}, null, 10, _hoisted_1);
|
|
33
|
+
}
|
|
34
|
+
const __sfc__ = defineComponent({
|
|
35
|
+
name,
|
|
36
|
+
props,
|
|
37
|
+
setup(props2) {
|
|
38
|
+
const { highlighter, theme } = injectHighlighterProvider();
|
|
39
|
+
const highlightedCode = ref("");
|
|
40
|
+
const normalizedTheme = computed(() => {
|
|
41
|
+
var _a;
|
|
42
|
+
return (_a = props2.theme) != null ? _a : theme == null ? void 0 : theme.value;
|
|
43
|
+
});
|
|
44
|
+
if (highlighter) {
|
|
45
|
+
watch(
|
|
46
|
+
() => [highlighter.value, props2.code, props2.language, normalizedTheme.value],
|
|
47
|
+
(_0) => __async(this, [_0], function* ([highlighter2, code, lang, theme2]) {
|
|
48
|
+
if (!highlighter2) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
highlightedCode.value = yield highlighter2.codeToHtml(code, { lang, theme: theme2 });
|
|
52
|
+
}),
|
|
53
|
+
{ immediate: true }
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
n,
|
|
58
|
+
classes,
|
|
59
|
+
highlightedCode
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
__sfc__.render = __render__;
|
|
64
|
+
var stdin_default = __sfc__;
|
|
65
|
+
export {
|
|
66
|
+
stdin_default as default
|
|
67
|
+
};
|
|
File without changes
|
package/es/code/code.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:root { --code-font-size: 14px; --code-line-height: 1.7;}.var-code { width: 100%; line-height: var(--code-line-height); font-size: var(--code-font-size);}.var-code pre { width: 100%; margin: 0; overflow: auto; background-color: transparent !important;}.var-code--word-wrap pre { white-space: pre-wrap; word-break: break-all;}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import Code from "./Code.mjs";
|
|
2
|
+
import { withInstall, withPropsDefaultsSetter } from "../utils/components.mjs";
|
|
3
|
+
import { props as codeProps } from "./props.mjs";
|
|
4
|
+
withInstall(Code);
|
|
5
|
+
withPropsDefaultsSetter(Code, codeProps);
|
|
6
|
+
const _CodeComponent = Code;
|
|
7
|
+
var stdin_default = Code;
|
|
8
|
+
export {
|
|
9
|
+
_CodeComponent,
|
|
10
|
+
codeProps,
|
|
11
|
+
stdin_default as default
|
|
12
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { computed, defineComponent, h } from "vue";
|
|
2
|
+
import { props } from "./props.mjs";
|
|
3
|
+
import { createNamespace } from "../utils/components.mjs";
|
|
4
|
+
import { call } from "@varlet/shared";
|
|
5
|
+
import { provideHighlighterProvider } from "./provide.mjs";
|
|
6
|
+
const { name, n } = createNamespace("highlighter-provider");
|
|
7
|
+
const __sfc__ = defineComponent({
|
|
8
|
+
name,
|
|
9
|
+
props,
|
|
10
|
+
setup(props2, { slots }) {
|
|
11
|
+
const highlighter = computed(() => props2.highlighter);
|
|
12
|
+
const theme = computed(() => props2.theme);
|
|
13
|
+
provideHighlighterProvider({ highlighter, theme });
|
|
14
|
+
return () => h(
|
|
15
|
+
props2.tag,
|
|
16
|
+
{
|
|
17
|
+
class: n()
|
|
18
|
+
},
|
|
19
|
+
call(slots.default)
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
var stdin_default = __sfc__;
|
|
24
|
+
export {
|
|
25
|
+
stdin_default as default
|
|
26
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import HighlighterProvider from "./HighlighterProvider.mjs";
|
|
2
|
+
import { withInstall, withPropsDefaultsSetter } from "../utils/components.mjs";
|
|
3
|
+
import { props as highlighterProviderProps } from "./props.mjs";
|
|
4
|
+
withInstall(HighlighterProvider);
|
|
5
|
+
withPropsDefaultsSetter(HighlighterProvider, highlighterProviderProps);
|
|
6
|
+
const _HighlighterProviderComponent = HighlighterProvider;
|
|
7
|
+
var stdin_default = HighlighterProvider;
|
|
8
|
+
export {
|
|
9
|
+
_HighlighterProviderComponent,
|
|
10
|
+
stdin_default as default
|
|
11
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { keyInProvides } from "@varlet/use";
|
|
2
|
+
import { inject, provide } from "vue";
|
|
3
|
+
const HIGHLIGHTER_PROVIDER_KEY = Symbol("HIGHLIGHTER_PROVIDER_KEY");
|
|
4
|
+
function provideHighlighterProvider(highlighterProvider) {
|
|
5
|
+
provide(HIGHLIGHTER_PROVIDER_KEY, highlighterProvider);
|
|
6
|
+
}
|
|
7
|
+
function injectHighlighterProvider() {
|
|
8
|
+
if (!keyInProvides(HIGHLIGHTER_PROVIDER_KEY)) {
|
|
9
|
+
return { highlighter: null, theme: null };
|
|
10
|
+
}
|
|
11
|
+
return inject(HIGHLIGHTER_PROVIDER_KEY);
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
HIGHLIGHTER_PROVIDER_KEY,
|
|
15
|
+
injectHighlighterProvider,
|
|
16
|
+
provideHighlighterProvider
|
|
17
|
+
};
|
|
File without changes
|
package/es/index.bundle.mjs
CHANGED
|
@@ -16,6 +16,7 @@ import Cell from './cell/index.mjs'
|
|
|
16
16
|
import Checkbox from './checkbox/index.mjs'
|
|
17
17
|
import CheckboxGroup from './checkbox-group/index.mjs'
|
|
18
18
|
import Chip from './chip/index.mjs'
|
|
19
|
+
import Code from './code/index.mjs'
|
|
19
20
|
import Col from './col/index.mjs'
|
|
20
21
|
import Collapse from './collapse/index.mjs'
|
|
21
22
|
import CollapseItem from './collapse-item/index.mjs'
|
|
@@ -33,6 +34,7 @@ import FieldDecorator from './field-decorator/index.mjs'
|
|
|
33
34
|
import FloatingPanel from './floating-panel/index.mjs'
|
|
34
35
|
import Form from './form/index.mjs'
|
|
35
36
|
import FormDetails from './form-details/index.mjs'
|
|
37
|
+
import HighlighterProvider from './highlighter-provider/index.mjs'
|
|
36
38
|
import Hover from './hover/index.mjs'
|
|
37
39
|
import HoverOverlay from './hover-overlay/index.mjs'
|
|
38
40
|
import Icon from './icon/index.mjs'
|
|
@@ -106,6 +108,7 @@ export * from './cell/index.mjs'
|
|
|
106
108
|
export * from './checkbox/index.mjs'
|
|
107
109
|
export * from './checkbox-group/index.mjs'
|
|
108
110
|
export * from './chip/index.mjs'
|
|
111
|
+
export * from './code/index.mjs'
|
|
109
112
|
export * from './col/index.mjs'
|
|
110
113
|
export * from './collapse/index.mjs'
|
|
111
114
|
export * from './collapse-item/index.mjs'
|
|
@@ -123,6 +126,7 @@ export * from './field-decorator/index.mjs'
|
|
|
123
126
|
export * from './floating-panel/index.mjs'
|
|
124
127
|
export * from './form/index.mjs'
|
|
125
128
|
export * from './form-details/index.mjs'
|
|
129
|
+
export * from './highlighter-provider/index.mjs'
|
|
126
130
|
export * from './hover/index.mjs'
|
|
127
131
|
export * from './hover-overlay/index.mjs'
|
|
128
132
|
export * from './icon/index.mjs'
|
|
@@ -196,6 +200,7 @@ import './cell/style/index.mjs'
|
|
|
196
200
|
import './checkbox/style/index.mjs'
|
|
197
201
|
import './checkbox-group/style/index.mjs'
|
|
198
202
|
import './chip/style/index.mjs'
|
|
203
|
+
import './code/style/index.mjs'
|
|
199
204
|
import './col/style/index.mjs'
|
|
200
205
|
import './collapse/style/index.mjs'
|
|
201
206
|
import './collapse-item/style/index.mjs'
|
|
@@ -213,6 +218,7 @@ import './field-decorator/style/index.mjs'
|
|
|
213
218
|
import './floating-panel/style/index.mjs'
|
|
214
219
|
import './form/style/index.mjs'
|
|
215
220
|
import './form-details/style/index.mjs'
|
|
221
|
+
import './highlighter-provider/style/index.mjs'
|
|
216
222
|
import './hover/style/index.mjs'
|
|
217
223
|
import './hover-overlay/style/index.mjs'
|
|
218
224
|
import './icon/style/index.mjs'
|
|
@@ -268,7 +274,7 @@ import './tooltip/style/index.mjs'
|
|
|
268
274
|
import './uploader/style/index.mjs'
|
|
269
275
|
import './watermark/style/index.mjs'
|
|
270
276
|
|
|
271
|
-
const version = '3.
|
|
277
|
+
const version = '3.6.0-alpha.1728498016952'
|
|
272
278
|
|
|
273
279
|
function install(app) {
|
|
274
280
|
ActionSheet.install && app.use(ActionSheet)
|
|
@@ -289,6 +295,7 @@ function install(app) {
|
|
|
289
295
|
Checkbox.install && app.use(Checkbox)
|
|
290
296
|
CheckboxGroup.install && app.use(CheckboxGroup)
|
|
291
297
|
Chip.install && app.use(Chip)
|
|
298
|
+
Code.install && app.use(Code)
|
|
292
299
|
Col.install && app.use(Col)
|
|
293
300
|
Collapse.install && app.use(Collapse)
|
|
294
301
|
CollapseItem.install && app.use(CollapseItem)
|
|
@@ -306,6 +313,7 @@ function install(app) {
|
|
|
306
313
|
FloatingPanel.install && app.use(FloatingPanel)
|
|
307
314
|
Form.install && app.use(Form)
|
|
308
315
|
FormDetails.install && app.use(FormDetails)
|
|
316
|
+
HighlighterProvider.install && app.use(HighlighterProvider)
|
|
309
317
|
Hover.install && app.use(Hover)
|
|
310
318
|
HoverOverlay.install && app.use(HoverOverlay)
|
|
311
319
|
Icon.install && app.use(Icon)
|
|
@@ -383,6 +391,7 @@ export {
|
|
|
383
391
|
Checkbox,
|
|
384
392
|
CheckboxGroup,
|
|
385
393
|
Chip,
|
|
394
|
+
Code,
|
|
386
395
|
Col,
|
|
387
396
|
Collapse,
|
|
388
397
|
CollapseItem,
|
|
@@ -400,6 +409,7 @@ export {
|
|
|
400
409
|
FloatingPanel,
|
|
401
410
|
Form,
|
|
402
411
|
FormDetails,
|
|
412
|
+
HighlighterProvider,
|
|
403
413
|
Hover,
|
|
404
414
|
HoverOverlay,
|
|
405
415
|
Icon,
|
|
@@ -477,6 +487,7 @@ export default {
|
|
|
477
487
|
Checkbox,
|
|
478
488
|
CheckboxGroup,
|
|
479
489
|
Chip,
|
|
490
|
+
Code,
|
|
480
491
|
Col,
|
|
481
492
|
Collapse,
|
|
482
493
|
CollapseItem,
|
|
@@ -494,6 +505,7 @@ export default {
|
|
|
494
505
|
FloatingPanel,
|
|
495
506
|
Form,
|
|
496
507
|
FormDetails,
|
|
508
|
+
HighlighterProvider,
|
|
497
509
|
Hover,
|
|
498
510
|
HoverOverlay,
|
|
499
511
|
Icon,
|
package/es/index.mjs
CHANGED
|
@@ -16,6 +16,7 @@ import Cell from './cell/index.mjs'
|
|
|
16
16
|
import Checkbox from './checkbox/index.mjs'
|
|
17
17
|
import CheckboxGroup from './checkbox-group/index.mjs'
|
|
18
18
|
import Chip from './chip/index.mjs'
|
|
19
|
+
import Code from './code/index.mjs'
|
|
19
20
|
import Col from './col/index.mjs'
|
|
20
21
|
import Collapse from './collapse/index.mjs'
|
|
21
22
|
import CollapseItem from './collapse-item/index.mjs'
|
|
@@ -33,6 +34,7 @@ import FieldDecorator from './field-decorator/index.mjs'
|
|
|
33
34
|
import FloatingPanel from './floating-panel/index.mjs'
|
|
34
35
|
import Form from './form/index.mjs'
|
|
35
36
|
import FormDetails from './form-details/index.mjs'
|
|
37
|
+
import HighlighterProvider from './highlighter-provider/index.mjs'
|
|
36
38
|
import Hover from './hover/index.mjs'
|
|
37
39
|
import HoverOverlay from './hover-overlay/index.mjs'
|
|
38
40
|
import Icon from './icon/index.mjs'
|
|
@@ -106,6 +108,7 @@ export * from './cell/index.mjs'
|
|
|
106
108
|
export * from './checkbox/index.mjs'
|
|
107
109
|
export * from './checkbox-group/index.mjs'
|
|
108
110
|
export * from './chip/index.mjs'
|
|
111
|
+
export * from './code/index.mjs'
|
|
109
112
|
export * from './col/index.mjs'
|
|
110
113
|
export * from './collapse/index.mjs'
|
|
111
114
|
export * from './collapse-item/index.mjs'
|
|
@@ -123,6 +126,7 @@ export * from './field-decorator/index.mjs'
|
|
|
123
126
|
export * from './floating-panel/index.mjs'
|
|
124
127
|
export * from './form/index.mjs'
|
|
125
128
|
export * from './form-details/index.mjs'
|
|
129
|
+
export * from './highlighter-provider/index.mjs'
|
|
126
130
|
export * from './hover/index.mjs'
|
|
127
131
|
export * from './hover-overlay/index.mjs'
|
|
128
132
|
export * from './icon/index.mjs'
|
|
@@ -178,7 +182,7 @@ export * from './tooltip/index.mjs'
|
|
|
178
182
|
export * from './uploader/index.mjs'
|
|
179
183
|
export * from './watermark/index.mjs'
|
|
180
184
|
|
|
181
|
-
const version = '3.
|
|
185
|
+
const version = '3.6.0-alpha.1728498016952'
|
|
182
186
|
|
|
183
187
|
function install(app) {
|
|
184
188
|
ActionSheet.install && app.use(ActionSheet)
|
|
@@ -199,6 +203,7 @@ function install(app) {
|
|
|
199
203
|
Checkbox.install && app.use(Checkbox)
|
|
200
204
|
CheckboxGroup.install && app.use(CheckboxGroup)
|
|
201
205
|
Chip.install && app.use(Chip)
|
|
206
|
+
Code.install && app.use(Code)
|
|
202
207
|
Col.install && app.use(Col)
|
|
203
208
|
Collapse.install && app.use(Collapse)
|
|
204
209
|
CollapseItem.install && app.use(CollapseItem)
|
|
@@ -216,6 +221,7 @@ function install(app) {
|
|
|
216
221
|
FloatingPanel.install && app.use(FloatingPanel)
|
|
217
222
|
Form.install && app.use(Form)
|
|
218
223
|
FormDetails.install && app.use(FormDetails)
|
|
224
|
+
HighlighterProvider.install && app.use(HighlighterProvider)
|
|
219
225
|
Hover.install && app.use(Hover)
|
|
220
226
|
HoverOverlay.install && app.use(HoverOverlay)
|
|
221
227
|
Icon.install && app.use(Icon)
|
|
@@ -293,6 +299,7 @@ export {
|
|
|
293
299
|
Checkbox,
|
|
294
300
|
CheckboxGroup,
|
|
295
301
|
Chip,
|
|
302
|
+
Code,
|
|
296
303
|
Col,
|
|
297
304
|
Collapse,
|
|
298
305
|
CollapseItem,
|
|
@@ -310,6 +317,7 @@ export {
|
|
|
310
317
|
FloatingPanel,
|
|
311
318
|
Form,
|
|
312
319
|
FormDetails,
|
|
320
|
+
HighlighterProvider,
|
|
313
321
|
Hover,
|
|
314
322
|
HoverOverlay,
|
|
315
323
|
Icon,
|
|
@@ -387,6 +395,7 @@ export default {
|
|
|
387
395
|
Checkbox,
|
|
388
396
|
CheckboxGroup,
|
|
389
397
|
Chip,
|
|
398
|
+
Code,
|
|
390
399
|
Col,
|
|
391
400
|
Collapse,
|
|
392
401
|
CollapseItem,
|
|
@@ -404,6 +413,7 @@ export default {
|
|
|
404
413
|
FloatingPanel,
|
|
405
414
|
Form,
|
|
406
415
|
FormDetails,
|
|
416
|
+
HighlighterProvider,
|
|
407
417
|
Hover,
|
|
408
418
|
HoverOverlay,
|
|
409
419
|
Icon,
|