@textbus/xnote 0.0.1-alpha.2 → 0.0.1-alpha.4

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.
@@ -3,42 +3,13 @@ import { withScopedCSS } from '@viewfly/scoped-css';
3
3
  import { Injectable, InjectFlags, Injector, inject, createSignal, onUnmounted, createRef, withAnnotation, onMounted, InjectionToken, viewfly, createDynamicRef, onUpdated, getCurrentInstance, watch, ReflectiveInjector } from '@viewfly/core';
4
4
  import { Subject, Selection, fromEvent, Subscription, Attribute, Keyboard, Commander, Controller, ContentType, Component, Registry, Slot, useContext, onBreak, createVNode, BehaviorSubject, onPaste, onFocus, onBlur, useDynamicShortcut, VTextNode, Query, QueryStateType, onContentInsert, onFocusIn, onFocusOut, onGetRanges, Formatter, onParentSlotUpdated, Textbus, RootComponentRef, filter, map, distinctUntilChanged, sampleTime, merge, debounceTime, throttleTime, delay, onCompositionStart } from '@textbus/core';
5
5
  import { VIEW_CONTAINER, DomAdapter, Input, SelectionBridge, VIEW_DOCUMENT, BrowserModule, Parser } from '@textbus/platform-browser';
6
- import { createPortal, DomRenderer, createApp } from '@viewfly/platform-browser';
6
+ import { createPortal, DomRenderer, createApp, HTMLRenderer, OutputTranslator } from '@viewfly/platform-browser';
7
7
  import { useProduce } from '@viewfly/hooks';
8
8
  import highlightjs from 'highlight.js';
9
- import { Adapter } from '@textbus/adapter-viewfly';
9
+ import { ViewflyAdapter, ViewflyVDomAdapter } from '@textbus/adapter-viewfly';
10
10
  import { CollaborateModule } from '@textbus/collaborate';
11
11
 
12
- function styleInject(css, ref) {
13
- if ( ref === void 0 ) ref = {};
14
- var insertAt = ref.insertAt;
15
-
16
- if (!css || typeof document === 'undefined') { return; }
17
-
18
- var head = document.head || document.getElementsByTagName('head')[0];
19
- var style = document.createElement('style');
20
- style.type = 'text/css';
21
-
22
- if (insertAt === 'top') {
23
- if (head.firstChild) {
24
- head.insertBefore(style, head.firstChild);
25
- } else {
26
- head.appendChild(style);
27
- }
28
- } else {
29
- head.appendChild(style);
30
- }
31
-
32
- if (style.styleSheet) {
33
- style.styleSheet.cssText = css;
34
- } else {
35
- style.appendChild(document.createTextNode(css));
36
- }
37
- }
38
-
39
- var css_248z$w = ".btn[vf-69b4db]{align-items:center;background:none;background:#fff;border:none;border-radius:4px;cursor:pointer;display:inline-flex;font-size:inherit;height:28px;outline:none;padding:6px 5px;transition:all .2s}.btn>span[vf-69b4db]{white-space:nowrap}.btn[vf-69b4db]:hover{background:rgba(0,0,0,.1)}.btn-arrow[vf-69b4db]{position:relative;transform:rotate(0);transform-origin:50%;width:1em}.btn.active[vf-69b4db]{background:rgba(0,0,0,.1)}.btn.active .btn-arrow[vf-69b4db]{transform:rotate(180deg)}.btn.highlight[vf-69b4db]{background-color:rgba(41,110,255,.063);color:#296eff}";
40
- var scopedId$k = "vf-69b4db";
41
- styleInject(css_248z$w);
12
+ var css$j = undefined;
42
13
 
