@vunk/plus 1.3.14 → 1.4.1

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 (114) hide show
  1. package/components/WebGLRenderer.mjs +0 -1
  2. package/components/WebGPURenderer.mjs +0 -1
  3. package/components/agent-chat-provider/index.mjs +1 -5
  4. package/components/broadcasting-markdown/index.mjs +574 -1
  5. package/components/browserAll.mjs +0 -1
  6. package/components/index2.mjs +38 -17
  7. package/components/pixi-frame/index.mjs +0 -1
  8. package/components/sender/index.mjs +1 -1
  9. package/components/webworkerAll.mjs +0 -1
  10. package/package.json +1 -1
  11. package/components/agent-chat-provider/index.d.ts +0 -7
  12. package/components/agent-chat-provider/src/api.d.ts +0 -3
  13. package/components/agent-chat-provider/src/const-roles.d.ts +0 -8
  14. package/components/agent-chat-provider/src/const.d.ts +0 -1
  15. package/components/agent-chat-provider/src/index.vue.d.ts +0 -47
  16. package/components/agent-chat-provider/src/types.d.ts +0 -43
  17. package/components/agent-chat-provider/src/use.d.ts +0 -29
  18. package/components/avatar/index.d.ts +0 -4
  19. package/components/avatar/src/ctx.d.ts +0 -18
  20. package/components/avatar/src/index.vue.d.ts +0 -121
  21. package/components/avatar/src/types.d.ts +0 -1
  22. package/components/broadcasting-markdown/index.d.ts +0 -7
  23. package/components/broadcasting-markdown/src/const.d.ts +0 -13
  24. package/components/broadcasting-markdown/src/ctx.d.ts +0 -115
  25. package/components/broadcasting-markdown/src/howler-speech.vue.d.ts +0 -97
  26. package/components/broadcasting-markdown/src/index.vue.d.ts +0 -383
  27. package/components/broadcasting-markdown/src/paragraph.vue.d.ts +0 -79
  28. package/components/broadcasting-markdown/src/speech-error.vue.d.ts +0 -60
  29. package/components/broadcasting-markdown/src/types.d.ts +0 -25
  30. package/components/broadcasting-markdown/src/use.d.ts +0 -21
  31. package/components/browser.mjs +0 -575
  32. package/components/bubble-list/index.d.ts +0 -5
  33. package/components/bubble-list/src/ctx.d.ts +0 -30
  34. package/components/bubble-list/src/index.vue.d.ts +0 -867
  35. package/components/bubble-list/src/types.d.ts +0 -4
  36. package/components/bubble-templates/index.d.ts +0 -4
  37. package/components/bubble-templates/src/index.vue.d.ts +0 -539
  38. package/components/bubble-templates/src/types.d.ts +0 -40
  39. package/components/chat-independent/index.d.ts +0 -4
  40. package/components/chat-independent/src/const.d.ts +0 -13
  41. package/components/chat-independent/src/ctx.d.ts +0 -20
  42. package/components/chat-independent/src/index.vue.d.ts +0 -2343
  43. package/components/chat-independent/src/types.d.ts +0 -13
  44. package/components/index.d.ts +0 -0
  45. package/components/lottie-animation/index.d.ts +0 -4
  46. package/components/lottie-animation/src/ctx.d.ts +0 -10
  47. package/components/lottie-animation/src/index.vue.d.ts +0 -21
  48. package/components/lottie-animation/src/types.d.ts +0 -4
  49. package/components/monaco-editor/index.d.ts +0 -5
  50. package/components/monaco-editor/src/ctx.d.ts +0 -23
  51. package/components/monaco-editor/src/index.vue.d.ts +0 -40
  52. package/components/monaco-editor/src/types.d.ts +0 -1
  53. package/components/monaco-environment/index.d.ts +0 -4
  54. package/components/monaco-environment/src/ctx.d.ts +0 -8
  55. package/components/monaco-environment/src/index.vue.d.ts +0 -2
  56. package/components/monaco-environment/src/types.d.ts +0 -1
  57. package/components/pixi-frame/index.d.ts +0 -8
  58. package/components/pixi-frame/src/core.vue.d.ts +0 -127
  59. package/components/pixi-frame/src/ctx.d.ts +0 -41
  60. package/components/pixi-frame/src/index.vue.d.ts +0 -222
  61. package/components/pixi-frame/src/provider.vue.d.ts +0 -2
  62. package/components/pixi-frame/src/types.d.ts +0 -1
  63. package/components/pixi-frame/src/use.d.ts +0 -3
  64. package/components/pixi-frame/src/view.vue.d.ts +0 -25
  65. package/components/recorder-button/index.d.ts +0 -4
  66. package/components/recorder-button/src/ctx.d.ts +0 -41
  67. package/components/recorder-button/src/index.vue.d.ts +0 -300
  68. package/components/recorder-button/src/speech-to-text.d.ts +0 -1
  69. package/components/recorder-button/src/types.d.ts +0 -7
  70. package/components/routes-menu-content/index.d.ts +0 -4
  71. package/components/routes-menu-content/src/ctx.d.ts +0 -17
  72. package/components/routes-menu-content/src/index.vue.d.ts +0 -472
  73. package/components/routes-menu-content/src/item/core/ctx.d.ts +0 -18
  74. package/components/routes-menu-content/src/item/core/index.vue.d.ts +0 -307
  75. package/components/routes-menu-content/src/item/ctx.d.ts +0 -14
  76. package/components/routes-menu-content/src/item/index.vue.d.ts +0 -438
  77. package/components/routes-menu-content/src/types.d.ts +0 -1
  78. package/components/sender/index.d.ts +0 -4
  79. package/components/sender/src/SenderHeader.vue.d.ts +0 -256
  80. package/components/sender/src/ctx.d.ts +0 -62
  81. package/components/sender/src/index.vue.d.ts +0 -787
  82. package/components/sender/src/types.d.ts +0 -1
  83. package/components/speech-button/index.d.ts +0 -4
  84. package/components/speech-button/src/LoadingIcon.vue.d.ts +0 -2
  85. package/components/speech-button/src/RecordingIcon.vue.d.ts +0 -2
  86. package/components/speech-button/src/ctx.d.ts +0 -10
  87. package/components/speech-button/src/index.vue.d.ts +0 -22
  88. package/components/speech-button/src/types.d.ts +0 -1
  89. package/components/table-columns/index.d.ts +0 -5
  90. package/components/table-columns/src/ctx.d.ts +0 -66
  91. package/components/table-columns/src/el-ctx.d.ts +0 -63
  92. package/components/table-columns/src/index.vue.d.ts +0 -282
  93. package/components/table-columns/src/types.d.ts +0 -21
  94. package/components/tables-v1/index.d.ts +0 -5
  95. package/components/tables-v1/src/ctx.d.ts +0 -281
  96. package/components/tables-v1/src/el-ctx.d.ts +0 -269
  97. package/components/tables-v1/src/index.vue.d.ts +0 -3014
  98. package/components/tables-v1/src/types.d.ts +0 -4
  99. package/components/tables-v1-checkbox/index.d.ts +0 -5
  100. package/components/tables-v1-checkbox/src/ctx.d.ts +0 -321
  101. package/components/tables-v1-checkbox/src/index.vue.d.ts +0 -3796
  102. package/components/tables-v1-checkbox/src/types.d.ts +0 -1
  103. package/components/typing-markdown/index.d.ts +0 -4
  104. package/components/typing-markdown/src/core.d.ts +0 -2
  105. package/components/typing-markdown/src/ctx.d.ts +0 -33
  106. package/components/typing-markdown/src/index.vue.d.ts +0 -57
  107. package/components/typing-markdown/src/types.d.ts +0 -1
  108. package/components/vditor/index.d.ts +0 -5
  109. package/components/vditor/src/ctx.d.ts +0 -37
  110. package/components/vditor/src/handle-fullscreen.vue.d.ts +0 -18
  111. package/components/vditor/src/handle-value.vue.d.ts +0 -18
  112. package/components/vditor/src/index.vue.d.ts +0 -144
  113. package/components/vditor/src/types.d.ts +0 -9
  114. package/components/vditor/src/use.d.ts +0 -4
