@formicoidea/labre-core 0.60.0 → 0.61.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/architecture/code.c4 +28 -23
- package/architecture/likec4.config.json +3 -3
- package/dist/_pkgs/affine-block-attachment/asset-picker.d.ts +8 -0
- package/dist/_pkgs/affine-block-attachment/asset-picker.js +25 -1
- package/dist/_pkgs/affine-block-attachment/attachment-block.js +9 -7
- package/dist/_pkgs/affine-block-database/database-block.js +4 -5
- package/dist/_pkgs/affine-block-database/service/index.d.ts +1 -0
- package/dist/_pkgs/affine-block-database/service/index.js +1 -0
- package/dist/_pkgs/affine-block-database/service/initial-view.d.ts +33 -0
- package/dist/_pkgs/affine-block-database/service/initial-view.js +20 -0
- package/dist/_pkgs/affine-block-database/utils/current-view.d.ts +7 -0
- package/dist/_pkgs/affine-block-database/utils/current-view.js +14 -0
- package/dist/_pkgs/affine-block-embed/common/render-linked-doc.js +2 -0
- package/dist/_pkgs/affine-block-embed-doc/common/child-card.d.ts +25 -0
- package/dist/_pkgs/affine-block-embed-doc/common/child-card.js +27 -0
- package/dist/_pkgs/affine-block-embed-doc/embed-linked-doc-block/commands/insert-embed-linked-doc.js +6 -1
- package/dist/_pkgs/affine-block-embed-doc/embed-linked-doc-block/configs/new-doc.js +2 -2
- package/dist/_pkgs/affine-block-embed-doc/embed-linked-doc-block/embed-linked-doc-block.js +2 -6
- package/dist/_pkgs/affine-block-embed-doc/embed-synced-doc-block/embed-synced-doc-block.js +2 -3
- package/dist/_pkgs/affine-block-embed-doc/page-drop/page-drop.js +3 -3
- package/dist/_pkgs/affine-block-surface/extensions/reading-toolbar.js +12 -12
- package/dist/_pkgs/affine-components/highlight-dropdown-menu/highlight-duotone-icon.js +8 -8
- package/dist/_pkgs/affine-components/highlight-dropdown-menu/text-duotone-icon.js +11 -11
- package/dist/_pkgs/affine-components/icons/loading.d.ts +6 -0
- package/dist/_pkgs/affine-components/icons/loading.js +16 -12
- package/dist/_pkgs/affine-fragment-doc-title/title-band/show-here.js +2 -2
- package/dist/_pkgs/affine-fragment-doc-title/title-band/title-band.d.ts +8 -0
- package/dist/_pkgs/affine-fragment-doc-title/title-band/title-band.js +35 -13
- package/dist/_pkgs/affine-fragment-doc-title/translations.d.ts +1 -1
- package/dist/_pkgs/affine-fragment-doc-title/translations.js +1 -1
- package/dist/_pkgs/affine-gfx-mindmap/toolbar/basket-elements.d.ts +12 -0
- package/dist/_pkgs/affine-gfx-mindmap/toolbar/basket-elements.js +44 -5
- package/dist/_pkgs/affine-gfx-mindmap/toolbar/senior-tool.d.ts +3 -2
- package/dist/_pkgs/affine-gfx-mindmap/toolbar/senior-tool.js +3 -2
- package/dist/_pkgs/affine-gfx-template/builtin/slides/build.js +10 -10
- package/dist/_pkgs/affine-gfx-template/builtin/slides/consts.d.ts +48 -64
- package/dist/_pkgs/affine-gfx-template/builtin/slides/consts.js +24 -21
- package/dist/_pkgs/affine-gfx-template/builtin/slides/masks.d.ts +1 -2
- package/dist/_pkgs/affine-gfx-template/builtin/slides/masks.js +0 -34
- package/dist/_pkgs/affine-inline-reference/reference-node/configs/toolbar.js +2 -1
- package/dist/_pkgs/affine-shared/consts/index.d.ts +9 -0
- package/dist/_pkgs/affine-shared/consts/index.js +9 -0
- package/dist/_pkgs/affine-shared/services/asset-picker-service.d.ts +7 -6
- package/dist/_pkgs/affine-shared/services/asset-picker-service.js +5 -5
- package/dist/_pkgs/affine-shared/services/title-band-service.d.ts +19 -0
- package/dist/_pkgs/affine-widget-edgeless-zoom-toolbar/index.js +26 -26
- package/dist/_pkgs/affine-widget-keyboard-toolbar/icons.js +98 -98
- package/dist/_pkgs/affine-widget-page-dragging-area/index.js +10 -10
- package/dist/_pkgs/affine-widget-viewport-overlay/index.js +13 -13
- package/dist/_pkgs/data-view/core/component/cell-status/cell-status-css.d.ts +1 -1
- package/dist/_pkgs/data-view/core/component/cell-status/cell-status-css.js +10 -10
- package/dist/_pkgs/data-view/core/component/cell-status/cell-status.d.ts +1 -1
- package/dist/_pkgs/data-view/core/component/cell-status/cell-status.js +7 -5
- package/dist/_pkgs/data-view/core/utils/menu-title.js +17 -17
- package/dist/_pkgs/data-view/property-presets/number/cell-renderer.d.ts +18 -0
- package/dist/_pkgs/data-view/property-presets/number/cell-renderer.js +51 -10
- package/dist/_pkgs/data-view/property-presets/text/cell-renderer.d.ts +23 -1
- package/dist/_pkgs/data-view/property-presets/text/cell-renderer.js +56 -15
- package/dist/_pkgs/data-view/property-presets/typing-commit.d.ts +16 -0
- package/dist/_pkgs/data-view/property-presets/typing-commit.js +27 -0
- package/dist/_pkgs/data-view/view-presets/list/list-view.js +1 -1
- package/package.json +1 -1
|
@@ -37,8 +37,20 @@ import { query } from 'lit/decorators.js';
|
|
|
37
37
|
import { BaseCellRenderer } from '../../core/property/index.js';
|
|
38
38
|
import { createFromBaseCellRenderer } from '../../core/property/renderer.js';
|
|
39
39
|
import { createIcon } from '../../core/utils/uni-icon.js';
|
|
40
|
+
import { TypingCommit } from '../typing-commit.js';
|
|
40
41
|
import { textInputStyle, textStyle } from './cell-renderer-css.js';
|
|
41
42
|
import { textPropertyModelConfig } from './define.js';
|
|
43
|
+
/**
|
|
44
|
+
* The plain-text cell (a hosted source's text and title columns, the title
|
|
45
|
+
* band's text). What is typed is committed while typing (after a pause),
|
|
46
|
+
* when the input loses the focus, when the cell leaves the DOM and when the
|
|
47
|
+
* cell exits editing (Enter, Escape, Tab, another cell): leaving by a path
|
|
48
|
+
* no view reports, a click outside the editor, lost the edit (recette 3,
|
|
49
|
+
* P3-5, `text-cell-commit.unit.spec.ts`). Escape commits too: what was typed
|
|
50
|
+
* is kept, as in the table before. A commit writes only what changed since
|
|
51
|
+
* the editor opened or last committed, so an exit without typing writes
|
|
52
|
+
* nothing and a value another peer wrote meanwhile is not overwritten.
|
|
53
|
+
*/
|
|
42
54
|
let TextCell = (() => {
|
|
43
55
|
let _classSuper = BaseCellRenderer;
|
|
44
56
|
let __inputEle_decorators;
|
|
@@ -48,21 +60,26 @@ let TextCell = (() => {
|
|
|
48
60
|
constructor() {
|
|
49
61
|
super(...arguments);
|
|
50
62
|
this.#_inputEle_accessor_storage = __runInitializers(this, __inputEle_initializers, void 0);
|
|
51
|
-
|
|
63
|
+
/**
|
|
64
|
+
* The text the input opened with, bound while editing: a value the
|
|
65
|
+
* source echoes back mid-typing (a commit while typing, a remote write)
|
|
66
|
+
* must not rewrite the input under the caret.
|
|
67
|
+
*/
|
|
68
|
+
this._opened = __runInitializers(this, __inputEle_extraInitializers);
|
|
69
|
+
this._typing = new TypingCommit(() => this._commit(false));
|
|
70
|
+
this._keydown = (e) => {
|
|
52
71
|
if (e.key === 'Enter' && !e.isComposing) {
|
|
53
|
-
// Leaving commits,
|
|
54
|
-
// here as well
|
|
55
|
-
//
|
|
72
|
+
// Leaving commits, through `beforeExitEditingMode`. Resetting the
|
|
73
|
+
// input here as well made the exit write the old value back over the
|
|
74
|
+
// new one (standalone-cell.unit.spec.ts).
|
|
56
75
|
setTimeout(() => {
|
|
57
76
|
this.selectCurrentCell(false);
|
|
58
77
|
});
|
|
59
78
|
}
|
|
60
|
-
}
|
|
61
|
-
this.
|
|
62
|
-
if (this.
|
|
63
|
-
this.
|
|
64
|
-
}
|
|
65
|
-
this.valueSetNextTick(str);
|
|
79
|
+
};
|
|
80
|
+
this._onBlur = () => {
|
|
81
|
+
if (this.isEditing$.peek())
|
|
82
|
+
this._commit(false);
|
|
66
83
|
};
|
|
67
84
|
this.focusEnd = () => {
|
|
68
85
|
if (!this._inputEle)
|
|
@@ -81,23 +98,47 @@ let TextCell = (() => {
|
|
|
81
98
|
#_inputEle_accessor_storage;
|
|
82
99
|
get _inputEle() { return this.#_inputEle_accessor_storage; }
|
|
83
100
|
set _inputEle(value) { this.#_inputEle_accessor_storage = value; }
|
|
101
|
+
_commit(nextTick) {
|
|
102
|
+
this._typing.cancel();
|
|
103
|
+
const input = this._inputEle;
|
|
104
|
+
if (!input)
|
|
105
|
+
return;
|
|
106
|
+
const str = input.value;
|
|
107
|
+
const base = this._sent ?? this._opened ?? `${this.value ?? ''}`;
|
|
108
|
+
if (str === base)
|
|
109
|
+
return;
|
|
110
|
+
this._sent = str;
|
|
111
|
+
if (nextTick)
|
|
112
|
+
this.valueSetNextTick(str);
|
|
113
|
+
else
|
|
114
|
+
this.valueSetImmediate(str);
|
|
115
|
+
}
|
|
84
116
|
afterEnterEditingMode() {
|
|
85
117
|
this.focusEnd();
|
|
86
118
|
}
|
|
87
119
|
beforeExitEditingMode() {
|
|
88
|
-
this.
|
|
120
|
+
this._commit(true);
|
|
121
|
+
}
|
|
122
|
+
disconnectedCallback() {
|
|
123
|
+
if (this.isEditing$?.peek())
|
|
124
|
+
this._commit(false);
|
|
125
|
+
this._typing.cancel();
|
|
126
|
+
super.disconnectedCallback();
|
|
89
127
|
}
|
|
90
128
|
render() {
|
|
91
129
|
if (this.isEditing$.value) {
|
|
130
|
+
this._opened ??= `${this.value ?? ''}`;
|
|
92
131
|
return html `<input
|
|
93
|
-
.value="${this.
|
|
132
|
+
.value="${this._opened}"
|
|
94
133
|
@keydown="${this._keydown}"
|
|
134
|
+
@input="${() => this._typing.schedule()}"
|
|
135
|
+
@blur="${this._onBlur}"
|
|
95
136
|
class="${textInputStyle}"
|
|
96
137
|
/>`;
|
|
97
138
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
139
|
+
this._opened = undefined;
|
|
140
|
+
this._sent = undefined;
|
|
141
|
+
return html `<div class="${textStyle}">${this.value ?? ''}</div>`;
|
|
101
142
|
}
|
|
102
143
|
};
|
|
103
144
|
})();
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How long an in-place cell editor (text, number) waits after the last
|
|
3
|
+
* keystroke before it commits what is typed. Short enough that a value
|
|
4
|
+
* typed and left by any path (a click outside the editor, a closed tab) is
|
|
5
|
+
* already written; long enough that a host writing to a server does not
|
|
6
|
+
* write once per keystroke (recette 3, P3-5).
|
|
7
|
+
*/
|
|
8
|
+
export declare const TYPING_COMMIT_MS = 400;
|
|
9
|
+
/** The one commit waiting for the typing to pause. */
|
|
10
|
+
export declare class TypingCommit {
|
|
11
|
+
private readonly _commit;
|
|
12
|
+
private _timer;
|
|
13
|
+
constructor(_commit: () => void);
|
|
14
|
+
schedule(): void;
|
|
15
|
+
cancel(): void;
|
|
16
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How long an in-place cell editor (text, number) waits after the last
|
|
3
|
+
* keystroke before it commits what is typed. Short enough that a value
|
|
4
|
+
* typed and left by any path (a click outside the editor, a closed tab) is
|
|
5
|
+
* already written; long enough that a host writing to a server does not
|
|
6
|
+
* write once per keystroke (recette 3, P3-5).
|
|
7
|
+
*/
|
|
8
|
+
export const TYPING_COMMIT_MS = 400;
|
|
9
|
+
/** The one commit waiting for the typing to pause. */
|
|
10
|
+
export class TypingCommit {
|
|
11
|
+
constructor(_commit) {
|
|
12
|
+
this._commit = _commit;
|
|
13
|
+
}
|
|
14
|
+
schedule() {
|
|
15
|
+
this.cancel();
|
|
16
|
+
this._timer = setTimeout(() => {
|
|
17
|
+
this._timer = undefined;
|
|
18
|
+
this._commit();
|
|
19
|
+
}, TYPING_COMMIT_MS);
|
|
20
|
+
}
|
|
21
|
+
cancel() {
|
|
22
|
+
if (this._timer === undefined)
|
|
23
|
+
return;
|
|
24
|
+
clearTimeout(this._timer);
|
|
25
|
+
this._timer = undefined;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -152,7 +152,7 @@ export class ListViewUI extends FlatViewUI {
|
|
|
152
152
|
renderRow(rowId) {
|
|
153
153
|
const view = this.view;
|
|
154
154
|
const title = view.titleProperty$.value;
|
|
155
|
-
// A value still loading keeps its chip,
|
|
155
|
+
// A value still loading keeps its chip, with its spinner.
|
|
156
156
|
const chips = view.bodyProperties$.value.filter(property => {
|
|
157
157
|
const cell = property.cellGetOrCreate(rowId);
|
|
158
158
|
return cell.status$?.value === 'pending' || !cell.isEmpty$.value;
|