43
14
  /******************************************************************************
44
15
  Copyright (c) Microsoft Corporation.
@@ -85,18 +56,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
85
56
 
86
57
  let DropdownService = class DropdownService {
87
58
  constructor() {
88
- Object.defineProperty(this, "onSiblingOpen", {
89
- enumerable: true,
90
- configurable: true,
91
- writable: true,
92
- value: void 0
93
- });
94
- Object.defineProperty(this, "siblingOpenEvent", {
95
- enumerable: true,
96
- configurable: true,
97
- writable: true,
98
- value: new Subject()
99
- });
59
+ this.siblingOpenEvent = new Subject();
100
60
  this.onSiblingOpen = this.siblingOpenEvent.asObservable();
101
61
  }
102
62
  notify(id) {
@@ -114,60 +74,14 @@ var DropdownContextService_1;
114
74
  let i = 0;
115
75
  let DropdownContextService = DropdownContextService_1 = class DropdownContextService {
116
76
  constructor(dropdownService, injector) {
117
- Object.defineProperty(this, "dropdownService", {
118
- enumerable: true,
119
- configurable: true,
120
- writable: true,
121
- value: dropdownService
122
- });
123
- Object.defineProperty(this, "injector", {
124
- enumerable: true,
125
- configurable: true,
126
- writable: true,
127
- value: injector
128
- });
129
- Object.defineProperty(this, "id", {
130
- enumerable: true,
131
- configurable: true,
132
- writable: true,
133
- value: i
134
- });
135
- Object.defineProperty(this, "isOpen", {
136
- enumerable: true,
137
- configurable: true,
138
- writable: true,
139
- value: false
140
- });
141
- Object.defineProperty(this, "onOpenStateChange", {
142
- enumerable: true,
143
- configurable: true,
144
- writable: true,
145
- value: void 0
146
- });
147
- Object.defineProperty(this, "canHide", {
148
- enumerable: true,
149
- configurable: true,
150
- writable: true,
151
- value: true
152
- });
153
- Object.defineProperty(this, "openStateChangeEvent", {
154
- enumerable: true,
155
- configurable: true,
156
- writable: true,
157
- value: new Subject()
158
- });
159
- Object.defineProperty(this, "timer", {
160
- enumerable: true,
161
- configurable: true,
162
- writable: true,
163
- value: null
164
- });
165
- Object.defineProperty(this, "parentDropdownContextService", {
166
- enumerable: true,
167
- configurable: true,
168
- writable: true,
169
- value: this.injector.get(DropdownContextService_1, InjectFlags.SkipSelf, null)
170
- });
77
+ this.dropdownService = dropdownService;
78
+ this.injector = injector;
79
+ this.id = i;
80
+ this.isOpen = false;
81
+ this.canHide = true;
82
+ this.openStateChangeEvent = new Subject();
83
+ this.timer = null;
84
+ this.parentDropdownContextService = this.injector.get(DropdownContextService_1, InjectFlags.SkipSelf, null);
171
85
  this.onOpenStateChange = this.openStateChangeEvent.asObservable();
172
86
  dropdownService.onSiblingOpen.subscribe(id => {
173
87
  if (id === this.id) {
@@ -226,7 +140,7 @@ function Button(props) {
226
140
  subscription.unsubscribe();
227
141
  });
228
142
  }
229
- return withScopedCSS(scopedId$k, () => {
143
+ return withScopedCSS(css$j, () => {
230
144
  return (jsxs("button", Object.assign({ type: "button" }, props, { class: [
231
145
  'btn',
232
146
  {
@@ -238,12 +152,10 @@ function Button(props) {
238
152
  });
239
153
  }
240
154
 
241
- var css_248z$v = ".component-toolbar[vf-ac7e8d]{position:relative;z-index:3}.toolbar[vf-ac7e8d]{background:#fff;border:1px solid #dee0e3;border-radius:5px;bottom:10px;box-shadow:0 4px 8px rgba(0,0,0,.08);box-sizing:border-box;display:flex;font-size:14px;height:36px;opacity:0;padding:0 6px;pointer-events:none;position:absolute;text-align:left;transform:translateY(10px)}.toolbar.active[vf-ac7e8d]{opacity:1;pointer-events:auto;transform:translateY(0);transition-duration:.2s;transition-property:all;transition-timing-function:ease}";
242
- var scopedId$j = "vf-ac7e8d";
243
- styleInject(css_248z$v);
155
+ var css$i = undefined;
244
156
 
245
157
  function ComponentToolbar(props) {
246
- return withScopedCSS(scopedId$j, () => {
158
+ return withScopedCSS(css$i, () => {
247
159
  return (jsx("div", { class: "component-toolbar", style: props.style, children: jsx("div", { class: [
248
160
  'toolbar',
249
161
  {
@@ -253,19 +165,15 @@ function ComponentToolbar(props) {
253
165
  });
254
166
  }
255
167
 
256
- var css_248z$u = ".divider[vf-ede279]{border-top:1px solid #eee;margin:6px 0}";
257
- var scopedId$i = "vf-ede279";
258
- styleInject(css_248z$u);
168
+ var css$h = undefined;
259
169
 
260
170
  function Divider() {
261
- return withScopedCSS(scopedId$i, () => {
171
+ return withScopedCSS(css$h, () => {
262
172
  return jsx("div", { class: "divider" });
263
173
  });
264
174
  }
265
175
 
266
- var css_248z$t = ".drag-resize[vf-4c1803]{position:relative;width:100%}.drag-resize .resize-tool[vf-4c1803]{align-items:center;border:1px dashed #296eff;display:none;height:100%;justify-content:center;left:0;pointer-events:none;position:absolute;top:0;width:100%}.drag-resize .resize-tool.active[vf-4c1803]{display:flex}.drag-resize .mask[vf-4c1803]{background-color:rgba(0,0,0,.8);border-radius:3px;color:#fff;font-size:14px;padding:3px 8px;position:relative;text-shadow:1px 2px 3px rgba(0,0,0,.7);white-space:nowrap;z-index:10}.drag-resize .btn-group[vf-4c1803]{height:100%;left:0;position:absolute;top:0;width:100%}.drag-resize button[vf-4c1803]{background:#fff;border:2px solid #296eff;border-radius:50%;box-sizing:border-box;cursor:pointer;font-size:0;height:14px;outline:none;padding:0;pointer-events:auto;position:absolute;width:14px}.drag-resize button[vf-4c1803]:hover{background-color:#fff;box-shadow:0 0 0 3px rgba(18,150,219,.3)}.drag-resize button[vf-4c1803]:first-child,.drag-resize button[vf-4c1803]:nth-child(2),.drag-resize button[vf-4c1803]:nth-child(3){margin-top:-5px;top:0}.drag-resize button[vf-4c1803]:nth-child(3),.drag-resize button[vf-4c1803]:nth-child(4),.drag-resize button[vf-4c1803]:nth-child(5){margin-right:-5px;right:0}.drag-resize button[vf-4c1803]:nth-child(5),.drag-resize button[vf-4c1803]:nth-child(6),.drag-resize button[vf-4c1803]:nth-child(7){bottom:0;margin-bottom:-5px}.drag-resize button[vf-4c1803]:first-child,.drag-resize button[vf-4c1803]:nth-child(7),.drag-resize button[vf-4c1803]:nth-child(8){left:0;margin-left:-5px}.drag-resize button[vf-4c1803]:nth-child(2),.drag-resize button[vf-4c1803]:nth-child(6){left:50%;margin-left:-5px}.drag-resize button[vf-4c1803]:nth-child(4),.drag-resize button[vf-4c1803]:nth-child(8){margin-top:-5px;top:50%}.drag-resize button[vf-4c1803]:first-child{cursor:nw-resize}.drag-resize button[vf-4c1803]:nth-child(2){cursor:n-resize}.drag-resize button[vf-4c1803]:nth-child(3){cursor:ne-resize}.drag-resize button[vf-4c1803]:nth-child(4){cursor:e-resize}.drag-resize button[vf-4c1803]:nth-child(5){cursor:se-resize}.drag-resize button[vf-4c1803]:nth-child(6){cursor:s-resize}.drag-resize button[vf-4c1803]:nth-child(7){cursor:sw-resize}.drag-resize button[vf-4c1803]:nth-child(8){cursor:w-resize}";
267
- var scopedId$h = "vf-4c1803";
268
- styleInject(css_248z$t);
176
+ var style = undefined;
269
177
 
270
178
  function DragResize(props) {
271
179
  const isShow = createSignal(false);
@@ -373,20 +281,16 @@ function DragResize(props) {
373
281
  unUp.unsubscribe();
374
282
  });
375
283
  }
376
- return withScopedCSS(scopedId$h, () => {
284
+ return withScopedCSS(style, () => {
377
285
  return (jsxs("div", { class: "drag-resize", onClick: selectComponent, children: [jsx("div", { class: "container", ref: ref, children: props.children }), jsxs("div", { class: ['resize-tool', {
378
286
  active: isShow()
379
287
  }], children: [jsxs("div", { class: "mask", ref: mask, children: [component.state.width, "*", component.state.height] }), jsxs("div", { class: "btn-group", ref: btnGroup, onMousedown: drag, children: [jsx("button", { type: "button" }), jsx("button", { type: "button" }), jsx("button", { type: "button" }), jsx("button", { type: "button" }), jsx("button", { type: "button" }), jsx("button", { type: "button" }), jsx("button", { type: "button" }), jsx("button", { type: "button" })] })] })] }));
380
288
  });
381
289
  }
382
290
 
383
- var css_248z$s = ".dropdown[vf-a99c5e]{display:inline-block;position:relative}.dropdown[vf-a99c5e]:hover{z-index:1}.dropdown-btn[vf-a99c5e]{display:flex;width:100%}.dropdown-btn-inner[vf-a99c5e]{flex:1}";
384
- var scopedId$g = "vf-a99c5e";
385
- styleInject(css_248z$s);
291
+ var css$g = undefined;
386
292
 
387
- var css_248z$r = ".dropdown-menu[vf-4f8cfb]{background:#fff;border:1px solid #ddd;border-radius:5px;box-shadow:2px 3px 5px rgba(0,0,0,.1);height:0;left:-10px;opacity:0;overflow-y:auto;position:fixed;top:100%;transition-duration:0s;transition:transform .3s,opacity .3s;user-select:none;width:200px;z-index:10}.dropdown-menu-content[vf-4f8cfb]{padding:6px}";
388
- var scopedId$f = "vf-4f8cfb";
389
- styleInject(css_248z$r);
293
+ var css$f = undefined;
390
294
 
391
295
  const DropdownMenuPortal = withAnnotation({
392
296
  providers: [
@@ -469,7 +373,7 @@ const DropdownMenuPortal = withAnnotation({
469
373
  dropdownContextService.canHide = true;
470
374
  dropdownContextService.hide();
471
375
  }
472
- return createPortal(withScopedCSS(scopedId$f, () => {
376
+ return createPortal(withScopedCSS(css$f, () => {
473
377
  return (jsx("div", { onMouseenter: onEnter, onMouseleave: onLeave, ref: menuRef, style: {
474
378
  width: props.width
475
379
  }, class: "dropdown-menu", children: jsx("div", { class: "dropdown-menu-content", children: props.children }) }));
@@ -530,7 +434,7 @@ const Dropdown = withAnnotation({
530
434
  dropdownContextService.open();
531
435
  }
532
436
  },
533
- $render: withScopedCSS(scopedId$g, () => {
437
+ $render: withScopedCSS(css$g, () => {
534
438
  return (jsxs("div", { class: ['dropdown', props.class], style: props.style, ref: dropdownRef, children: [jsxs("div", { class: "dropdown-btn", ref: triggerRef, children: [jsx("div", { class: "dropdown-btn-inner", children: props.children }), jsx("div", { class: "dropdown-btn-arrow" })] }), isShow() && jsx(DropdownMenuPortal, { width: props.width, abreast: props.abreast, triggerRef: triggerRef, children: Array.isArray(props.menu) ?
535
439
  props.menu.map(menu => {
536
440
  return (jsx("div", { class: "dropdown-menu-item", onClick: () => {
@@ -546,9 +450,7 @@ const Dropdown = withAnnotation({
546
450
  };
547
451
  });
548
452
 
549
- var css_248z$q = ".menu-item[vf-64f71d]{border-radius:4px;cursor:pointer;display:flex;font-size:14px;height:26px;justify-content:space-between;line-height:26px;padding:2px 10px;transition:background-color .2s}.menu-item.disabled[vf-64f71d]{cursor:not-allowed;opacity:.5}.menu-item[vf-64f71d]:hover{background:#eee}.menu-item.active[vf-64f71d]{background:rgba(0,0,0,.1)}.menu-icon[vf-64f71d]{display:inline-block;width:1.8em}.menu-check[vf-64f71d]{display:none}.menu-check.checked[vf-64f71d]{color:#296eff;display:block}";
550
- var scopedId$e = "vf-64f71d";
551
- styleInject(css_248z$q);
453
+ var css$e = undefined;
552
454
 
553
455
  function MenuItem(props) {
554
456
  const dropdownContextService = inject(DropdownContextService, InjectFlags.Optional, null);
@@ -568,7 +470,7 @@ function MenuItem(props) {
568
470
  }
569
471
  (_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props, props.value);
570
472
  }
571
- return withScopedCSS(scopedId$e, () => {
473
+ return withScopedCSS(css$e, () => {
572
474
  return (jsxs("div", { class: ['menu-item', { disabled: props.disabled, active: props.arrow && isActive() }], onClick: click, children: [jsxs("div", { children: [props.icon && jsx("span", { class: "menu-icon", children: props.icon }), props.children] }), props.arrow ?
573
475
  jsx("div", { class: "arrow", children: jsx("span", { class: "xnote-icon-arrow-right" }) }) :
574
476
  jsx("div", { class: [
@@ -578,13 +480,11 @@ function MenuItem(props) {
578
480
  });
579
481
  }
580
482
 
581
- var css_248z$p = ".popup[vf-a23c47]{background:#fff;border:1px solid #ddd;border-radius:5px;box-shadow:2px 3px 5px rgba(0,0,0,.1);overflow:hidden;position:absolute}";
582
- var scopedId$d = "vf-a23c47";
583
- styleInject(css_248z$p);
483
+ var css$d = undefined;
584
484
 
585
485
  function Popup(props) {
586
486
  const host = inject(VIEW_CONTAINER);
587
- return createPortal(withScopedCSS(scopedId$d, () => {
487
+ return createPortal(withScopedCSS(css$d, () => {
588
488
  return (jsx("div", { class: "popup", style: {
589
489
  left: props.left + 'px',
590
490
  top: props.top + 'px'
@@ -592,28 +492,19 @@ function Popup(props) {
592
492
  }), host);
593
493
  }
594
494
 
595
- var css_248z$o = ".toolbar-item[vf-216815]{padding:3px}";
596
- var scopedId$c = "vf-216815";
597
- styleInject(css_248z$o);
495
+ var css$c = undefined;
598
496
 
599
497
  function ToolbarItem(props) {
600
- return withScopedCSS(scopedId$c, () => {
498
+ return withScopedCSS(css$c, () => {
601
499
  return (jsx("div", { class: "toolbar-item", children: props.children }));
602
500
  });
603
501
  }
604
502
 
605
- var css_248z$n = ".heading-icon[vf-2a8a65]{font-size:1.2em;font-weight:700}.heading-icon sub[vf-2a8a65]{font-weight:400}";
606
- var scopedId$b = "vf-2a8a65";
607
- styleInject(css_248z$n);
503
+ var css$b = undefined;
608
504
 
609
505
  let RefreshService = class RefreshService {
610
506
  constructor() {
611
- Object.defineProperty(this, "onRefresh", {
612
- enumerable: true,
613
- configurable: true,
614
- writable: true,
615
- value: new Subject()
616
- });
507
+ this.onRefresh = new Subject();
617
508
  }
618
509
  };
619
510
  RefreshService = __decorate([
@@ -656,12 +547,6 @@ function registerTextAlignShortcut(textbus) {
656
547
  });
657
548
  }
658
549
 
659
- var css_248z$m = ".xnote-source-code.atom-one-dark pre code.hljs{display:block;overflow-x:auto;padding:1em}.xnote-source-code.atom-one-dark code.hljs{padding:3px 5px}.xnote-source-code.atom-one-dark .hljs{background:#282c34;color:#abb2bf}.xnote-source-code.atom-one-dark .hljs-comment,.xnote-source-code.atom-one-dark .hljs-quote{color:#5c6370;font-style:italic}.xnote-source-code.atom-one-dark .hljs-doctag,.xnote-source-code.atom-one-dark .hljs-formula,.xnote-source-code.atom-one-dark .hljs-keyword{color:#c678dd}.xnote-source-code.atom-one-dark .hljs-deletion,.xnote-source-code.atom-one-dark .hljs-name,.xnote-source-code.atom-one-dark .hljs-section,.xnote-source-code.atom-one-dark .hljs-selector-tag,.xnote-source-code.atom-one-dark .hljs-subst{color:#e06c75}.xnote-source-code.atom-one-dark .hljs-literal{color:#56b6c2}.xnote-source-code.atom-one-dark .hljs-addition,.xnote-source-code.atom-one-dark .hljs-attribute,.xnote-source-code.atom-one-dark .hljs-meta .hljs-string,.xnote-source-code.atom-one-dark .hljs-regexp,.xnote-source-code.atom-one-dark .hljs-string{color:#98c379}.xnote-source-code.atom-one-dark .hljs-attr,.xnote-source-code.atom-one-dark .hljs-number,.xnote-source-code.atom-one-dark .hljs-selector-attr,.xnote-source-code.atom-one-dark .hljs-selector-class,.xnote-source-code.atom-one-dark .hljs-selector-pseudo,.xnote-source-code.atom-one-dark .hljs-template-variable,.xnote-source-code.atom-one-dark .hljs-type,.xnote-source-code.atom-one-dark .hljs-variable{color:#d19a66}.xnote-source-code.atom-one-dark .hljs-bullet,.xnote-source-code.atom-one-dark .hljs-link,.xnote-source-code.atom-one-dark .hljs-meta,.xnote-source-code.atom-one-dark .hljs-selector-id,.xnote-source-code.atom-one-dark .hljs-symbol,.xnote-source-code.atom-one-dark .hljs-title{color:#61aeee}.xnote-source-code.atom-one-dark .hljs-built_in,.xnote-source-code.atom-one-dark .hljs-class .hljs-title,.xnote-source-code.atom-one-dark .hljs-title.class_{color:#e6c07b}.xnote-source-code.atom-one-dark .hljs-emphasis{font-style:italic}.xnote-source-code.atom-one-dark .hljs-strong{font-weight:700}.xnote-source-code.atom-one-dark .hljs-link{text-decoration:underline}.xnote-source-code.foundation pre code.hljs{display:block;overflow-x:auto;padding:1em}.xnote-source-code.foundation code.hljs{padding:3px 5px}.xnote-source-code.foundation .hljs{background:#eee;color:#000}.xnote-source-code.foundation .hljs-addition,.xnote-source-code.foundation .hljs-attribute,.xnote-source-code.foundation .hljs-emphasis,.xnote-source-code.foundation .hljs-link{color:#070}.xnote-source-code.foundation .hljs-emphasis{font-style:italic}.xnote-source-code.foundation .hljs-deletion,.xnote-source-code.foundation .hljs-string,.xnote-source-code.foundation .hljs-strong{color:#d14}.xnote-source-code.foundation .hljs-strong{font-weight:700}.xnote-source-code.foundation .hljs-comment,.xnote-source-code.foundation .hljs-quote{color:#998;font-style:italic}.xnote-source-code.foundation .hljs-section,.xnote-source-code.foundation .hljs-title{color:#900}.xnote-source-code.foundation .hljs-class .hljs-title,.xnote-source-code.foundation .hljs-title.class_,.xnote-source-code.foundation .hljs-type{color:#458}.xnote-source-code.foundation .hljs-template-variable,.xnote-source-code.foundation .hljs-variable{color:#369}.xnote-source-code.foundation .hljs-bullet{color:#970}.xnote-source-code.foundation .hljs-meta{color:#34b}.xnote-source-code.foundation .hljs-code,.xnote-source-code.foundation .hljs-keyword,.xnote-source-code.foundation .hljs-literal,.xnote-source-code.foundation .hljs-number,.xnote-source-code.foundation .hljs-selector-tag{color:#099}.xnote-source-code.foundation .hljs-regexp{background-color:#fff0ff;color:#808}.xnote-source-code.foundation .hljs-symbol{color:#990073}.xnote-source-code.foundation .hljs-name,.xnote-source-code.foundation .hljs-selector-class,.xnote-source-code.foundation .hljs-selector-id,.xnote-source-code.foundation .hljs-tag{color:#070}.xnote-source-code.github{\n /*!\n Theme: GitHub\n Description: Light theme as seen on github.com\n Author: github.com\n Maintainer: @Hirse\n Updated: 2021-05-15\n\n Outdated base version: https://github.com/primer/github-syntax-light\n Current colors taken from GitHub's CSS\n */}.xnote-source-code.github .xnote-source-code-container{border:1px solid #eee}.xnote-source-code.github .xnote-source-code-line-number-bg{background-color:#fafafa}.xnote-source-code.github pre code.hljs{display:block;overflow-x:auto;padding:1em}.xnote-source-code.github code.hljs{padding:3px 5px}.xnote-source-code.github .hljs{background:#fff;color:#24292e}.xnote-source-code.github .hljs-doctag,.xnote-source-code.github .hljs-keyword,.xnote-source-code.github .hljs-meta .hljs-keyword,.xnote-source-code.github .hljs-template-tag,.xnote-source-code.github .hljs-template-variable,.xnote-source-code.github .hljs-type,.xnote-source-code.github .hljs-variable.language_{color:#d73a49}.xnote-source-code.github .hljs-title,.xnote-source-code.github .hljs-title.class_,.xnote-source-code.github .hljs-title.class_.inherited__,.xnote-source-code.github .hljs-title.function_{color:#6f42c1}.xnote-source-code.github .hljs-attr,.xnote-source-code.github .hljs-attribute,.xnote-source-code.github .hljs-literal,.xnote-source-code.github .hljs-meta,.xnote-source-code.github .hljs-number,.xnote-source-code.github .hljs-operator,.xnote-source-code.github .hljs-selector-attr,.xnote-source-code.github .hljs-selector-class,.xnote-source-code.github .hljs-selector-id,.xnote-source-code.github .hljs-variable{color:#005cc5}.xnote-source-code.github .hljs-meta .hljs-string,.xnote-source-code.github .hljs-regexp,.xnote-source-code.github .hljs-string{color:#032f62}.xnote-source-code.github .hljs-built_in,.xnote-source-code.github .hljs-symbol{color:#e36209}.xnote-source-code.github .hljs-code,.xnote-source-code.github .hljs-comment,.xnote-source-code.github .hljs-formula{color:#6a737d}.xnote-source-code.github .hljs-name,.xnote-source-code.github .hljs-quote,.xnote-source-code.github .hljs-selector-pseudo,.xnote-source-code.github .hljs-selector-tag{color:#22863a}.xnote-source-code.github .hljs-subst{color:#24292e}.xnote-source-code.github .hljs-section{color:#005cc5;font-weight:700}.xnote-source-code.github .hljs-bullet{color:#735c0f}.xnote-source-code.github .hljs-emphasis{color:#24292e;font-style:italic}.xnote-source-code.github .hljs-strong{color:#24292e;font-weight:700}.xnote-source-code.github .hljs-addition{background-color:#f0fff4;color:#22863a}.xnote-source-code.github .hljs-deletion{background-color:#ffeef0;color:#b31d28}.xnote-source-code.idea .xnote-source-code-container{border:1px solid #eee}.xnote-source-code.idea .xnote-source-code-line-number-bg{background-color:#fafafa}.xnote-source-code.idea pre code.hljs{display:block;overflow-x:auto;padding:1em}.xnote-source-code.idea code.hljs{padding:3px 5px}.xnote-source-code.idea .hljs{background:#fff;color:#000}.xnote-source-code.idea .hljs-subst,.xnote-source-code.idea .hljs-title{color:#000;font-weight:400}.xnote-source-code.idea .hljs-comment,.xnote-source-code.idea .hljs-quote{color:grey;font-style:italic}.xnote-source-code.idea .hljs-meta{color:olive}.xnote-source-code.idea .hljs-tag{background:#efefef}.xnote-source-code.idea .hljs-keyword,.xnote-source-code.idea .hljs-literal,.xnote-source-code.idea .hljs-name,.xnote-source-code.idea .hljs-section,.xnote-source-code.idea .hljs-selector-class,.xnote-source-code.idea .hljs-selector-id,.xnote-source-code.idea .hljs-selector-tag,.xnote-source-code.idea .hljs-type{color:navy;font-weight:700}.xnote-source-code.idea .hljs-attribute,.xnote-source-code.idea .hljs-link,.xnote-source-code.idea .hljs-number,.xnote-source-code.idea .hljs-regexp{color:#00f;font-weight:700}.xnote-source-code.idea .hljs-link,.xnote-source-code.idea .hljs-number,.xnote-source-code.idea .hljs-regexp{font-weight:400}.xnote-source-code.idea .hljs-string{color:green;font-weight:700}.xnote-source-code.idea .hljs-bullet,.xnote-source-code.idea .hljs-formula,.xnote-source-code.idea .hljs-symbol{background:#d0eded;color:#000;font-style:italic}.xnote-source-code.idea .hljs-doctag{text-decoration:underline}.xnote-source-code.idea .hljs-template-variable,.xnote-source-code.idea .hljs-variable{color:#660e7a}.xnote-source-code.idea .hljs-addition{background:#baeeba}.xnote-source-code.idea .hljs-deletion{background:#ffc8bd}.xnote-source-code.idea .hljs-emphasis{font-style:italic}.xnote-source-code.idea .hljs-strong{font-weight:700}.xnote-source-code.intellij-light .xnote-source-code-container{border:1px solid #eee}.xnote-source-code.intellij-light .xnote-source-code-line-number-bg{background-color:#fafafa}.xnote-source-code.intellij-light pre code.hljs{display:block;overflow-x:auto;padding:1em}.xnote-source-code.intellij-light code.hljs{padding:3px 5px}.xnote-source-code.intellij-light .hljs{background:#fff;color:#000}.xnote-source-code.intellij-light .hljs-subst,.xnote-source-code.intellij-light .hljs-title{color:#000;font-weight:400}.xnote-source-code.intellij-light .hljs-title.function_{color:#7a7a43}.xnote-source-code.intellij-light .hljs-code,.xnote-source-code.intellij-light .hljs-comment,.xnote-source-code.intellij-light .hljs-quote{color:#8c8c8c;font-style:italic}.xnote-source-code.intellij-light .hljs-meta{color:#9e880d}.xnote-source-code.intellij-light .hljs-section{color:#871094}.xnote-source-code.intellij-light .hljs-built_in,.xnote-source-code.intellij-light .hljs-keyword,.xnote-source-code.intellij-light .hljs-literal,.xnote-source-code.intellij-light .hljs-meta .hljs-keyword,.xnote-source-code.intellij-light .hljs-name,.xnote-source-code.intellij-light .hljs-selector-attr,.xnote-source-code.intellij-light .hljs-selector-class,.xnote-source-code.intellij-light .hljs-selector-id,.xnote-source-code.intellij-light .hljs-selector-pseudo,.xnote-source-code.intellij-light .hljs-selector-tag,.xnote-source-code.intellij-light .hljs-symbol,.xnote-source-code.intellij-light .hljs-template-tag,.xnote-source-code.intellij-light .hljs-type,.xnote-source-code.intellij-light .hljs-variable.language_{color:#0033b3}.xnote-source-code.intellij-light .hljs-attr,.xnote-source-code.intellij-light .hljs-property{color:#871094}.xnote-source-code.intellij-light .hljs-attribute{color:#174ad4}.xnote-source-code.intellij-light .hljs-number{color:#1750eb}.xnote-source-code.intellij-light .hljs-regexp{color:#264eff}.xnote-source-code.intellij-light .hljs-link{color:#006dcc;text-decoration:underline}.xnote-source-code.intellij-light .hljs-meta .hljs-string,.xnote-source-code.intellij-light .hljs-string{color:#067d17}.xnote-source-code.intellij-light .hljs-char.escape_{color:#0037a6}.xnote-source-code.intellij-light .hljs-doctag{text-decoration:underline}.xnote-source-code.intellij-light .hljs-template-variable{color:#248f8f}.xnote-source-code.intellij-light .hljs-addition{background:#bee6be}.xnote-source-code.intellij-light .hljs-deletion{background:#d6d6d6}.xnote-source-code.intellij-light .hljs-emphasis{font-style:italic}.xnote-source-code.intellij-light .hljs-strong{font-weight:700}.xnote-source-code.intellij-light .hljs-bullet,.xnote-source-code.intellij-light .hljs-formula,.xnote-source-code.intellij-light .hljs-operator,.xnote-source-code.intellij-light .hljs-params,.xnote-source-code.intellij-light .hljs-punctuation,.xnote-source-code.intellij-light .hljs-tag,.xnote-source-code.intellij-light .hljs-title.class_,.xnote-source-code.intellij-light .hljs-title.class_.inherited__,.xnote-source-code.intellij-light .hljs-variable,.xnote-source-code.stackoverflow-light{\n /*!\n Theme: StackOverflow Light\n Description: Light theme as used on stackoverflow.com\n Author: stackoverflow.com\n Maintainer: @Hirse\n Website: https://github.com/StackExchange/Stacks\n License: MIT\n Updated: 2021-05-15\n\n Updated for @stackoverflow/stacks v0.64.0\n Code Blocks: /blob/v0.64.0/lib/css/components/_stacks-code-blocks.less\n Colors: /blob/v0.64.0/lib/css/exports/_stacks-constants-colors.less\n */}.xnote-source-code.stackoverflow-light pre code.hljs{display:block;overflow-x:auto;padding:1em}.xnote-source-code.stackoverflow-light code.hljs{padding:3px 5px}.xnote-source-code.stackoverflow-light .hljs{background:#f6f6f6;color:#2f3337}.xnote-source-code.stackoverflow-light .hljs-subst{color:#2f3337}.xnote-source-code.stackoverflow-light .hljs-comment{color:#656e77}.xnote-source-code.stackoverflow-light .hljs-attr,.xnote-source-code.stackoverflow-light .hljs-doctag,.xnote-source-code.stackoverflow-light .hljs-keyword,.xnote-source-code.stackoverflow-light .hljs-meta .hljs-keyword,.xnote-source-code.stackoverflow-light .hljs-section,.xnote-source-code.stackoverflow-light .hljs-selector-tag{color:#015692}.xnote-source-code.stackoverflow-light .hljs-attribute{color:#803378}.xnote-source-code.stackoverflow-light .hljs-name,.xnote-source-code.stackoverflow-light .hljs-number,.xnote-source-code.stackoverflow-light .hljs-quote,.xnote-source-code.stackoverflow-light .hljs-selector-id,.xnote-source-code.stackoverflow-light .hljs-template-tag,.xnote-source-code.stackoverflow-light .hljs-type{color:#b75501}.xnote-source-code.stackoverflow-light .hljs-selector-class{color:#015692}.xnote-source-code.stackoverflow-light .hljs-link,.xnote-source-code.stackoverflow-light .hljs-regexp,.xnote-source-code.stackoverflow-light .hljs-selector-attr,.xnote-source-code.stackoverflow-light .hljs-string,.xnote-source-code.stackoverflow-light .hljs-symbol,.xnote-source-code.stackoverflow-light .hljs-template-variable,.xnote-source-code.stackoverflow-light .hljs-variable{color:#54790d}.xnote-source-code.stackoverflow-light .hljs-meta,.xnote-source-code.stackoverflow-light .hljs-selector-pseudo{color:#015692}.xnote-source-code.stackoverflow-light .hljs-built_in,.xnote-source-code.stackoverflow-light .hljs-literal,.xnote-source-code.stackoverflow-light .hljs-title{color:#b75501}.xnote-source-code.stackoverflow-light .hljs-bullet,.xnote-source-code.stackoverflow-light .hljs-code{color:#535a60}.xnote-source-code.stackoverflow-light .hljs-meta .hljs-string{color:#54790d}.xnote-source-code.stackoverflow-light .hljs-deletion{color:#c02d2e}.xnote-source-code.stackoverflow-light .hljs-addition{color:#2f6f44}.xnote-source-code.stackoverflow-light .hljs-emphasis{font-style:italic}.xnote-source-code.stackoverflow-light .hljs-strong{font-weight:700}.xnote-source-code.vs2015 pre code.hljs{display:block;overflow-x:auto;padding:1em}.xnote-source-code.vs2015 code.hljs{padding:3px 5px}.xnote-source-code.vs2015 .hljs{background:#1e1e1e;color:#dcdcdc}.xnote-source-code.vs2015 .hljs-keyword,.xnote-source-code.vs2015 .hljs-literal,.xnote-source-code.vs2015 .hljs-name,.xnote-source-code.vs2015 .hljs-symbol{color:#569cd6}.xnote-source-code.vs2015 .hljs-link{color:#569cd6;text-decoration:underline}.xnote-source-code.vs2015 .hljs-built_in,.xnote-source-code.vs2015 .hljs-type{color:#4ec9b0}.xnote-source-code.vs2015 .hljs-class,.xnote-source-code.vs2015 .hljs-number{color:#b8d7a3}.xnote-source-code.vs2015 .hljs-meta .hljs-string,.xnote-source-code.vs2015 .hljs-string{color:#d69d85}.xnote-source-code.vs2015 .hljs-regexp,.xnote-source-code.vs2015 .hljs-template-tag{color:#9a5334}.xnote-source-code.vs2015 .hljs-formula,.xnote-source-code.vs2015 .hljs-function,.xnote-source-code.vs2015 .hljs-params,.xnote-source-code.vs2015 .hljs-subst,.xnote-source-code.vs2015 .hljs-title{color:#dcdcdc}.xnote-source-code.vs2015 .hljs-comment,.xnote-source-code.vs2015 .hljs-quote{color:#57a64a;font-style:italic}.xnote-source-code.vs2015 .hljs-doctag{color:#608b4e}.xnote-source-code.vs2015 .hljs-meta,.xnote-source-code.vs2015 .hljs-meta .hljs-keyword,.xnote-source-code.vs2015 .hljs-tag{color:#9b9b9b}.xnote-source-code.vs2015 .hljs-template-variable,.xnote-source-code.vs2015 .hljs-variable{color:#bd63c5}.xnote-source-code.vs2015 .hljs-attr,.xnote-source-code.vs2015 .hljs-attribute{color:#9cdcfe}.xnote-source-code.vs2015 .hljs-section{color:gold}.xnote-source-code.vs2015 .hljs-emphasis{font-style:italic}.xnote-source-code.vs2015 .hljs-strong{font-weight:700}.xnote-source-code.vs2015 .hljs-bullet,.xnote-source-code.vs2015 .hljs-selector-attr,.xnote-source-code.vs2015 .hljs-selector-class,.xnote-source-code.vs2015 .hljs-selector-id,.xnote-source-code.vs2015 .hljs-selector-pseudo,.xnote-source-code.vs2015 .hljs-selector-tag{color:#d7ba7d}.xnote-source-code.vs2015 .hljs-addition{background-color:#144212;display:inline-block;width:100%}.xnote-source-code.vs2015 .hljs-deletion{background-color:#600;display:inline-block;width:100%}.xnote-source-code.xcode .xnote-source-code-container{border:1px solid #eee}.xnote-source-code.xcode .xnote-source-code-line-number-bg{background-color:#fafafa}.xnote-source-code.xcode pre code.hljs{display:block;overflow-x:auto;padding:1em}.xnote-source-code.xcode code.hljs{padding:3px 5px}.xnote-source-code.xcode .hljs{background:#fff;color:#000}.xnote-source-code.xcode .xml .hljs-meta{color:silver}.xnote-source-code.xcode .hljs-comment,.xnote-source-code.xcode .hljs-quote{color:#007400}.xnote-source-code.xcode .hljs-attribute,.xnote-source-code.xcode .hljs-keyword,.xnote-source-code.xcode .hljs-literal,.xnote-source-code.xcode .hljs-name,.xnote-source-code.xcode .hljs-selector-tag,.xnote-source-code.xcode .hljs-tag{color:#aa0d91}.xnote-source-code.xcode .hljs-template-variable,.xnote-source-code.xcode .hljs-variable{color:#3f6e74}.xnote-source-code.xcode .hljs-code,.xnote-source-code.xcode .hljs-meta .hljs-string,.xnote-source-code.xcode .hljs-string{color:#c41a16}.xnote-source-code.xcode .hljs-link,.xnote-source-code.xcode .hljs-regexp{color:#0e0eff}.xnote-source-code.xcode .hljs-bullet,.xnote-source-code.xcode .hljs-number,.xnote-source-code.xcode .hljs-symbol,.xnote-source-code.xcode .hljs-title{color:#1c00cf}.xnote-source-code.xcode .hljs-meta,.xnote-source-code.xcode .hljs-section{color:#643820}.xnote-source-code.xcode .hljs-built_in,.xnote-source-code.xcode .hljs-class .hljs-title,.xnote-source-code.xcode .hljs-params,.xnote-source-code.xcode .hljs-title.class_,.xnote-source-code.xcode .hljs-type{color:#5c2699}.xnote-source-code.xcode .hljs-attr{color:#836c28}.xnote-source-code.xcode .hljs-subst{color:#000}.xnote-source-code.xcode .hljs-formula{background-color:#eee;font-style:italic}.xnote-source-code.xcode .hljs-addition{background-color:#baeeba}.xnote-source-code.xcode .hljs-deletion{background-color:#ffc8bd}.xnote-source-code.xcode .hljs-selector-class,.xnote-source-code.xcode .hljs-selector-id{color:#9b703f}.xnote-source-code.xcode .hljs-doctag,.xnote-source-code.xcode .hljs-strong{font-weight:700}.xnote-source-code.xcode .hljs-emphasis{font-style:italic}.xnote-source-code code{background:none;border:none;border-radius:0;padding:0;vertical-align:inherit}.xnote-source-code{position:relative}.xnote-source-code-container{border-radius:5px;display:flex;line-height:1.418em;overflow:hidden;position:relative}.xnote-source-code-container.xnote-source-code-auto-break{word-wrap:break-word;white-space:pre-wrap;word-break:break-all}code,kbd,pre,samp{font-family:Microsoft YaHei Mono,Menlo,Monaco,Consolas,Courier New,monospace}.xnote-source-code-line-number-bg{background-color:inherit;display:none;position:relative;width:3em;z-index:2}.xnote-source-code.xnote-source-code-line-number .xnote-source-code-line-number-bg{display:block}.xnote-source-code.xnote-source-code-line-number .xnote-source-code-line{margin-left:-4em}.xnote-source-code-content{counter-reset:codeNum;flex:1;max-height:450px;overflow:auto;padding:15px 0;position:relative}.xnote-source-code-content-highlight .xnote-source-code-line{opacity:.36}.xnote-source-code-line{display:flex;margin-left:0}.xnote-source-code-line-content{padding:0 20px}.xnote-source-code-line-number .xnote-source-code-line-content{padding:0 20px 0 10px}.xnote-source-code-line-number .xnote-source-code-line:before{box-sizing:border-box;content:counter(codeNum);counter-increment:codeNum;left:0;min-width:4em;opacity:.5;overflow:hidden;padding-right:10px;position:sticky;text-align:right;transform:translateX(-4em);white-space:nowrap;z-index:2}.xnote-source-code-content-highlight .xnote-source-code-line-emphasize{opacity:1}.xnote-source-code-lang{font-size:13px;opacity:.5;padding:4px 10px;pointer-events:none;position:absolute;right:0;top:0}";
660
- styleInject(css_248z$m);
661
-
662
- var css_248z$l = ".xnote-paragraph p{margin:8px 0}";
663
- styleInject(css_248z$l);
664
-
665
550
  function useReadonly() {
666
551
  const controller = inject(Controller);
667
552
  const is = createSignal(controller.readonly);
@@ -701,18 +586,8 @@ class ParagraphComponent extends Component {
701
586
  });
702
587
  }