@@ -4,7 +4,6 @@ import { e as ensureAttributes, G as GpuStencilModesToPixi, c as createUboSyncFu
4
4
  import 'vue';
5
5
  import '@vunk/shared/enum';
6
6
  import '@vunk/shared/promise';
7
- import './browser.mjs';
8
7
  import './_commonjsHelpers.mjs';
9
8
  import './_plugin-vue_export-helper.mjs';
10
9
 
@@ -4,7 +4,6 @@ import { c as createUboSyncFunction, u as uboSyncFunctionsWGSL, U as UboSystem,
4
4
  import 'vue';
5
5
  import '@vunk/shared/enum';
6
6
  import '@vunk/shared/promise';
7
- import './browser.mjs';
8
7
  import './_commonjsHelpers.mjs';
9
8
  import './_plugin-vue_export-helper.mjs';
10
9
 
@@ -1,7 +1,6 @@
1
1
  import { computed, provide, inject, defineComponent } from 'vue';
2
2
  import { restFetch } from '@vunk/shared/fetch';
3
3
  import { useXChat, useXAgent } from 'ant-design-x-vue';
4
- import { c as consola } from '../browser.mjs';
5
4
 
6
5
  async function agentRequest(onmessage, data) {
7
6
  return restFetch.reader({
@@ -70,10 +69,7 @@ function initAgentChat(request, parser) {
70
69
  });
71
70
  };
72
71
  const items = computed(() => {
73
- return chat.parsedMessages.value.map((item, index) => {
74
- if (index === chat.parsedMessages.value.length - 1) {
75
- consola.info("parsedMessages", item.message);
76
- }
72
+ return chat.parsedMessages.value.map((item) => {
77
73
  return {
78
74
  key: item.id,
79
75
  ...roleMap[item.message.role],
@@ -7,7 +7,6 @@ import { noop } from '@vunk/shared/function';
7
7
  import { ElIcon } from 'element-plus';
8
8
  import { c as commonjsGlobal } from '../_commonjsHelpers.mjs';
9
9
  import { Deferred } from '@vunk/shared/promise';
10
- import { c as consola } from '../browser.mjs';
11
10
  import { _ as _export_sfc } from '../_plugin-vue_export-helper.mjs';
12
11
 
13
12
  function markdownToPlainText(md) {
@@ -3547,6 +3546,580 @@ var _sfc_main$2 = /* @__PURE__ */ defineComponent({
3547
3546
  }
3548
3547
  });
3549
3548
 
3549
+ const LogLevels = {
3550
+ fatal: 0,
3551
+ error: 0,
3552
+ warn: 1,
3553
+ log: 2,
3554
+ info: 3,
3555
+ success: 3,
3556
+ fail: 3,
3557
+ debug: 4,
3558
+ trace: 5,
3559
+ verbose: Number.POSITIVE_INFINITY
3560
+ };
3561
+ const LogTypes = {
3562
+ // Silent
3563
+ silent: {
3564
+ level: -1
3565
+ },
3566
+ // Level 0
3567
+ fatal: {
3568
+ level: LogLevels.fatal
3569
+ },
3570
+ error: {
3571
+ level: LogLevels.error
3572
+ },
3573
+ // Level 1
3574
+ warn: {
3575
+ level: LogLevels.warn
3576
+ },
3577
+ // Level 2
3578
+ log: {
3579
+ level: LogLevels.log
3580
+ },
3581
+ // Level 3
3582
+ info: {
3583
+ level: LogLevels.info
3584
+ },
3585
+ success: {
3586
+ level: LogLevels.success
3587
+ },
3588
+ fail: {
3589
+ level: LogLevels.fail
3590
+ },
3591
+ ready: {
3592
+ level: LogLevels.info
3593
+ },
3594
+ start: {
3595
+ level: LogLevels.info
3596
+ },
3597
+ box: {
3598
+ level: LogLevels.info
3599
+ },
3600
+ // Level 4
3601
+ debug: {
3602
+ level: LogLevels.debug
3603
+ },
3604
+ // Level 5
3605
+ trace: {
3606
+ level: LogLevels.trace
3607
+ },
3608
+ // Verbose
3609
+ verbose: {
3610
+ level: LogLevels.verbose
3611
+ }
3612
+ };
3613
+
3614
+ function isPlainObject$1(value) {
3615
+ if (value === null || typeof value !== "object") {
3616
+ return false;
3617
+ }
3618
+ const prototype = Object.getPrototypeOf(value);
3619
+ if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
3620
+ return false;
3621
+ }
3622
+ if (Symbol.iterator in value) {
3623
+ return false;
3624
+ }
3625
+ if (Symbol.toStringTag in value) {
3626
+ return Object.prototype.toString.call(value) === "[object Module]";
3627
+ }
3628
+ return true;
3629
+ }
3630
+
3631
+ function _defu(baseObject, defaults, namespace = ".", merger) {
3632
+ if (!isPlainObject$1(defaults)) {
3633
+ return _defu(baseObject, {}, namespace);
3634
+ }
3635
+ const object = Object.assign({}, defaults);
3636
+ for (const key in baseObject) {
3637
+ if (key === "__proto__" || key === "constructor") {
3638
+ continue;
3639
+ }
3640
+ const value = baseObject[key];
3641
+ if (value === null || value === void 0) {
3642
+ continue;
3643
+ }
3644
+ if (Array.isArray(value) && Array.isArray(object[key])) {
3645
+ object[key] = [...value, ...object[key]];
3646
+ } else if (isPlainObject$1(value) && isPlainObject$1(object[key])) {
3647
+ object[key] = _defu(
3648
+ value,
3649
+ object[key],
3650
+ (namespace ? `${namespace}.` : "") + key.toString());
3651
+ } else {
3652
+ object[key] = value;
3653
+ }
3654
+ }
3655
+ return object;
3656
+ }
3657
+ function createDefu(merger) {
3658
+ return (...arguments_) => (
3659
+ // eslint-disable-next-line unicorn/no-array-reduce
3660
+ arguments_.reduce((p, c) => _defu(p, c, ""), {})
3661
+ );
3662
+ }
3663
+ const defu = createDefu();
3664
+
3665
+ function isPlainObject(obj) {
3666
+ return Object.prototype.toString.call(obj) === "[object Object]";
3667
+ }
3668
+ function isLogObj(arg) {
3669
+ if (!isPlainObject(arg)) {
3670
+ return false;
3671
+ }
3672
+ if (!arg.message && !arg.args) {
3673
+ return false;
3674
+ }
3675
+ if (arg.stack) {
3676
+ return false;
3677
+ }
3678
+ return true;
3679
+ }
3680
+
3681
+ let paused = false;
3682
+ const queue = [];
3683
+ class Consola {
3684
+ options;
3685
+ _lastLog;
3686
+ _mockFn;
3687
+ /**
3688
+ * Creates an instance of Consola with specified options or defaults.
3689
+ *
3690
+ * @param {Partial<ConsolaOptions>} [options={}] - Configuration options for the Consola instance.
3691
+ */
3692
+ constructor(options = {}) {
3693
+ const types = options.types || LogTypes;
3694
+ this.options = defu(
3695
+ {
3696
+ ...options,
3697
+ defaults: { ...options.defaults },
3698
+ level: _normalizeLogLevel(options.level, types),
3699
+ reporters: [...options.reporters || []]
3700
+ },
3701
+ {
3702
+ types: LogTypes,
3703
+ throttle: 1e3,
3704
+ throttleMin: 5,
3705
+ formatOptions: {
3706
+ date: true,
3707
+ colors: false,
3708
+ compact: true
3709
+ }
3710
+ }
3711
+ );
3712
+ for (const type in types) {
3713
+ const defaults = {
3714
+ type,
3715
+ ...this.options.defaults,
3716
+ ...types[type]
3717
+ };
3718
+ this[type] = this._wrapLogFn(defaults);
3719
+ this[type].raw = this._wrapLogFn(
3720
+ defaults,
3721
+ true
3722
+ );
3723
+ }
3724
+ if (this.options.mockFn) {
3725
+ this.mockTypes();
3726
+ }
3727
+ this._lastLog = {};
3728
+ }
3729
+ /**
3730
+ * Gets the current log level of the Consola instance.
3731
+ *
3732
+ * @returns {number} The current log level.
3733
+ */
3734
+ get level() {
3735
+ return this.options.level;
3736
+ }
3737
+ /**
3738
+ * Sets the minimum log level that will be output by the instance.
3739
+ *
3740
+ * @param {number} level - The new log level to set.
3741
+ */
3742
+ set level(level) {
3743
+ this.options.level = _normalizeLogLevel(
3744
+ level,
3745
+ this.options.types,
3746
+ this.options.level
3747
+ );
3748
+ }
3749
+ /**
3750
+ * Displays a prompt to the user and returns the response.
3751
+ * Throw an error if `prompt` is not supported by the current configuration.
3752
+ *
3753
+ * @template T
3754
+ * @param {string} message - The message to display in the prompt.
3755
+ * @param {T} [opts] - Optional options for the prompt. See {@link PromptOptions}.
3756
+ * @returns {promise<T>} A promise that infer with the prompt options. See {@link PromptOptions}.
3757
+ */
3758
+ prompt(message, opts) {
3759
+ if (!this.options.prompt) {
3760
+ throw new Error("prompt is not supported!");
3761
+ }
3762
+ return this.options.prompt(message, opts);
3763
+ }
3764
+ /**
3765
+ * Creates a new instance of Consola, inheriting options from the current instance, with possible overrides.
3766
+ *
3767
+ * @param {Partial<ConsolaOptions>} options - Optional overrides for the new instance. See {@link ConsolaOptions}.
3768
+ * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
3769
+ */
3770
+ create(options) {
3771
+ const instance = new Consola({
3772
+ ...this.options,
3773
+ ...options
3774
+ });
3775
+ if (this._mockFn) {
3776
+ instance.mockTypes(this._mockFn);
3777
+ }
3778
+ return instance;
3779
+ }
3780
+ /**
3781
+ * Creates a new Consola instance with the specified default log object properties.
3782
+ *
3783
+ * @param {InputLogObject} defaults - Default properties to include in any log from the new instance. See {@link InputLogObject}.
3784
+ * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
3785
+ */
3786
+ withDefaults(defaults) {
3787
+ return this.create({
3788
+ ...this.options,
3789
+ defaults: {
3790
+ ...this.options.defaults,
3791
+ ...defaults
3792
+ }
3793
+ });
3794
+ }
3795
+ /**
3796
+ * Creates a new Consola instance with a specified tag, which will be included in every log.
3797
+ *
3798
+ * @param {string} tag - The tag to include in each log of the new instance.
3799
+ * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
3800
+ */
3801
+ withTag(tag) {
3802
+ return this.withDefaults({
3803
+ tag: this.options.defaults.tag ? this.options.defaults.tag + ":" + tag : tag
3804
+ });
3805
+ }
3806
+ /**
3807
+ * Adds a custom reporter to the Consola instance.
3808
+ * Reporters will be called for each log message, depending on their implementation and log level.
3809
+ *
3810
+ * @param {ConsolaReporter} reporter - The reporter to add. See {@link ConsolaReporter}.
3811
+ * @returns {Consola} The current Consola instance.
3812
+ */
3813
+ addReporter(reporter) {
3814
+ this.options.reporters.push(reporter);
3815
+ return this;
3816
+ }
3817
+ /**
3818
+ * Removes a custom reporter from the Consola instance.
3819
+ * If no reporter is specified, all reporters will be removed.
3820
+ *
3821
+ * @param {ConsolaReporter} reporter - The reporter to remove. See {@link ConsolaReporter}.
3822
+ * @returns {Consola} The current Consola instance.
3823
+ */
3824
+ removeReporter(reporter) {
3825
+ if (reporter) {
3826
+ const i = this.options.reporters.indexOf(reporter);
3827
+ if (i !== -1) {
3828
+ return this.options.reporters.splice(i, 1);
3829
+ }
3830
+ } else {
3831
+ this.options.reporters.splice(0);
3832
+ }
3833
+ return this;
3834
+ }
3835
+ /**
3836
+ * Replaces all reporters of the Consola instance with the specified array of reporters.
3837
+ *
3838
+ * @param {ConsolaReporter[]} reporters - The new reporters to set. See {@link ConsolaReporter}.
3839
+ * @returns {Consola} The current Consola instance.
3840
+ */
3841
+ setReporters(reporters) {
3842
+ this.options.reporters = Array.isArray(reporters) ? reporters : [reporters];
3843
+ return this;
3844
+ }
3845
+ wrapAll() {
3846
+ this.wrapConsole();
3847
+ this.wrapStd();
3848
+ }
3849
+ restoreAll() {
3850
+ this.restoreConsole();
3851
+ this.restoreStd();
3852
+ }
3853
+ /**
3854
+ * Overrides console methods with Consola logging methods for consistent logging.
3855
+ */
3856
+ wrapConsole() {
3857
+ for (const type in this.options.types) {
3858
+ if (!console["__" + type]) {
3859
+ console["__" + type] = console[type];
3860
+ }
3861
+ console[type] = this[type].raw;
3862
+ }
3863
+ }
3864
+ /**
3865
+ * Restores the original console methods, removing Consola overrides.
3866
+ */
3867
+ restoreConsole() {
3868
+ for (const type in this.options.types) {
3869
+ if (console["__" + type]) {
3870
+ console[type] = console["__" + type];
3871
+ delete console["__" + type];
3872
+ }
3873
+ }
3874
+ }
3875
+ /**
3876
+ * Overrides standard output and error streams to redirect them through Consola.
3877
+ */
3878
+ wrapStd() {
3879
+ this._wrapStream(this.options.stdout, "log");
3880
+ this._wrapStream(this.options.stderr, "log");
3881
+ }
3882
+ _wrapStream(stream, type) {
3883
+ if (!stream) {
3884
+ return;
3885
+ }
3886
+ if (!stream.__write) {
3887
+ stream.__write = stream.write;
3888
+ }
3889
+ stream.write = (data) => {
3890
+ this[type].raw(String(data).trim());
3891
+ };
3892
+ }
3893
+ /**
3894
+ * Restores the original standard output and error streams, removing the Consola redirection.
3895
+ */
3896
+ restoreStd() {
3897
+ this._restoreStream(this.options.stdout);
3898
+ this._restoreStream(this.options.stderr);
3899
+ }
3900
+ _restoreStream(stream) {
3901
+ if (!stream) {
3902
+ return;
3903
+ }
3904
+ if (stream.__write) {
3905
+ stream.write = stream.__write;
3906
+ delete stream.__write;
3907
+ }
3908
+ }
3909
+ /**
3910
+ * Pauses logging, queues incoming logs until resumed.
3911
+ */
3912
+ pauseLogs() {
3913
+ paused = true;
3914
+ }
3915
+ /**
3916
+ * Resumes logging, processing any queued logs.
3917
+ */
3918
+ resumeLogs() {
3919
+ paused = false;
3920
+ const _queue = queue.splice(0);
3921
+ for (const item of _queue) {
3922
+ item[0]._logFn(item[1], item[2]);
3923
+ }
3924
+ }
3925
+ /**
3926
+ * Replaces logging methods with mocks if a mock function is provided.
3927
+ *
3928
+ * @param {ConsolaOptions["mockFn"]} mockFn - The function to use for mocking logging methods. See {@link ConsolaOptions["mockFn"]}.
3929
+ */
3930
+ mockTypes(mockFn) {
3931
+ const _mockFn = mockFn || this.options.mockFn;
3932
+ this._mockFn = _mockFn;
3933
+ if (typeof _mockFn !== "function") {
3934
+ return;
3935
+ }
3936
+ for (const type in this.options.types) {
3937
+ this[type] = _mockFn(type, this.options.types[type]) || this[type];
3938
+ this[type].raw = this[type];
3939
+ }
3940
+ }
3941
+ _wrapLogFn(defaults, isRaw) {
3942
+ return (...args) => {
3943
+ if (paused) {
3944
+ queue.push([this, defaults, args, isRaw]);
3945
+ return;
3946
+ }
3947
+ return this._logFn(defaults, args, isRaw);
3948
+ };
3949
+ }
3950
+ _logFn(defaults, args, isRaw) {
3951
+ if ((defaults.level || 0) > this.level) {
3952
+ return false;
3953
+ }
3954
+ const logObj = {
3955
+ date: /* @__PURE__ */ new Date(),
3956
+ args: [],
3957
+ ...defaults,
3958
+ level: _normalizeLogLevel(defaults.level, this.options.types)
3959
+ };
3960
+ if (!isRaw && args.length === 1 && isLogObj(args[0])) {
3961
+ Object.assign(logObj, args[0]);
3962
+ } else {
3963
+ logObj.args = [...args];
3964
+ }
3965
+ if (logObj.message) {
3966
+ logObj.args.unshift(logObj.message);
3967
+ delete logObj.message;
3968
+ }
3969
+ if (logObj.additional) {
3970
+ if (!Array.isArray(logObj.additional)) {
3971
+ logObj.additional = logObj.additional.split("\n");
3972
+ }
3973
+ logObj.args.push("\n" + logObj.additional.join("\n"));
3974
+ delete logObj.additional;
3975
+ }
3976
+ logObj.type = typeof logObj.type === "string" ? logObj.type.toLowerCase() : "log";
3977
+ logObj.tag = typeof logObj.tag === "string" ? logObj.tag : "";
3978
+ const resolveLog = (newLog = false) => {
3979
+ const repeated = (this._lastLog.count || 0) - this.options.throttleMin;
3980
+ if (this._lastLog.object && repeated > 0) {
3981
+ const args2 = [...this._lastLog.object.args];
3982
+ if (repeated > 1) {
3983
+ args2.push(`(repeated ${repeated} times)`);
3984
+ }
3985
+ this._log({ ...this._lastLog.object, args: args2 });
3986
+ this._lastLog.count = 1;
3987
+ }
3988
+ if (newLog) {
3989
+ this._lastLog.object = logObj;
3990
+ this._log(logObj);
3991
+ }
3992
+ };
3993
+ clearTimeout(this._lastLog.timeout);
3994
+ const diffTime = this._lastLog.time && logObj.date ? logObj.date.getTime() - this._lastLog.time.getTime() : 0;
3995
+ this._lastLog.time = logObj.date;
3996
+ if (diffTime < this.options.throttle) {
3997
+ try {
3998
+ const serializedLog = JSON.stringify([
3999
+ logObj.type,
4000
+ logObj.tag,
4001
+ logObj.args
4002
+ ]);
4003
+ const isSameLog = this._lastLog.serialized === serializedLog;
4004
+ this._lastLog.serialized = serializedLog;
4005
+ if (isSameLog) {
4006
+ this._lastLog.count = (this._lastLog.count || 0) + 1;
4007
+ if (this._lastLog.count > this.options.throttleMin) {
4008
+ this._lastLog.timeout = setTimeout(
4009
+ resolveLog,
4010
+ this.options.throttle
4011
+ );
4012
+ return;
4013
+ }
4014
+ }
4015
+ } catch {
4016
+ }
4017
+ }
4018
+ resolveLog(true);
4019
+ }
4020
+ _log(logObj) {
4021
+ for (const reporter of this.options.reporters) {
4022
+ reporter.log(logObj, {
4023
+ options: this.options
4024
+ });
4025
+ }
4026
+ }
4027
+ }
4028
+ function _normalizeLogLevel(input, types = {}, defaultLevel = 3) {
4029
+ if (input === void 0) {
4030
+ return defaultLevel;
4031
+ }
4032
+ if (typeof input === "number") {
4033
+ return input;
4034
+ }
4035
+ if (types[input] && types[input].level !== void 0) {
4036
+ return types[input].level;
4037
+ }
4038
+ return defaultLevel;
4039
+ }
4040
+ Consola.prototype.add = Consola.prototype.addReporter;
4041
+ Consola.prototype.remove = Consola.prototype.removeReporter;
4042
+ Consola.prototype.clear = Consola.prototype.removeReporter;
4043
+ Consola.prototype.withScope = Consola.prototype.withTag;
4044
+ Consola.prototype.mock = Consola.prototype.mockTypes;
4045
+ Consola.prototype.pause = Consola.prototype.pauseLogs;
4046
+ Consola.prototype.resume = Consola.prototype.resumeLogs;
4047
+ function createConsola$1(options = {}) {
4048
+ return new Consola(options);
4049
+ }
4050
+
4051
+ class BrowserReporter {
4052
+ options;
4053
+ defaultColor;
4054
+ levelColorMap;
4055
+ typeColorMap;
4056
+ constructor(options) {
4057
+ this.options = { ...options };
4058
+ this.defaultColor = "#7f8c8d";
4059
+ this.levelColorMap = {
4060
+ 0: "#c0392b",
4061
+ // Red
4062
+ 1: "#f39c12",
4063
+ // Yellow
4064
+ 3: "#00BCD4"
4065
+ // Cyan
4066
+ };
4067
+ this.typeColorMap = {
4068
+ success: "#2ecc71"
4069
+ // Green
4070
+ };
4071
+ }
4072
+ _getLogFn(level) {
4073
+ if (level < 1) {
4074
+ return console.__error || console.error;
4075
+ }
4076
+ if (level === 1) {
4077
+ return console.__warn || console.warn;
4078
+ }
4079
+ return console.__log || console.log;
4080
+ }
4081
+ log(logObj) {
4082
+ const consoleLogFn = this._getLogFn(logObj.level);
4083
+ const type = logObj.type === "log" ? "" : logObj.type;
4084
+ const tag = logObj.tag || "";
4085
+ const color = this.typeColorMap[logObj.type] || this.levelColorMap[logObj.level] || this.defaultColor;
4086
+ const style = `
4087
+ background: ${color};
4088
+ border-radius: 0.5em;
4089
+ color: white;
4090
+ font-weight: bold;
4091
+ padding: 2px 0.5em;
4092
+ `;
4093
+ const badge = `%c${[tag, type].filter(Boolean).join(":")}`;
4094
+ if (typeof logObj.args[0] === "string") {
4095
+ consoleLogFn(
4096
+ `${badge}%c ${logObj.args[0]}`,
4097
+ style,
4098
+ // Empty string as style resets to default console style
4099
+ "",
4100
+ ...logObj.args.slice(1)
4101
+ );
4102
+ } else {
4103
+ consoleLogFn(badge, style, ...logObj.args);
4104
+ }
4105
+ }
4106
+ }
4107
+
4108
+ function createConsola(options = {}) {
4109
+ const consola2 = createConsola$1({
4110
+ reporters: options.reporters || [new BrowserReporter({})],
4111
+ prompt(message, options2 = {}) {
4112
+ if (options2.type === "confirm") {
4113
+ return Promise.resolve(confirm(message));
4114
+ }
4115
+ return Promise.resolve(prompt(message));
4116
+ },
4117
+ ...options
4118
+ });
4119
+ return consola2;
4120
+ }
4121
+ const consola = createConsola();
4122
+
3550
4123
  var _sfc_main$1 = /* @__PURE__ */ defineComponent({
3551
4124
  __name: "paragraph",
3552
4125
  props: {
@@ -3,7 +3,6 @@ import './init.mjs';
3
3
  import 'vue';
4
4
  import '@vunk/shared/enum';
5
5
  import '@vunk/shared/promise';
6
- import './browser.mjs';
7
6
  import './_commonjsHelpers.mjs';
8
7
  import './_plugin-vue_export-helper.mjs';
9
8
  import './colorToUniform.mjs';