703
588
  }
704
- Object.defineProperty(ParagraphComponent, "componentName", {
705
- enumerable: true,
706
- configurable: true,
707
- writable: true,
708
- value: 'ParagraphComponent'
709
- });
710
- Object.defineProperty(ParagraphComponent, "type", {
711
- enumerable: true,
712
- configurable: true,
713
- writable: true,
714
- value: ContentType.BlockComponent
715
- });
589
+ ParagraphComponent.componentName = 'ParagraphComponent';
590
+ ParagraphComponent.type = ContentType.BlockComponent;
716
591
  function ParagraphView(props) {
717
592
  const adapter = inject(DomAdapter);
718
593
  const readonly = useReadonly();
@@ -874,42 +749,27 @@ function createCodeSlot() {
874
749
  class SourceCodeComponent extends Component {
875
750
  constructor() {
876
751
  super(...arguments);
877
- Object.defineProperty(this, "focus", {
878
- enumerable: true,
879
- configurable: true,
880
- writable: true,
881
- value: new BehaviorSubject(false)
882
- });
883
- Object.defineProperty(this, "cancelEmphasize", {
884
- enumerable: true,
885
- configurable: true,
886
- writable: true,
887
- value: () => {
888
- const selection = this.textbus.get(Selection);
889
- const slots = this.state.slots;
890
- const { startSlot, endSlot } = selection;
891
- let startIndex = slots.findIndex(i => i.slot === startSlot);
892
- const endIndex = slots.findIndex(i => i.slot === endSlot) + 1;
893
- for (; startIndex < endIndex; startIndex++) {
894
- slots[startIndex].emphasize = false;
895
- }
752
+ this.focus = new BehaviorSubject(false);
753
+ this.cancelEmphasize = () => {
754
+ const selection = this.textbus.get(Selection);
755
+ const slots = this.state.slots;
756
+ const { startSlot, endSlot } = selection;
757
+ let startIndex = slots.findIndex(i => i.slot === startSlot);
758
+ const endIndex = slots.findIndex(i => i.slot === endSlot) + 1;
759
+ for (; startIndex < endIndex; startIndex++) {
760
+ slots[startIndex].emphasize = false;
896
761
  }
897
- });
898
- Object.defineProperty(this, "emphasize", {
899
- enumerable: true,
900
- configurable: true,
901
- writable: true,
902
- value: () => {
903
- const selection = this.textbus.get(Selection);
904
- const slots = this.state.slots;
905
- const { startSlot, endSlot } = selection;
906
- let startIndex = slots.findIndex(i => i.slot === startSlot);
907
- const endIndex = slots.findIndex(i => i.slot === endSlot) + 1;
908
- for (; startIndex < endIndex; startIndex++) {
909
- slots[startIndex].emphasize = true;
910
- }
762
+ };
763
+ this.emphasize = () => {
764
+ const selection = this.textbus.get(Selection);
765
+ const slots = this.state.slots;
766
+ const { startSlot, endSlot } = selection;
767
+ let startIndex = slots.findIndex(i => i.slot === startSlot);
768
+ const endIndex = slots.findIndex(i => i.slot === endSlot) + 1;
769
+ for (; startIndex < endIndex; startIndex++) {
770
+ slots[startIndex].emphasize = true;
911
771
  }
912
- });
772
+ };
913
773
  }
914
774
  static fromJSON(textbus, json) {
915
775
  const registry = textbus.get(Registry);
@@ -1081,67 +941,52 @@ class SourceCodeComponent extends Component {
1081
941
  });
1082
942
  }
1083
943
  }
1084
- Object.defineProperty(SourceCodeComponent, "type", {
1085
- enumerable: true,
1086
- configurable: true,
1087
- writable: true,
1088
- value: ContentType.BlockComponent
1089
- });
1090
- Object.defineProperty(SourceCodeComponent, "componentName", {
1091
- enumerable: true,
1092
- configurable: true,
1093
- writable: true,
1094
- value: 'SourceCodeComponent'
1095
- });
1096
- Object.defineProperty(SourceCodeComponent, "zenCoding", {
1097
- enumerable: true,
1098
- configurable: true,
1099
- writable: true,
1100
- value: {
1101
- key: 'Enter',
1102
- match(c) {
1103
- const matchString = languageList.map(i => i.label || i.value).concat('js', 'ts').join('|').replace(/\+/, '\\+');
1104
- const reg = new RegExp(`^\`\`\`(${matchString})$`, 'i');
1105
- return reg.test(c);
1106
- },
1107
- createState(content) {
1108
- const matchString = content.replace(/`/g, '').replace(/\+/, '\\+');
1109
- for (const item of languageList) {
1110
- const reg = new RegExp(`^${matchString}$`, 'i');
1111
- if (reg.test(item.label || item.value)) {
1112
- return {
1113
- lang: item.value,
1114
- theme: '',
1115
- lineNumber: true,
1116
- slots: [createCodeSlot()]
1117
- };
1118
- }
1119
- }
1120
- if (/^js$/i.test(matchString)) {
1121
- return {
1122
- lang: 'JavaScript',
1123
- theme: '',
1124
- lineNumber: true,
1125
- slots: [createCodeSlot()]
1126
- };
1127
- }
1128
- if (/^ts$/i.test(matchString)) {
944
+ SourceCodeComponent.type = ContentType.BlockComponent;
945
+ SourceCodeComponent.componentName = 'SourceCodeComponent';
946
+ SourceCodeComponent.zenCoding = {
947
+ key: 'Enter',
948
+ match(c) {
949
+ const matchString = languageList.map(i => i.label || i.value).concat('js', 'ts').join('|').replace(/\+/, '\\+');
950
+ const reg = new RegExp(`^\`\`\`(${matchString})$`, 'i');
951
+ return reg.test(c);
952
+ },
953
+ createState(content) {
954
+ const matchString = content.replace(/`/g, '').replace(/\+/, '\\+');
955
+ for (const item of languageList) {
956
+ const reg = new RegExp(`^${matchString}$`, 'i');
957
+ if (reg.test(item.label || item.value)) {
1129
958
  return {
1130
- lang: 'TypeScript',
959
+ lang: item.value,
1131
960
  theme: '',
1132
961
  lineNumber: true,
1133
962
  slots: [createCodeSlot()]
1134
963
  };
1135
964
  }
965
+ }
966
+ if (/^js$/i.test(matchString)) {
1136
967
  return {
1137
- lang: '',
968
+ lang: 'JavaScript',
1138
969
  theme: '',
1139
970
  lineNumber: true,
1140
971
  slots: [createCodeSlot()]
1141
972
  };
1142
973
  }
974
+ if (/^ts$/i.test(matchString)) {
975
+ return {
976
+ lang: 'TypeScript',
977
+ theme: '',
978
+ lineNumber: true,
979
+ slots: [createCodeSlot()]
980
+ };
981
+ }
982
+ return {
983
+ lang: '',
984
+ theme: '',
985
+ lineNumber: true,
986
+ slots: [createCodeSlot()]
987
+ };
1143
988
  }
1144
- });
989
+ };
1145
990
  function SourceCodeView(props) {
1146
991
  const adapter = inject(DomAdapter);
1147
992
  const isFocus = createSignal(false);
@@ -1233,7 +1078,7 @@ function SourceCodeView(props) {
1233
1078
  'xnote-source-code': true,
1234
1079
  'xnote-source-code-line-number': state.lineNumber,
1235
1080
  [state.theme || 'github']: true
1236
- }, lang: state.lang, "data-auto-break": state.autoBreak, "data-theme": state.theme || null, "data-line-number": state.lineNumber, children: [!readonly() || !output() && jsxs(ComponentToolbar, { visible: isFocus(), children: [jsx(ToolbarItem, { children: jsx(Dropdown, { onCheck: changeLang, trigger: 'hover', menu: languageList.map(item => {
1081
+ }, lang: state.lang, "data-auto-break": state.autoBreak, "data-theme": state.theme || null, "data-line-number": state.lineNumber, children: [(!readonly() || !output()) && jsxs(ComponentToolbar, { visible: isFocus(), children: [jsx(ToolbarItem, { children: jsx(Dropdown, { onCheck: changeLang, trigger: 'hover', menu: languageList.map(item => {
1237
1082
  return {
1238
1083
  label: jsx(MenuItem, { checked: state.lang === item.value, children: item.label || 'Plain Text' }),
1239
1084
  value: item.value
@@ -1473,7 +1318,7 @@ function AttrTool(props) {
1473
1318
  break;
1474
1319
  }
1475
1320
  }
1476
- return withScopedCSS(scopedId$b, () => {
1321
+ return withScopedCSS(css$b, () => {
1477
1322
  const states = checkStates();
1478
1323
  return (jsx(Dropdown, { style: props.style, abreast: props.abreast, onCheck: updateAttr, trigger: 'hover', menu: [
1479
1324
  {
@@ -1612,24 +1457,9 @@ class TableComponent extends Component {
1612
1457
  })
1613
1458
  }) {
1614
1459
  super(textbus, state);
1615
- Object.defineProperty(this, "selection", {
1616
- enumerable: true,
1617
- configurable: true,
1618
- writable: true,
1619
- value: this.textbus.get(Selection)
1620
- });
1621
- Object.defineProperty(this, "focus", {
1622
- enumerable: true,
1623
- configurable: true,
1624
- writable: true,
1625
- value: new Subject()
1626
- });
1627
- Object.defineProperty(this, "tableSelection", {
1628
- enumerable: true,
1629
- configurable: true,
1630
- writable: true,
1631
- value: createSignal(null)
1632
- });
1460
+ this.selection = this.textbus.get(Selection);
1461
+ this.focus = new Subject();
1462
+ this.tableSelection = createSignal(null);
1633
1463
  }
1634
1464
  setup() {
1635
1465
  onFocusIn(() => {
@@ -1754,21 +1584,8 @@ class TableComponent extends Component {
1754
1584
  });
1755
1585
  }
1756
1586
  }
1757
- Object.defineProperty(TableComponent, "componentName", {
1758
- enumerable: true,
1759
- configurable: true,
1760
- writable: true,
1761
- value: 'TableComponent'
1762
- });
1763
- Object.defineProperty(TableComponent, "type", {
1764
- enumerable: true,
1765
- configurable: true,
1766
- writable: true,
1767
- value: ContentType.BlockComponent
1768
- });
1769
-
1770
- var css_248z$k = ".xnote-todolist{align-items:center;display:flex;margin:8px 0}.xnote-todolist-icon{color:#296eff;cursor:pointer;margin-right:6px}.xnote-todolist-content[style*=text-indent]{text-indent:0!important}.xnote-todolist-content[style*=text-align]{text-align:left!important}";
1771
- styleInject(css_248z$k);
1587
+ TableComponent.componentName = 'TableComponent';
1588
+ TableComponent.type = ContentType.BlockComponent;
1772
1589
 
1773
1590
  const strikeThroughFormatter = new Formatter('strike', {
1774
1591
  columned: true,
@@ -1873,37 +1690,22 @@ class TodolistComponent extends Component {
1873
1690
  });
1874
1691
  }
1875
1692
  }
1876
- Object.defineProperty(TodolistComponent, "type", {
1877
- enumerable: true,
1878
- configurable: true,
1879
- writable: true,
1880
- value: ContentType.BlockComponent
1881
- });
1882
- Object.defineProperty(TodolistComponent, "componentName", {
1883
- enumerable: true,
1884
- configurable: true,
1885
- writable: true,
1886
- value: 'TodoListComponent'
1887
- });
1888
- Object.defineProperty(TodolistComponent, "zenCoding", {
1889
- enumerable: true,
1890
- configurable: true,
1891
- writable: true,
1892
- value: {
1893
- match: /^\[(x|\s)?\]$/,
1894
- key: ' ',
1895
- createState(content) {
1896
- const isChecked = content.charAt(1) === 'x';
1897
- return {
1898
- checked: isChecked,
1899
- slot: new Slot([
1900
- ContentType.InlineComponent,
1901
- ContentType.Text
1902
- ])
1903
- };
1904
- }
1693
+ TodolistComponent.type = ContentType.BlockComponent;
1694
+ TodolistComponent.componentName = 'TodoListComponent';
1695
+ TodolistComponent.zenCoding = {
1696
+ match: /^\[(x|\s)?\]$/,
1697
+ key: ' ',
1698
+ createState(content) {
1699
+ const isChecked = content.charAt(1) === 'x';
1700
+ return {
1701
+ checked: isChecked,
1702
+ slot: new Slot([
1703
+ ContentType.InlineComponent,
1704
+ ContentType.Text
1705
+ ])
1706
+ };
1905
1707
  }
1906
- });
1708
+ };
1907
1709
  function TodolistView(props) {
1908
1710
  const adapter = inject(DomAdapter);
1909
1711
  const component = props.component;
@@ -1957,9 +1759,6 @@ const todolistComponentLoader = {
1957
1759
  }
1958
1760
  };
1959
1761
 
1960
- var css_248z$j = ".xnote-blockquote{border-left:2px solid #296eff;margin:1em 0;padding:0 15px}.xnote-blockquote>:first-child{margin-top:0}.xnote-blockquote>:last-child{margin-bottom:0}";
1961
- styleInject(css_248z$j);
1962
-
1963
1762
  class BlockquoteComponent extends Component {
1964
1763
  static fromJSON(textbus, json) {
1965
1764
  const slot = textbus.get(Registry).createSlot(json.slot);
@@ -1980,36 +1779,21 @@ class BlockquoteComponent extends Component {
1980
1779
  useBlockContent(this.state.slot);
1981
1780
  }
1982
1781
  }
1983
- Object.defineProperty(BlockquoteComponent, "type", {
1984
- enumerable: true,
1985
- configurable: true,
1986
- writable: true,
1987
- value: ContentType.BlockComponent
1988
- });
1989
- Object.defineProperty(BlockquoteComponent, "componentName", {
1990
- enumerable: true,
1991
- configurable: true,
1992
- writable: true,
1993
- value: 'BlockquoteComponent'
1994
- });
1995
- Object.defineProperty(BlockquoteComponent, "zenCoding", {
1996
- enumerable: true,
1997
- configurable: true,
1998
- writable: true,
1999
- value: {
2000
- key: ' ',
2001
- match: /^>$/,
2002
- createState() {
2003
- return {
2004
- slot: new Slot([
2005
- ContentType.Text,
2006
- ContentType.InlineComponent,
2007
- ContentType.BlockComponent
2008
- ])
2009
- };
2010
- }
1782
+ BlockquoteComponent.type = ContentType.BlockComponent;
1783
+ BlockquoteComponent.componentName = 'BlockquoteComponent';
1784
+ BlockquoteComponent.zenCoding = {
1785
+ key: ' ',
1786
+ match: /^>$/,
1787
+ createState() {
1788
+ return {
1789
+ slot: new Slot([
1790
+ ContentType.Text,
1791
+ ContentType.InlineComponent,
1792
+ ContentType.BlockComponent
1793
+ ])
1794
+ };
2011
1795
  }
2012
- });
1796
+ };
2013
1797
  function BlockquoteView(props) {
2014
1798
  const adapter = inject(DomAdapter);
2015
1799
  const readonly = useReadonly();
@@ -2044,9 +1828,6 @@ const blockquoteComponentLoader = {
2044
1828
  },
2045
1829
  };
2046
1830
 
2047
- var css_248z$i = ".xnote-list{margin:8px 0;padding:0}.xnote-list>li{display:flex}.xnote-list-type{box-sizing:border-box;color:#296eff;text-align:left;text-indent:0;white-space:nowrap;width:24px}.xnote-order-btn{padding-left:5px}.xnote-list-content[style*=text-indent]{text-indent:0!important}.xnote-list-content[style*=text-align]{text-align:left!important}";
2048
- styleInject(css_248z$i);
2049
-
2050
1831
  class ListComponent extends Component {
2051
1832
  static fromJSON(textbus, json) {
2052
1833
  return new ListComponent(textbus, {
@@ -2129,37 +1910,22 @@ class ListComponent extends Component {
2129
1910
  });
2130
1911
  }
2131
1912
  }
2132
- Object.defineProperty(ListComponent, "componentName", {
2133
- enumerable: true,
2134
- configurable: true,
2135
- writable: true,
2136
- value: 'ListComponent'
2137
- });
2138
- Object.defineProperty(ListComponent, "type", {
2139
- enumerable: true,
2140
- configurable: true,
2141
- writable: true,
2142
- value: ContentType.BlockComponent
2143
- });
2144
- Object.defineProperty(ListComponent, "zenCoding", {
2145
- enumerable: true,
2146
- configurable: true,
2147
- writable: true,
2148
- value: {
2149
- key: ' ',
2150
- match: /^([1-9]\.|[+*])$/,
2151
- createState(content) {
2152
- return {
2153
- type: /[-+*]/.test(content) ? 'UnorderedList' : 'OrderedList',
2154
- reorder: true,
2155
- slot: new Slot([
2156
- ContentType.InlineComponent,
2157
- ContentType.Text
2158
- ])
2159
- };
2160
- }
1913
+ ListComponent.componentName = 'ListComponent';
1914
+ ListComponent.type = ContentType.BlockComponent;
1915
+ ListComponent.zenCoding = {
1916
+ key: ' ',
1917
+ match: /^([1-9]\.|[+*])$/,
1918
+ createState(content) {
1919
+ return {
1920
+ type: /[-+*]/.test(content) ? 'UnorderedList' : 'OrderedList',
1921
+ reorder: true,
1922
+ slot: new Slot([
1923
+ ContentType.InlineComponent,
1924
+ ContentType.Text
1925
+ ])
1926
+ };
2161
1927
  }
2162
- });
1928
+ };
2163
1929
  const step = 26;
2164
1930
  const chars = Array.from({ length: step }).map((_, index) => String.fromCharCode(96 + index + 1));
2165
1931
  function numberToLetter(num) {
@@ -2249,7 +2015,7 @@ function ListComponentView(props) {
2249
2015
  }, children: jsxs("li", { style: {
2250
2016
  justifyContent: align[component.state.slot.getAttribute(textAlignAttr)],
2251
2017
  textAlign: component.state.slot.getAttribute(textAlignAttr) === 'justify' ? 'justify' : void 0
2252
- }, children: [jsx("div", { class: "xnote-list-type", children: component.state.type === 'UnorderedList' || readonly() || output() ?
2018
+ }, children: [jsx("div", { class: "xnote-list-type", children: (component.state.type === 'UnorderedList' || readonly() || output()) ?
2253
2019
  jsx("span", { class: "xnote-order-btn", children: icon })
2254
2020
  :
2255
2021
  jsx(Dropdown, { menu: jsxs(Fragment, { children: [jsx(MenuItem, { onClick: () => reorder(false), children: "\u7EE7\u7EED\u7F16\u53F7" }), jsx(MenuItem, { onClick: () => reorder(true), children: "\u91CD\u65B0\u7F16\u53F7" })] }), children: jsx(Button, { style: { color: 'inherit' }, children: icon }) }) }), adapter.slotRender(component.state.slot, children => {
@@ -2351,9 +2117,6 @@ function useActiveBlock() {
2351
2117
  };
2352
2118
  }
2353
2119
 
2354
- var css_248z$h = ".xnote-highlight-box{background:#fcf5ce;border:1px solid #f5c774;border-radius:4px;display:flex;margin:16px 0}.xnote-highlight-box-left{padding-top:.65em;text-align:center;width:40px}.xnote-highlight-box-content{flex:1}.xnote-highlight-box-icon button{background:none;border:none;border-radius:4px;cursor:pointer;font-size:1.4em;height:30px;padding:0;width:30px}.xnote-highlight-box-icon button:hover{background:rgba(0,0,0,.1)}.xnote-highlight-box-icons{text-align:left}.xnote-highlight-box-icons button{background:none;border:none;border-radius:4px;cursor:pointer;font-size:24px;height:30px;padding:0;width:30px}.xnote-highlight-box-icons button:hover{background:rgba(0,0,0,.1)}.xnote-highlight-box-content{padding:5px}";
2355
- styleInject(css_248z$h);
2356
-
2357
2120
  class HighlightBoxComponent extends Component {
2358
2121
  static fromJSON(textbus, json) {
2359
2122
  return new HighlightBoxComponent(textbus, {
@@ -2375,24 +2138,9 @@ class HighlightBoxComponent extends Component {
2375
2138
  useBlockContent(this.state.slot);
2376
2139
  }
2377
2140
  }
2378
- Object.defineProperty(HighlightBoxComponent, "defaultTypes", {
2379
- enumerable: true,
2380
- configurable: true,
2381
- writable: true,
2382
- value: ['❤️', '💡', '📌', '✅', '❎', '👍', '🎉', '🚫', '❗']
2383
- });
2384
- Object.defineProperty(HighlightBoxComponent, "componentName", {
2385
- enumerable: true,
2386
- configurable: true,
2387
- writable: true,
2388
- value: 'HighlightBoxComponent'
2389
- });
2390
- Object.defineProperty(HighlightBoxComponent, "type", {
2391
- enumerable: true,
2392
- configurable: true,
2393
- writable: true,
2394
- value: ContentType.BlockComponent
2395
- });
2141
+ HighlightBoxComponent.defaultTypes = ['❤️', '💡', '📌', '✅', '❎', '👍', '🎉', '🚫', '❗'];
2142
+ HighlightBoxComponent.componentName = 'HighlightBoxComponent';
2143
+ HighlightBoxComponent.type = ContentType.BlockComponent;
2396
2144
  function HighlightBoxView(props) {
2397
2145
  const adapter = inject(DomAdapter);
2398
2146
  const readonly = useReadonly();
@@ -2664,7 +2412,7 @@ function useBlockTransform() {
2664
2412
  function BlockTool() {
2665
2413
  const checkStates = useActiveBlock();
2666
2414
  const transform = useBlockTransform();
2667
- return withScopedCSS(scopedId$b, () => {
2415
+ return withScopedCSS(css$b, () => {
2668
2416
  const states = checkStates();
2669
2417
  const types = [
2670
2418
  [states.paragraph, 'xnote-icon-pilcrow'],
@@ -3095,9 +2843,7 @@ function CodeTool() {
3095
2843
  };
3096
2844
  }
3097
2845
 
3098
- var css_248z$g = ".color-type[vf-1fbbdf]{font-size:13px;padding:5px 0}.text-colors[vf-1fbbdf]{font-size:14px;overflow:hidden}.text-colors div[vf-1fbbdf]{border:1px solid #eee;border-radius:4px;box-sizing:border-box;cursor:pointer;float:left;height:22px;line-height:20px;margin:4px 3px;text-align:center;width:22px}.text-colors div.active[vf-1fbbdf]{box-shadow:0 0 0 2px #296eff}.text-colors div[vf-1fbbdf]:hover{box-shadow:0 0 0 2px rgba(41,110,255,.188)}.background-colors[vf-1fbbdf]{font-size:14px;overflow:hidden}.background-colors div[vf-1fbbdf]{border-radius:4px;color:#fff;cursor:pointer;float:left;height:22px;line-height:22px;margin:4px 3px;text-align:center;width:22px}.background-colors div.active[vf-1fbbdf]{box-shadow:0 0 0 2px #296eff}.background-colors div[vf-1fbbdf]:hover{box-shadow:0 0 0 2px rgba(41,110,255,.188)}.background-colors .no-background[vf-1fbbdf]{border:1px solid #eee;box-sizing:border-box;overflow:hidden;position:relative}.background-colors .no-background[vf-1fbbdf]:before{background:#aaa;content:\"\";height:1px;left:-28px;position:absolute;top:0;transform:rotate(-45deg);width:100px}.background[vf-1fbbdf]{display:inline-block;height:1em;margin-right:6px;position:relative;text-align:center;width:1em}.background>span[vf-1fbbdf]{border-radius:4px;height:20px;left:-2px;line-height:20px;position:absolute;top:-2px;width:20px}";
3099
- var scopedId$a = "vf-1fbbdf";
3100
- styleInject(css_248z$g);
2846
+ var css$a = undefined;
3101
2847
 
3102
2848
  function ColorTool(props) {
3103
2849
  const query = inject(Query);
@@ -3145,7 +2891,7 @@ function ColorTool(props) {
3145
2891
  '#90a0e5',
3146
2892
  '#c596e0',
3147
2893
  ];
3148
- return withScopedCSS(scopedId$a, () => {
2894
+ return withScopedCSS(css$a, () => {
3149
2895
  const vm = viewModel();
3150
2896
  return (jsx(Dropdown, { style: props.style, abreast: props.abreast, trigger: 'hover', menu: jsxs("div", { children: [jsx("div", { class: "color-type", children: "\u6587\u5B57\u989C\u8272" }), jsxs("div", { class: "text-colors", children: [jsx("div", { class: {
3151
2897
  active: textColor() === ''
@@ -3353,9 +3099,7 @@ function ItalicTool() {
3353
3099
  };
3354
3100
  }
3355
3101
 
3356
- var css_248z$f = ".input-group[vf-269a0b]{display:flex;padding:5px 10px}.input-group input[vf-269a0b]{border:1px solid #ddd;border-radius:4px;margin-right:5px;padding:2px 6px}.input-group input[vf-269a0b]:focus{border-color:#296eff}.input-group button[vf-269a0b]{border:1px solid #ddd;border-radius:4px;font-size:14px}";
3357
- var scopedId$9 = "vf-269a0b";
3358
- styleInject(css_248z$f);
3102
+ var css$9 = undefined;
3359
3103
 
3360
3104
  function LinkTool(props) {
3361
3105
  const selectionBridge = inject(SelectionBridge);
@@ -3386,7 +3130,7 @@ function LinkTool(props) {
3386
3130
  onUnmounted(() => {
3387
3131
  sub.unsubscribe();
3388
3132
  });
3389
- return withScopedCSS(scopedId$9, () => {
3133
+ return withScopedCSS(css$9, () => {
3390
3134
  const containerRect = container.getBoundingClientRect();
3391
3135
  const rect = isShow() ? selectionBridge.getRect({
3392
3136
  slot: selection.focusSlot,
@@ -3455,9 +3199,7 @@ function UnderlineTool() {
3455
3199
  };
3456
3200
  }
3457
3201
 
3458
- var css_248z$e = ".btn-group[vf-cf8e1c]{font-size:15px;padding:5px 0;text-align:center}.btn-group button[vf-cf8e1c]{margin:2px 5px}";
3459
- var scopedId$8 = "vf-cf8e1c";
3460
- styleInject(css_248z$e);
3202
+ var css$8 = undefined;
3461
3203
 
3462
3204
  function InsertTool(props) {
3463
3205
  const commander = inject(Commander);
@@ -3561,14 +3303,12 @@ function InsertTool(props) {
3561
3303
  break;
3562
3304
  }
3563
3305
  }
3564
- return withScopedCSS(scopedId$8, () => {
3306
+ return withScopedCSS(css$8, () => {
3565
3307
  return jsxs(Fragment, { children: [jsxs("div", { class: "btn-group", children: [jsx(Button, { ordinary: true, onClick: () => insert('paragraph'), children: jsx("span", { class: "xnote-icon-pilcrow" }) }), jsx(Button, { ordinary: true, onClick: () => insert('h1'), children: jsx("span", { class: "xnote-icon-heading-h1" }) }), jsx(Button, { ordinary: true, onClick: () => insert('h2'), children: jsx("span", { class: "xnote-icon-heading-h2" }) }), jsx(Button, { ordinary: true, onClick: () => insert('h3'), children: jsx("span", { class: "xnote-icon-heading-h3" }) }), jsx(Button, { ordinary: true, onClick: () => insert('h4'), children: jsx("span", { class: "xnote-icon-heading-h4" }) }), jsx(Button, { ordinary: true, onClick: () => insert('h5'), children: jsx("span", { class: "xnote-icon-heading-h5" }) }), jsx(Button, { ordinary: true, onClick: () => insert('h6'), children: jsx("span", { class: "xnote-icon-heading-h6" }) }), jsx(Button, { ordinary: true, onClick: () => insert('ol'), children: jsx("span", { class: "xnote-icon-list-numbered" }) }), jsx(Button, { ordinary: true, onClick: () => insert('ul'), children: jsx("span", { class: "xnote-icon-list" }) }), jsx(Button, { ordinary: true, onClick: () => insert('sourceCode'), children: jsx("span", { class: "xnote-icon-source-code" }) })] }), jsx(Divider, {}), jsx(MenuItem, { onClick: () => insert('table'), icon: jsx("span", { class: "xnote-icon-table" }), children: "\u8868\u683C" }), jsx(MenuItem, { onClick: () => insert('todolist'), icon: jsx("span", { class: "xnote-icon-checkbox-checked" }), children: "\u5F85\u529E\u5217\u8868" }), jsx(MenuItem, { onClick: () => insert('image'), icon: jsx("span", { class: "xnote-icon-image" }), children: "\u56FE\u7247" }), jsx(MenuItem, { onClick: () => insert('video'), icon: jsx("span", { class: "xnote-icon-video" }), children: "\u89C6\u9891" }), jsx(MenuItem, { onClick: () => insert('highlightBox'), icon: jsx("span", { class: "xnote-icon-warning" }), children: "\u9AD8\u4EAE\u5757" })] });
3566
3308
  });
3567
3309
  }
3568
3310
 
3569
- var css_248z$d = ".left-toolbar[vf-b05292]{font-size:15px;left:-10px;position:absolute;top:0;z-index:10}.left-toolbar-btn-wrap[vf-b05292]{position:absolute;transition:all .2s}.left-toolbar-btn[vf-b05292]{background:#fff;border:1px solid #ddd;border-radius:5px;cursor:pointer;height:26px}.left-toolbar-btn span[vf-b05292]{align-items:center;display:inline-flex}.btn-group[vf-b05292]{font-size:15px;padding:5px 0;text-align:center}.btn-group button[vf-b05292]{margin:2px 5px}";
3570
- var scopedId$7 = "vf-b05292";
3571
- styleInject(css_248z$d);
3311
+ var css$7 = undefined;
3572
3312
 
3573
3313
  const LeftToolbar = withAnnotation({
3574
3314
  providers: [RefreshService]
@@ -3727,7 +3467,7 @@ const LeftToolbar = withAnnotation({
3727
3467
  }
3728
3468
  }
3729
3469
  const isEmptyBlock = createSignal(true);
3730
- return withScopedCSS(scopedId$7, () => {
3470
+ return withScopedCSS(css$7, () => {
3731
3471
  const position = positionSignal();
3732
3472
  const slot = activeSlot();
3733
3473
  let activeNode = jsx("span", { class: "xnote-icon-pilcrow" });
@@ -3772,12 +3512,7 @@ const LeftToolbar = withAnnotation({
3772
3512
 
3773
3513
  class LeftToolbarPlugin {
3774
3514
  constructor() {
3775
- Object.defineProperty(this, "app", {
3776
- enumerable: true,
3777
- configurable: true,
3778
- writable: true,
3779
- value: null
3780
- });
3515
+ this.app = null;
3781
3516
  }
3782
3517
  setup(injector) {
3783
3518
  const App = function () {
@@ -3803,18 +3538,11 @@ class LeftToolbarPlugin {
3803
3538
  }
3804
3539
  }
3805
3540
 
3806
- var css_248z$c = ".toolbar[vf-fee98b]{background:#fff;border:1px solid #dee0e3;border-radius:5px;box-shadow:0 4px 8px rgba(0,0,0,.08);box-sizing:border-box;display:flex;font-size:13px;height:36px;opacity:0;padding:0 6px;pointer-events:none;position:absolute;text-align:left;transform:translateX(-50%);transition-duration:.4s;transition-property:all;transition-timing-function:ease;z-index:3}";
3807
- var scopedId$6 = "vf-fee98b";
3808
- styleInject(css_248z$c);
3541
+ var css$6 = undefined;
3809
3542
 
3810
3543
  let EditorService = class EditorService {
3811
3544
  constructor() {
3812
- Object.defineProperty(this, "hideInlineToolbar", {
3813
- enumerable: true,
3814
- configurable: true,
3815
- writable: true,
3816
- value: false
3817
- });
3545
+ this.hideInlineToolbar = false;
3818
3546
  }
3819
3547
  };
3820
3548
  EditorService = __decorate([
@@ -3920,7 +3648,7 @@ const Toolbar = withAnnotation({
3920
3648
  mousedownSubscription.unsubscribe();
3921
3649
  mouseupSubscription.unsubscribe();
3922
3650
  });
3923
- return withScopedCSS(scopedId$6, () => {
3651
+ return withScopedCSS(css$6, () => {
3924
3652
  const p = viewPosition();
3925
3653
  return (jsxs("div", { class: "toolbar", ref: toolbarRef, style: {
3926
3654
  left: p.left + 'px',
@@ -3935,12 +3663,7 @@ const Toolbar = withAnnotation({
3935
3663
 
3936
3664
  class ToolbarPlugin {
3937
3665
  constructor() {
3938
- Object.defineProperty(this, "app", {
3939
- enumerable: true,
3940
- configurable: true,
3941
- writable: true,
3942
- value: null
3943
- });
3666
+ this.app = null;
3944
3667
  }
3945
3668
  setup(injector) {
3946
3669
  const App = function () {
@@ -3965,30 +3688,10 @@ class ToolbarPlugin {
3965
3688
 
3966
3689
  class Matcher {
3967
3690
  constructor(target, rule) {
3968
- Object.defineProperty(this, "target", {
3969
- enumerable: true,
3970
- configurable: true,
3971
- writable: true,
3972
- value: target
3973
- });
3974
- Object.defineProperty(this, "rule", {
3975
- enumerable: true,
3976
- configurable: true,
3977
- writable: true,
3978
- value: rule
3979
- });
3980
- Object.defineProperty(this, "validators", {
3981
- enumerable: true,
3982
- configurable: true,
3983
- writable: true,
3984
- value: []
3985
- });
3986
- Object.defineProperty(this, "excludeValidators", {
3987
- enumerable: true,
3988
- configurable: true,
3989
- writable: true,
3990
- value: []
3991
- });
3691
+ this.target = target;
3692
+ this.rule = rule;
3693
+ this.validators = [];
3694
+ this.excludeValidators = [];
3992
3695
  if (rule.tags) {
3993
3696
  this.validators.push(this.makeTagsMatcher(rule.tags));
3994
3697
  }
@@ -4080,26 +3783,13 @@ class Matcher {
4080
3783
  }
4081
3784
  }
4082
3785
 
4083
- var css_248z$b = ".xnote-image{display:inline-block}.xnote-image,.xnote-image img{max-width:100%}";
4084
- styleInject(css_248z$b);
4085
-
4086
3786
  class ImageComponent extends Component {
4087
3787
  static fromJSON(textbus, json) {
4088
3788
  return new ImageComponent(textbus, Object.assign({}, json));
4089
3789
  }
4090
3790
  }
4091
- Object.defineProperty(ImageComponent, "type", {
4092
- enumerable: true,
4093
- configurable: true,
4094
- writable: true,
4095
- value: ContentType.InlineComponent
4096
- });
4097
- Object.defineProperty(ImageComponent, "componentName", {
4098
- enumerable: true,
4099
- configurable: true,
4100
- writable: true,
4101
- value: 'ImageComponent'
4102
- });
3791
+ ImageComponent.type = ContentType.InlineComponent;
3792
+ ImageComponent.componentName = 'ImageComponent';
4103
3793
  function ImageView(props) {
4104
3794
  const { name, state } = props.component;
4105
3795
  const imageRef = createRef();
@@ -4130,18 +3820,10 @@ const imageComponentLoader = {
4130
3820
  }
4131
3821
  };
4132
3822
 
4133
- var css_248z$a = ".xnote-root{color:#1f2329}.xnote-root * ::selection{background:rgba(20,99,252,.34)}.xnote-title{font-size:30px;font-weight:600;margin:36px 0 22px}.xnote-title:before{content:attr(data-placeholder);opacity:.5;position:absolute}.xnote-content{font-size:16px;line-height:1.65}.xnote-content:before{content:attr(data-placeholder);opacity:.5;position:absolute}";
4134
- styleInject(css_248z$a);
4135
-
4136
3823
  class RootComponent extends Component {
4137
3824
  constructor() {
4138
3825
  super(...arguments);
4139
- Object.defineProperty(this, "onCompositionStart", {
4140
- enumerable: true,
4141
- configurable: true,
4142
- writable: true,
4143
- value: new Subject()
4144
- });
3826
+ this.onCompositionStart = new Subject();
4145
3827
  }
4146
3828
  static fromJSON(textbus, json) {
4147
3829
  const heading = textbus.get(Registry).createSlot(json.heading);
@@ -4184,18 +3866,8 @@ class RootComponent extends Component {
4184
3866
  content.insert(new ParagraphComponent(this.textbus));
4185
3867
  }
4186
3868
  }
4187
- Object.defineProperty(RootComponent, "componentName", {
4188
- enumerable: true,
4189
- configurable: true,
4190
- writable: true,
4191
- value: 'RootComponent'
4192
- });
4193
- Object.defineProperty(RootComponent, "type", {
4194
- enumerable: true,
4195
- configurable: true,
4196
- writable: true,
4197
- value: ContentType.BlockComponent
4198
- });
3869
+ RootComponent.componentName = 'RootComponent';
3870
+ RootComponent.type = ContentType.BlockComponent;
4199
3871
  function RootView(props) {
4200
3872
  const adapter = inject(DomAdapter);
4201
3873
  const { heading, content } = props.component.state;
@@ -4253,45 +3925,15 @@ const rootComponentLoader = {
4253
3925
  }
4254
3926
  };
4255
3927
 
4256
- var css_248z$9 = ".xnote-table{margin-bottom:16px;margin-top:16px;position:relative}.xnote-table-content{border-collapse:collapse;border-spacing:0}.xnote-table-content.hide-selection * ::selection{background:none}.xnote-table-content td{border:1px solid #ddd;padding:0 10px}.xnote-table-container,.xnote-table-wrapper{position:relative}.xnote-table-delete-btn{background:#eee;border:none;border-radius:4px;color:#5c6370;cursor:pointer;height:30px;line-height:30px;width:24px}.xnote-table-delete-btn:hover{color:#333}";
4257
- styleInject(css_248z$9);
4258
-
4259
- var css_248z$8 = ".drag-line[vf-681de2]{border-color:transparent;border-style:solid;border-width:0 5px;bottom:0;box-sizing:content-box;cursor:col-resize;display:none;margin-left:-5px;position:absolute;top:0;width:2px}.drag-line[vf-681de2]:before{background:#296eff;content:\"\";inset:0;position:absolute}";
4260
- var scopedId$5 = "vf-681de2";
4261
- styleInject(css_248z$8);
3928
+ var css$5 = undefined;
4262
3929
 
4263
3930
  let TableService = class TableService {
4264
3931
  constructor() {
4265
- Object.defineProperty(this, "onInsertRowBefore", {
4266
- enumerable: true,
4267
- configurable: true,
4268
- writable: true,
4269
- value: new Subject()
4270
- });
4271
- Object.defineProperty(this, "onInsertColumnBefore", {
4272
- enumerable: true,
4273
- configurable: true,
4274
- writable: true,
4275
- value: new Subject()
4276
- });
4277
- Object.defineProperty(this, "onSelectColumns", {
4278
- enumerable: true,
4279
- configurable: true,
4280
- writable: true,
4281
- value: new Subject()
4282
- });
4283
- Object.defineProperty(this, "onSelectRows", {
4284
- enumerable: true,
4285
- configurable: true,
4286
- writable: true,
4287
- value: new Subject()
4288
- });
4289
- Object.defineProperty(this, "onScroll", {
4290
- enumerable: true,
4291
- configurable: true,
4292
- writable: true,
4293
- value: new Subject()
4294
- });
3932
+ this.onInsertRowBefore = new Subject();
3933
+ this.onInsertColumnBefore = new Subject();
3934
+ this.onSelectColumns = new Subject();
3935
+ this.onSelectRows = new Subject();
3936
+ this.onScroll = new Subject();
4295
3937
  }
4296
3938
  };
4297
3939
  TableService = __decorate([
@@ -4370,14 +4012,12 @@ function ResizeColumn(props) {
4370
4012
  });
4371
4013
  return () => sub.unsubscribe();
4372
4014
  });
4373
- return withScopedCSS(scopedId$5, () => {
4015
+ return withScopedCSS(css$5, () => {
4374
4016
  return jsx("div", { ref: dragLineRef, class: ['drag-line'] });
4375
4017
  });
4376
4018
  }
4377
4019
 
4378
- var css_248z$7 = ".top-bar[vf-5bce97]{display:none;left:0;position:absolute;right:0;top:0}.top-bar.active[vf-5bce97]{display:block}.top-delete-toolbar[vf-5bce97]{height:0;position:relative;top:-10px}.toolbar-wrapper[vf-5bce97]{height:60px;left:0;pointer-events:none;position:absolute;right:0;top:-60px}.insert-bar[vf-5bce97]{height:30px;margin-left:-10px;margin-right:-10px;overflow:hidden;padding-left:10px;padding-right:10px;padding-top:30px}.insert-bar table[vf-5bce97]{border-collapse:collapse;border-spacing:0;position:relative;table-layout:fixed;z-index:1}.insert-bar table td[vf-5bce97]{border:1px solid transparent;box-sizing:border-box;height:18px;position:relative}.insert-bar table .tool-container[vf-5bce97]{height:18px}.insert-bar table .tool-container>div[vf-5bce97],.insert-bar table .tool-container>span[vf-5bce97]{pointer-events:auto}.insert-bar table .insert-btn-wrap[vf-5bce97]{cursor:pointer;height:21px;position:absolute;right:-11px;top:-2px;width:21px;z-index:1}.insert-bar table .insert-btn-wrap .insert-btn[vf-5bce97]{background:#ccc;border:none;border-radius:50%;box-shadow:none;color:#fff;cursor:inherit;font-size:16px;height:100%;line-height:20px;padding:0;position:relative;text-align:center;transform:scale(.2);transition:transform .15s;width:100%}.insert-bar table .insert-btn-wrap .insert-btn[vf-5bce97]:after{background:inherit;content:\"\";height:10px;left:5.5px;position:absolute;top:12px;transform:rotate(45deg);width:10px;z-index:-1}.insert-bar table .insert-btn-wrap:hover .insert-btn[vf-5bce97]{background:#296eff;transform:scale(1)}.action-bar[vf-5bce97]{margin-top:-12px;overflow:hidden;pointer-events:auto;position:relative;z-index:0}.action-bar.active[vf-5bce97]{display:block}.action-bar table[vf-5bce97]{border-collapse:collapse;border-spacing:0;overflow:hidden;table-layout:fixed}.action-bar table td[vf-5bce97]{background:#eee;border:1px solid #ddd;box-sizing:border-box;cursor:pointer;height:12px;position:relative}.action-bar table td[vf-5bce97]:hover{background:#dedede}.action-bar table td.active[vf-5bce97]{background:#296eff;border-color:#2358c9}.action-bar table td.active[vf-5bce97]:before{border-color:inherit;border-style:solid;border-width:0 0 0 1px;bottom:0;content:\"\";left:-1px;position:absolute;top:-1px}";
4379
- var scopedId$4 = "vf-5bce97";
4380
- styleInject(css_248z$7);
4020
+ var css$4 = undefined;
4381
4021
 
4382
4022
  function TopBar(props) {
4383
4023
  const editorService = inject(EditorService);
@@ -4445,7 +4085,7 @@ function TopBar(props) {
4445
4085
  s.unsubscribe();
4446
4086
  });
4447
4087
  const deleteIndex = createSignal(null);
4448
- return withScopedCSS(scopedId$4, () => {
4088
+ return withScopedCSS(css$4, () => {
4449
4089
  const { state, tableSelection } = props.component;
4450
4090
  const position = tableSelection();
4451
4091
  return (jsx("div", { class: ['top-bar', {
@@ -4498,9 +4138,7 @@ function TopBar(props) {
4498
4138
  });
4499
4139
  }
4500
4140
 
4501
- var css_248z$6 = ".scroll-container[vf-b1149b]{overflow-y:auto}.scroll-container[vf-b1149b]:before{background-image:linear-gradient(90deg,rgba(0,0,0,.1),transparent);border-left:1px solid #ddd;left:0}.scroll-container[vf-b1149b]:after,.scroll-container[vf-b1149b]:before{bottom:0;content:\"\";pointer-events:none;position:absolute;top:0;width:12px}.scroll-container[vf-b1149b]:after{background:linear-gradient(90deg,transparent,rgba(0,0,0,.1));border-right:1px solid #ddd;right:0}.scroll-container.left-end[vf-b1149b]:before,.scroll-container.right-end[vf-b1149b]:after{display:none}";
4502
- var scopedId$3 = "vf-b1149b";
4503
- styleInject(css_248z$6);
4141
+ var css$3 = undefined;
4504
4142
 
4505
4143
  function Scroll(props) {
4506
4144
  const scrollRef = createRef();
@@ -4532,7 +4170,7 @@ function Scroll(props) {
4532
4170
  draft.rightEnd = el.scrollLeft === el.scrollWidth - el.offsetWidth;
4533
4171
  });
4534
4172
  });
4535
- return withScopedCSS(scopedId$3, () => {
4173
+ return withScopedCSS(css$3, () => {
4536
4174
  return jsx("div", { ref: [scrollRef, props.scrollRef], class: ['scroll-container', {
4537
4175
  'left-end': showShadow().leftEnd,
4538
4176
  'right-end': showShadow().rightEnd,
@@ -4544,9 +4182,7 @@ function Scroll(props) {
4544
4182
  });
4545
4183
  }
4546
4184
 
4547
- var css_248z$5 = ".left-bar[vf-ef93c0]{display:none;left:0;margin-left:-30px;position:absolute;top:0;width:30px}.left-bar.active[vf-ef93c0]{display:flex}.toolbar-item[vf-ef93c0]{align-items:center;display:flex;inset:0;position:absolute}.insert-bar[vf-ef93c0]{width:18px}.insert-bar table[vf-ef93c0]{border-collapse:collapse;border-spacing:0;table-layout:fixed}.insert-bar table td[vf-ef93c0]{border:1px solid transparent;position:relative}.insert-bar table .insert-btn-wrap[vf-ef93c0]{bottom:-8px;cursor:pointer;height:21px;left:0;position:absolute;width:21px;z-index:1}.insert-bar table .insert-btn-wrap .insert-btn[vf-ef93c0]{background:#ccc;border:none;border-radius:50%;box-shadow:none;color:#fff;cursor:inherit;font-size:16px;height:100%;line-height:20px;padding:0;position:relative;text-align:center;transform:scale(.2);transition:transform .15s;width:100%}.insert-bar table .insert-btn-wrap .insert-btn[vf-ef93c0]:after{background:inherit;content:\"\";height:10px;left:11px;position:absolute;top:5.5px;transform:rotate(45deg);width:10px;z-index:-1}.insert-bar table .insert-btn-wrap:hover .insert-btn[vf-ef93c0]{background:#296eff;transform:scale(1)}.action-bar[vf-ef93c0]{width:12px}.action-bar table[vf-ef93c0]{border-collapse:collapse;border-spacing:0;table-layout:fixed;width:13px}.action-bar table td[vf-ef93c0]{background:#eee;border:1px solid #ddd;box-sizing:border-box;cursor:pointer;height:12px;position:relative}.action-bar table td[vf-ef93c0]:hover{background:#dedede}.action-bar table td.active[vf-ef93c0]{background:#296eff;border-color:#2358c9}.action-bar table td.active[vf-ef93c0]:before{border-color:inherit;border-style:solid;border-width:1px 0 0;content:\"\";left:-1px;position:absolute;right:-1px;top:-1px}";
4548
- var scopedId$2 = "vf-ef93c0";
4549
- styleInject(css_248z$5);
4185
+ var css$2 = undefined;
4550
4186
 
4551
4187
  function LeftBar(props) {
4552
4188
  const editorService = inject(EditorService);
@@ -4620,7 +4256,7 @@ function LeftBar(props) {
4620
4256
  textbus.focus();
4621
4257
  });
4622
4258
  }
4623
- return withScopedCSS(scopedId$2, () => {
4259
+ return withScopedCSS(css$2, () => {
4624
4260
  const { state, tableSelection } = props.component;
4625
4261
  const position = tableSelection();
4626
4262
  return (jsxs("div", { class: ['left-bar', { active: props.isFocus() }], children: [jsx("div", { class: "insert-bar", children: jsx("table", { ref: insertBarRef, children: jsx("tbody", { children: state.rows.map((_, index) => {
@@ -4668,9 +4304,7 @@ function LeftBar(props) {
4668
4304
  });
4669
4305
  }
4670
4306
 
4671
- var css_248z$4 = ".drag-line[vf-d4c4a9]{background:#296eff;contain:layout size style;height:2px;left:0;max-width:100%;position:absolute;right:0;z-index:1}";
4672
- var scopedId$1 = "vf-d4c4a9";
4673
- styleInject(css_248z$4);
4307
+ var css$1 = undefined;
4674
4308
 
4675
4309
  function sum(numbers) {
4676
4310
  return numbers.reduce((a, b) => a + b, 0);
@@ -4703,7 +4337,7 @@ function ResizeRow(props) {
4703
4337
  });
4704
4338
  return () => sub.unsubscribe();
4705
4339
  });
4706
- return withScopedCSS(scopedId$1, () => {
4340
+ return withScopedCSS(css$1, () => {
4707
4341
  return jsx("div", { ref: dragLineRef, style: {
4708
4342
  display: styles().visible ? 'block' : 'none',
4709
4343
  top: styles().top + 'px',
@@ -4712,9 +4346,7 @@ function ResizeRow(props) {
4712
4346
  });
4713
4347
  }
4714
4348
 
4715
- var css_248z$3 = ".mask[vf-e16878]{background:rgba(41,110,255,.063);border:1px solid #296eff;display:none;pointer-events:none;position:absolute}.mask.active[vf-e16878]{display:block}";
4716
- var scopedId = "vf-e16878";
4717
- styleInject(css_248z$3);
4349
+ var css = undefined;
4718
4350
 
4719
4351
  function SelectionMask(props) {
4720
4352
  const [styles, updateStyles] = useProduce({
@@ -4767,7 +4399,7 @@ function SelectionMask(props) {
4767
4399
  onUnmounted(() => {
4768
4400
  s.unsubscribe();
4769
4401
  });
4770
- return withScopedCSS(scopedId, () => {
4402
+ return withScopedCSS(css, () => {
4771
4403
  const style = styles();
4772
4404
  return (jsx("div", { class: "mask", style: {
4773
4405
  display: style.visible ? 'block' : 'none',
@@ -5065,9 +4697,6 @@ function autoComplete(table) {
5065
4697
  });
5066
4698
  }
5067
4699
 
5068
- var css_248z$2 = ".xnote-video{display:inline-block}.xnote-video,.xnote-video video{max-width:100%}";
5069
- styleInject(css_248z$2);
5070
-
5071
4700
  class VideoComponent extends Component {
5072
4701
  static fromJSON(textbus, json) {
5073
4702
  return new VideoComponent(textbus, Object.assign({}, json));
@@ -5076,18 +4705,8 @@ class VideoComponent extends Component {
5076
4705
  //
5077
4706
  }
5078
4707
  }
5079
- Object.defineProperty(VideoComponent, "type", {
5080
- enumerable: true,
5081
- configurable: true,
5082
- writable: true,
5083
- value: ContentType.InlineComponent
5084
- });
5085
- Object.defineProperty(VideoComponent, "componentName", {
5086
- enumerable: true,
5087
- configurable: true,
5088
- writable: true,
5089
- value: 'VideoComponent'
5090
- });
4708
+ VideoComponent.type = ContentType.InlineComponent;
4709
+ VideoComponent.componentName = 'VideoComponent';
5091
4710
  function VideoView(props) {
5092
4711
  const { name, state } = props.component;
5093
4712
  const videoRef = createRef();
@@ -5118,15 +4737,9 @@ const videoComponentLoader = {
5118
4737
  }
5119
4738
  };
5120
4739
 
5121
- var css_248z$1 = "@font-face{font-display:block;font-family:textbus;font-style:normal;font-weight:400;src:url(fonts/textbus.ttf?fw0xu0) format(\"truetype\"),url(fonts/textbus.woff?fw0xu0) format(\"woff\"),url(fonts/textbus.svg?fw0xu0#textbus) format(\"svg\")}[class*=\" xnote-icon-\"],[class^=xnote-icon-]{speak:never;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:textbus!important;font-style:normal;font-variant:normal;font-weight:400;line-height:1;text-transform:none}.xnote-icon-heading-h1:before{content:\"\\e925\"}.xnote-icon-heading-h2:before{content:\"\\e926\"}.xnote-icon-heading-h3:before{content:\"\\e927\"}.xnote-icon-heading-h4:before{content:\"\\e928\"}.xnote-icon-heading-h5:before{content:\"\\e929\"}.xnote-icon-heading-h6:before{content:\"\\e92a\"}.xnote-icon-heading:before{content:\"\\e92b\"}.xnote-icon-more:before{content:\"\\e921\"}.xnote-icon-text-wrap:before{content:\"\\e924\"}.xnote-icon-checkmark:before{content:\"\\e922\"}.xnote-icon-arrow-left:before{content:\"\\e900\"}.xnote-icon-arrow-right:before{content:\"\\e901\"}.xnote-icon-arrow-top:before{content:\"\\e902\"}.xnote-icon-arrow-bottom:before{content:\"\\e903\"}.xnote-icon-source-code:before{content:\"\\e904\"}.xnote-icon-insert-paragraph-after:before{content:\"\\e905\"}.xnote-icon-insert-paragraph-before:before{content:\"\\e906\"}.xnote-icon-components:before{content:\"\\e907\"}.xnote-icon-table-border:before{content:\"\\e908\"}.xnote-icon-table-remove:before{content:\"\\e909\"}.xnote-icon-device:before{content:\"\\e90a\"}.xnote-icon-paint-bucket:before{content:\"\\e90b\"}.xnote-icon-background-color:before{content:\"\\e90c\"}.xnote-icon-color:before{content:\"\\e90d\"}.xnote-icon-brush:before{content:\"\\e90e\"}.xnote-icon-table-edit:before{content:\"\\e90f\"}.xnote-icon-table-split-columns:before{content:\"\\e910\"}.xnote-icon-table-delete-row-top:before{content:\"\\e911\"}.xnote-icon-table-delete-row-bottom:before{content:\"\\e912\"}.xnote-icon-table-delete-column-right:before{content:\"\\e913\"}.xnote-icon-table-delete-column-left:before{content:\"\\e914\"}.xnote-icon-table-add-row-top:before{content:\"\\e915\"}.xnote-icon-table-add-row-bottom:before{content:\"\\e916\"}.xnote-icon-table-add-column-right:before{content:\"\\e917\"}.xnote-icon-table-add-column-left:before{content:\"\\e918\"}.xnote-icon-image:before{content:\"\\e919\"}.xnote-icon-text-indent:before{content:\"\\e91a\"}.xnote-icon-music:before{content:\"\\e91b\"}.xnote-icon-video:before{content:\"\\e91c\"}.xnote-icon-unlink:before{content:\"\\e91d\"}.xnote-icon-select:before{content:\"\\e91e\"}.xnote-icon-tree:before{content:\"\\e91f\"}.xnote-icon-setting:before{content:\"\\e920\"}.xnote-icon-copy:before{content:\"\\e92c\"}.xnote-icon-paste:before{content:\"\\e92d\"}.xnote-icon-pushpin:before{content:\"\\e946\"}.xnote-icon-upload:before{content:\"\\e961\"}.xnote-icon-history-back:before{content:\"\\e967\"}.xnote-icon-history-forward:before{content:\"\\e968\"}.xnote-icon-quotes-right:before{content:\"\\e978\"}.xnote-icon-loading:before{content:\"\\e97f\"}.xnote-icon-search:before{content:\"\\e986\"}.xnote-icon-enlarge:before{content:\"\\e989\"}.xnote-icon-shrink:before{content:\"\\e98a\"}.xnote-icon-bin:before{content:\"\\e9ac\"}.xnote-icon-list-numbered:before{content:\"\\e9b9\"}.xnote-icon-list:before{content:\"\\e9bb\"}.xnote-icon-link:before{content:\"\\e9cb\"}.xnote-icon-emoji:before{content:\"\\e9e2\"}.xnote-icon-plus:before{content:\"\\ea0a\"}.xnote-icon-command:before{content:\"\\ea4e\"}.xnote-icon-shift:before{content:\"\\ea4f\"}.xnote-icon-ctrl:before{content:\"\\ea50\"}.xnote-icon-opt:before{content:\"\\ea51\"}.xnote-icon-cut:before{content:\"\\ea5a\"}.xnote-icon-line-height:before{content:\"\\ea5f\"}.xnote-icon-letter-spacing:before{content:\"\\ea60\"}.xnote-icon-font-size:before{content:\"\\ea61\"}.xnote-icon-bold:before{content:\"\\ea62\"}.xnote-icon-underline:before{content:\"\\ea63\"}.xnote-icon-italic:before{content:\"\\ea64\"}.xnote-icon-strikethrough:before{content:\"\\ea65\"}.xnote-icon-superscript:before{content:\"\\ea69\"}.xnote-icon-subscript:before{content:\"\\ea6a\"}.xnote-icon-clear-formatting:before{content:\"\\ea6f\"}.xnote-icon-table:before{content:\"\\ea71\"}.xnote-icon-ltr:before{content:\"\\ea74\"}.xnote-icon-rtl:before{content:\"\\ea75\"}.xnote-icon-code:before{content:\"\\ea80\"}.xnote-icon-terminal:before{content:\"\\ea81\"}.xnote-icon-bullhorn:before{content:\"\\e923\"}.xnote-icon-price-tag:before{content:\"\\e935\"}.xnote-icon-pushpin1:before{content:\"\\e947\"}.xnote-icon-warning:before{content:\"\\ea07\"}.xnote-icon-notification:before{content:\"\\ea08\"}.xnote-icon-question:before{content:\"\\ea09\"}.xnote-icon-info:before{content:\"\\ea0c\"}.xnote-icon-cancel-circle:before{content:\"\\ea0d\"}.xnote-icon-blocked:before{content:\"\\ea0e\"}.xnote-icon-checkbox-checked:before{content:\"\\ea52\"}.xnote-icon-checkbox-unchecked:before{content:\"\\ea53\"}.xnote-icon-pilcrow:before{content:\"\\ea73\"}.xnote-icon-paragraph-left:before{content:\"\\ea77\"}.xnote-icon-paragraph-center:before{content:\"\\ea78\"}.xnote-icon-paragraph-right:before{content:\"\\ea79\"}.xnote-icon-paragraph-justify:before{content:\"\\ea7a\"}.xnote-icon-indent-increase:before{content:\"\\ea7b\"}.xnote-icon-indent-decrease:before{content:\"\\ea7c\"}";
5122
- styleInject(css_248z$1);
5123
-
5124
- var css_248z = ".xnote-h1{font-size:2.2em;font-weight:600}.xnote-h2{font-size:1.8em;font-weight:600}.xnote-h3{font-size:1.4em;font-weight:600}.xnote-h4{font-size:1em;font-weight:600}.xnote-h5{font-size:.9em;font-weight:600}.xnote-h6{font-size:.8em;font-weight:600}.xnote-code{border:1px solid rgba(0,0,0,.2);border-radius:4px;font-family:Microsoft YaHei Mono,Menlo,Monaco,Consolas,Courier New,monospace;margin:0 3px;padding:2px 3px}";
5125
- styleInject(css_248z);
5126
-
5127
- function createXNote(host, config = {}) {
5128
- return __awaiter(this, void 0, void 0, function* () {
5129
- const adapter = new Adapter({
4740
+ function createXNote(host_1) {
4741
+ return __awaiter(this, arguments, void 0, function* (host, config = {}) {
4742
+ const adapter = new ViewflyAdapter({
5130
4743
  [ParagraphComponent.componentName]: ParagraphView,
5131
4744
  [RootComponent.componentName]: RootView,
5132
4745
  [BlockquoteComponent.componentName]: BlockquoteView,
@@ -5137,8 +4750,8 @@ function createXNote(host, config = {}) {
5137
4750
  [ListComponent.componentName]: ListComponentView,
5138
4751
  [ImageComponent.componentName]: ImageView,
5139
4752
  [VideoComponent.componentName]: VideoView
5140
- }, (host, root) => {
5141
- const appInjector = new ReflectiveInjector(textbus, [{
4753
+ }, (host, root, injector) => {
4754
+ const appInjector = new ReflectiveInjector(injector, [{
5142
4755
  provide: OutputInjectionToken,
5143
4756
  useValue: false
5144
4757
  }]);
@@ -5149,6 +4762,35 @@ function createXNote(host, config = {}) {
5149
4762
  app.destroy();
5150
4763
  };
5151
4764
  });
4765
+ const vDomAdapter = new ViewflyVDomAdapter({
4766
+ [ParagraphComponent.componentName]: ParagraphView,
4767
+ [RootComponent.componentName]: RootView,
4768
+ [BlockquoteComponent.componentName]: BlockquoteView,
4769
+ [TodolistComponent.componentName]: TodolistView,
4770
+ [SourceCodeComponent.componentName]: SourceCodeView,
4771
+ [TableComponent.componentName]: TableComponentView,
4772
+ [HighlightBoxComponent.componentName]: HighlightBoxView,
4773
+ [ListComponent.componentName]: ListComponentView,
4774
+ [ImageComponent.componentName]: ImageView,
4775
+ [VideoComponent.componentName]: VideoView
4776
+ }, (host, root, injector) => {
4777
+ const appInjector = new ReflectiveInjector(injector, [{
4778
+ provide: OutputInjectionToken,
4779
+ useValue: true
4780
+ }, {
4781
+ provide: DomAdapter,
4782
+ useFactory() {
4783
+ return vDomAdapter;
4784
+ }
4785
+ }]);
4786
+ const app = createApp(root, {
4787
+ context: appInjector,
4788
+ nativeRenderer: new HTMLRenderer()
4789
+ }).mount(host);
4790
+ return () => {
4791
+ app.destroy();
4792
+ };
4793
+ });
5152
4794
  const browserModule = new BrowserModule({
5153
4795
  renderTo() {
5154
4796
  return host;
@@ -5188,6 +4830,7 @@ function createXNote(host, config = {}) {
5188
4830
  modules.push(new CollaborateModule(config.collaborateConfig));
5189
4831
  }
5190
4832
  const textbus = new Textbus({
4833
+ additionalAdapters: [vDomAdapter],
5191
4834
  zenCoding: true,
5192
4835
  readonly: config.readonly,
5193
4836
  imports: modules,
@@ -5252,8 +4895,13 @@ function createXNote(host, config = {}) {
5252
4895
  });
5253
4896
  }
5254
4897
  yield textbus.render(rootComp);
5255
- // console.log(rootComp)
5256
- return textbus;
4898
+ const translator = new OutputTranslator();
4899
+ return {
4900
+ textbus,
4901
+ getHTML() {
4902
+ return translator.transform(vDomAdapter.host);
4903
+ }
4904
+ };
5257
4905
  });
5258
4906
  }
5259
4907