@formicoidea/labre-core 0.26.0 → 0.28.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/dist/_pkgs/affine-block-database/data-source.d.ts +28 -40
- package/dist/_pkgs/affine-block-database/data-source.js +116 -178
- package/dist/_pkgs/affine-block-database/database-block.d.ts +10 -3
- package/dist/_pkgs/affine-block-database/database-block.js +110 -70
- package/dist/_pkgs/affine-block-database/external-data-source.d.ts +69 -0
- package/dist/_pkgs/affine-block-database/external-data-source.js +144 -0
- package/dist/_pkgs/affine-block-database/index.d.ts +2 -0
- package/dist/_pkgs/affine-block-database/index.js +2 -0
- package/dist/_pkgs/affine-block-root/edgeless/configs/toolbar/misc.d.ts +18 -0
- package/dist/_pkgs/affine-block-root/edgeless/configs/toolbar/more.d.ts +18 -0
- package/dist/_pkgs/affine-block-root/edgeless/configs/toolbar/more.js +104 -2
- package/dist/_pkgs/affine-widget-edgeless-selected-rect/edgeless-element-link.d.ts +29 -0
- package/dist/_pkgs/affine-widget-edgeless-selected-rect/edgeless-element-link.js +233 -0
- package/dist/_pkgs/affine-widget-edgeless-selected-rect/effects.js +2 -0
- package/dist/_pkgs/affine-widget-edgeless-selected-rect/spec.d.ts +1 -0
- package/dist/_pkgs/affine-widget-edgeless-selected-rect/spec.js +2 -0
- package/dist/_pkgs/affine-widget-edgeless-selected-rect/view.js +2 -1
- package/dist/_pkgs/data-view/core/data-source/base.d.ts +6 -0
- package/dist/_pkgs/data-view/core/data-source/base.js +6 -0
- package/dist/_pkgs/std/gfx/model/surface/element-model.d.ts +7 -0
- package/dist/_pkgs/std/gfx/model/surface/element-model.js +24 -1
- package/dist/_pkgs/std/inline/components/v-element.js +5 -2
- package/package.json +1 -1
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
2
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
3
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
4
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
5
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
6
|
+
var _, done = false;
|
|
7
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
8
|
+
var context = {};
|
|
9
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
10
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
11
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
12
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
13
|
+
if (kind === "accessor") {
|
|
14
|
+
if (result === void 0) continue;
|
|
15
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
16
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
17
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
18
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
19
|
+
}
|
|
20
|
+
else if (_ = accept(result)) {
|
|
21
|
+
if (kind === "field") initializers.unshift(_);
|
|
22
|
+
else descriptor[key] = _;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
26
|
+
done = true;
|
|
27
|
+
};
|
|
28
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
29
|
+
var useValue = arguments.length > 2;
|
|
30
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
31
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
32
|
+
}
|
|
33
|
+
return useValue ? value : void 0;
|
|
34
|
+
};
|
|
35
|
+
import { RefNodeSlotsProvider } from '../affine-inline-reference/index.js';
|
|
36
|
+
import { requestThrottledConnectedFrame } from '../affine-shared/utils/index.js';
|
|
37
|
+
import { WidgetComponent } from '../std/index.js';
|
|
38
|
+
import { GfxControllerIdentifier, GfxPrimitiveElementModel, } from '../std/gfx/index.js';
|
|
39
|
+
import { OpenInNewIcon, RightSidebarIcon } from '@blocksuite/icons/lit';
|
|
40
|
+
import { css, html, nothing } from 'lit';
|
|
41
|
+
import { state } from 'lit/decorators.js';
|
|
42
|
+
import { styleMap } from 'lit/directives/style-map.js';
|
|
43
|
+
export const EDGELESS_ELEMENT_LINK_WIDGET = 'edgeless-element-link';
|
|
44
|
+
/**
|
|
45
|
+
* Shows a clickable arrow when hovering a drawing element that carries a link
|
|
46
|
+
* ({@link GfxPrimitiveElementModel.linkedDocId} or `.externalLink`). Clicking it
|
|
47
|
+
* opens the linked doc (host side-view via `docLinkClicked`) or the URL.
|
|
48
|
+
*
|
|
49
|
+
* ponytail: hover is resolved via `getElementByPoint`, which returns the topmost
|
|
50
|
+
* leaf — a link set on a group only shows when a child is hovered. Good enough
|
|
51
|
+
* for v1 (shapes/text/connectors are hit directly).
|
|
52
|
+
*/
|
|
53
|
+
let EdgelessElementLinkWidget = (() => {
|
|
54
|
+
let _classSuper = WidgetComponent;
|
|
55
|
+
let __target_decorators;
|
|
56
|
+
let __target_initializers = [];
|
|
57
|
+
let __target_extraInitializers = [];
|
|
58
|
+
let __rect_decorators;
|
|
59
|
+
let __rect_initializers = [];
|
|
60
|
+
let __rect_extraInitializers = [];
|
|
61
|
+
return class EdgelessElementLinkWidget extends _classSuper {
|
|
62
|
+
constructor() {
|
|
63
|
+
super(...arguments);
|
|
64
|
+
this._hideTimer = null;
|
|
65
|
+
this.#_target_accessor_storage = __runInitializers(this, __target_initializers, null);
|
|
66
|
+
this.#_rect_accessor_storage = (__runInitializers(this, __target_extraInitializers), __runInitializers(this, __rect_initializers, null));
|
|
67
|
+
this._updateRect = (__runInitializers(this, __rect_extraInitializers), requestThrottledConnectedFrame(() => {
|
|
68
|
+
const el = this._target;
|
|
69
|
+
if (!el) {
|
|
70
|
+
this._rect = null;
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const bound = el.elementBound;
|
|
74
|
+
const { viewport } = this.gfx;
|
|
75
|
+
const [left, top] = viewport.toViewCoord(bound.x, bound.y);
|
|
76
|
+
this._rect = {
|
|
77
|
+
left,
|
|
78
|
+
top,
|
|
79
|
+
width: bound.w * viewport.zoom,
|
|
80
|
+
height: bound.h * viewport.zoom,
|
|
81
|
+
};
|
|
82
|
+
}, this));
|
|
83
|
+
this._open = (e) => {
|
|
84
|
+
e.stopPropagation();
|
|
85
|
+
const el = this._target;
|
|
86
|
+
if (!el)
|
|
87
|
+
return;
|
|
88
|
+
if (el.linkedDocId) {
|
|
89
|
+
this.std.getOptional(RefNodeSlotsProvider)?.docLinkClicked.next({
|
|
90
|
+
pageId: el.linkedDocId,
|
|
91
|
+
host: this.std.host,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
else if (el.externalLink) {
|
|
95
|
+
window.open(el.externalLink, '_blank', 'noopener,noreferrer');
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
this._onKeydown = (e) => {
|
|
99
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
100
|
+
e.preventDefault();
|
|
101
|
+
this._open(e);
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
static {
|
|
106
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
107
|
+
__target_decorators = [state()];
|
|
108
|
+
__rect_decorators = [state()];
|
|
109
|
+
__esDecorate(this, null, __target_decorators, { kind: "accessor", name: "_target", static: false, private: false, access: { has: obj => "_target" in obj, get: obj => obj._target, set: (obj, value) => { obj._target = value; } }, metadata: _metadata }, __target_initializers, __target_extraInitializers);
|
|
110
|
+
__esDecorate(this, null, __rect_decorators, { kind: "accessor", name: "_rect", static: false, private: false, access: { has: obj => "_rect" in obj, get: obj => obj._rect, set: (obj, value) => { obj._rect = value; } }, metadata: _metadata }, __rect_initializers, __rect_extraInitializers);
|
|
111
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
112
|
+
}
|
|
113
|
+
static { this.styles = css `
|
|
114
|
+
:host {
|
|
115
|
+
position: absolute;
|
|
116
|
+
top: 0;
|
|
117
|
+
left: 0;
|
|
118
|
+
z-index: 1;
|
|
119
|
+
pointer-events: none;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.open-link-button {
|
|
123
|
+
position: absolute;
|
|
124
|
+
display: flex;
|
|
125
|
+
align-items: center;
|
|
126
|
+
justify-content: center;
|
|
127
|
+
width: 24px;
|
|
128
|
+
height: 24px;
|
|
129
|
+
border-radius: 4px;
|
|
130
|
+
background: var(--affine-background-overlay-panel-color, #fff);
|
|
131
|
+
box-shadow: var(--affine-shadow-1);
|
|
132
|
+
color: var(--affine-icon-color);
|
|
133
|
+
cursor: pointer;
|
|
134
|
+
pointer-events: auto;
|
|
135
|
+
transform: translate(-50%, -50%);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.open-link-button:hover {
|
|
139
|
+
background: var(--affine-hover-color);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.open-link-button svg {
|
|
143
|
+
width: 16px;
|
|
144
|
+
height: 16px;
|
|
145
|
+
}
|
|
146
|
+
`; }
|
|
147
|
+
#_target_accessor_storage;
|
|
148
|
+
get _target() { return this.#_target_accessor_storage; }
|
|
149
|
+
set _target(value) { this.#_target_accessor_storage = value; }
|
|
150
|
+
#_rect_accessor_storage;
|
|
151
|
+
get _rect() { return this.#_rect_accessor_storage; }
|
|
152
|
+
set _rect(value) { this.#_rect_accessor_storage = value; }
|
|
153
|
+
get gfx() {
|
|
154
|
+
return this.std.get(GfxControllerIdentifier);
|
|
155
|
+
}
|
|
156
|
+
_hasLink(el) {
|
|
157
|
+
return (el instanceof GfxPrimitiveElementModel &&
|
|
158
|
+
Boolean(el.linkedDocId || el.externalLink));
|
|
159
|
+
}
|
|
160
|
+
_setTarget(el) {
|
|
161
|
+
if (el) {
|
|
162
|
+
if (this._hideTimer) {
|
|
163
|
+
clearTimeout(this._hideTimer);
|
|
164
|
+
this._hideTimer = null;
|
|
165
|
+
}
|
|
166
|
+
this._target = el;
|
|
167
|
+
this._updateRect();
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
// Delay hiding so the pointer can travel from the element to the button.
|
|
171
|
+
if (this._target && !this._hideTimer) {
|
|
172
|
+
this._hideTimer = setTimeout(() => {
|
|
173
|
+
this._hideTimer = null;
|
|
174
|
+
this._target = null;
|
|
175
|
+
this._rect = null;
|
|
176
|
+
}, 200);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
/** The hovered element if it carries a link, else its nearest linked group. */
|
|
180
|
+
_resolveLinked(hit) {
|
|
181
|
+
if (this._hasLink(hit))
|
|
182
|
+
return hit;
|
|
183
|
+
const groups = hit instanceof GfxPrimitiveElementModel ? hit.groups : [];
|
|
184
|
+
for (const group of groups) {
|
|
185
|
+
if (this._hasLink(group))
|
|
186
|
+
return group;
|
|
187
|
+
}
|
|
188
|
+
return null;
|
|
189
|
+
}
|
|
190
|
+
firstUpdated() {
|
|
191
|
+
const { _disposables, gfx } = this;
|
|
192
|
+
_disposables.add(this.std.host.event.add('pointerMove', ctx => {
|
|
193
|
+
const evt = ctx.get('pointerState');
|
|
194
|
+
const [x, y] = gfx.viewport.toModelCoord(evt.x, evt.y);
|
|
195
|
+
this._setTarget(this._resolveLinked(gfx.getElementByPoint(x, y)));
|
|
196
|
+
}));
|
|
197
|
+
_disposables.add(gfx.viewport.viewportUpdated.subscribe(() => {
|
|
198
|
+
if (this._target)
|
|
199
|
+
this._updateRect();
|
|
200
|
+
}));
|
|
201
|
+
_disposables.add(() => {
|
|
202
|
+
if (this._hideTimer)
|
|
203
|
+
clearTimeout(this._hideTimer);
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
render() {
|
|
207
|
+
const rect = this._rect;
|
|
208
|
+
const target = this._target;
|
|
209
|
+
if (!target || !rect)
|
|
210
|
+
return nothing;
|
|
211
|
+
const isDoc = Boolean(target.linkedDocId);
|
|
212
|
+
const label = isDoc ? 'Open linked doc' : 'Open link';
|
|
213
|
+
return html `<div
|
|
214
|
+
class="open-link-button"
|
|
215
|
+
role="button"
|
|
216
|
+
tabindex="0"
|
|
217
|
+
title=${label}
|
|
218
|
+
aria-label=${label}
|
|
219
|
+
style=${styleMap({
|
|
220
|
+
left: `${rect.left + rect.width}px`,
|
|
221
|
+
top: `${rect.top}px`,
|
|
222
|
+
})}
|
|
223
|
+
@click=${this._open}
|
|
224
|
+
@keydown=${this._onKeydown}
|
|
225
|
+
@pointerenter=${() => this._setTarget(target)}
|
|
226
|
+
@pointerleave=${() => this._setTarget(null)}
|
|
227
|
+
>
|
|
228
|
+
${isDoc ? RightSidebarIcon() : OpenInNewIcon()}
|
|
229
|
+
</div>`;
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
})();
|
|
233
|
+
export { EdgelessElementLinkWidget };
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { EdgelessAutoCompletePanel } from './auto-complete-panel';
|
|
2
2
|
import { EdgelessAutoComplete } from './edgeless-auto-complete';
|
|
3
|
+
import { EDGELESS_ELEMENT_LINK_WIDGET, EdgelessElementLinkWidget, } from './edgeless-element-link';
|
|
3
4
|
import { EDGELESS_SELECTED_RECT_WIDGET, EdgelessSelectedRectWidget, } from './edgeless-selected-rect';
|
|
4
5
|
export function effects() {
|
|
5
6
|
customElements.define('edgeless-auto-complete-panel', EdgelessAutoCompletePanel);
|
|
6
7
|
customElements.define('edgeless-auto-complete', EdgelessAutoComplete);
|
|
7
8
|
customElements.define(EDGELESS_SELECTED_RECT_WIDGET, EdgelessSelectedRectWidget);
|
|
9
|
+
customElements.define(EDGELESS_ELEMENT_LINK_WIDGET, EdgelessElementLinkWidget);
|
|
8
10
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { WidgetViewExtension } from '../std/index.js';
|
|
2
2
|
import { literal, unsafeStatic } from 'lit/static-html.js';
|
|
3
|
+
import { EDGELESS_ELEMENT_LINK_WIDGET } from './edgeless-element-link';
|
|
3
4
|
import { EDGELESS_SELECTED_RECT_WIDGET } from './edgeless-selected-rect';
|
|
4
5
|
export const edgelessSelectedRectWidget = WidgetViewExtension('affine:page', EDGELESS_SELECTED_RECT_WIDGET, literal `${unsafeStatic(EDGELESS_SELECTED_RECT_WIDGET)}`);
|
|
6
|
+
export const edgelessElementLinkWidget = WidgetViewExtension('affine:page', EDGELESS_ELEMENT_LINK_WIDGET, literal `${unsafeStatic(EDGELESS_ELEMENT_LINK_WIDGET)}`);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ViewExtensionProvider, } from '../affine-ext-loader/index.js';
|
|
2
2
|
import { effects } from './effects';
|
|
3
|
-
import { edgelessSelectedRectWidget } from './spec';
|
|
3
|
+
import { edgelessElementLinkWidget, edgelessSelectedRectWidget } from './spec';
|
|
4
4
|
export class EdgelessSelectedRectViewExtension extends ViewExtensionProvider {
|
|
5
5
|
constructor() {
|
|
6
6
|
super(...arguments);
|
|
@@ -14,6 +14,7 @@ export class EdgelessSelectedRectViewExtension extends ViewExtensionProvider {
|
|
|
14
14
|
super.setup(context);
|
|
15
15
|
if (this.isEdgeless(context.scope)) {
|
|
16
16
|
context.register(edgelessSelectedRectWidget);
|
|
17
|
+
context.register(edgelessElementLinkWidget);
|
|
17
18
|
}
|
|
18
19
|
}
|
|
19
20
|
}
|
|
@@ -129,4 +129,10 @@ export declare abstract class DataSourceBase implements DataSource {
|
|
|
129
129
|
index: number;
|
|
130
130
|
} | undefined;
|
|
131
131
|
isFixedProperty(propertyId: string): boolean;
|
|
132
|
+
/**
|
|
133
|
+
* Tear down anything the source subscribed to (e.g. external observers).
|
|
134
|
+
* No-op by default — the inline blob source holds no subscriptions. The
|
|
135
|
+
* owning block calls this when it rebuilds the source or disconnects.
|
|
136
|
+
*/
|
|
137
|
+
dispose(): void;
|
|
132
138
|
}
|
|
@@ -80,4 +80,10 @@ export class DataSourceBase {
|
|
|
80
80
|
}
|
|
81
81
|
return false;
|
|
82
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* Tear down anything the source subscribed to (e.g. external observers).
|
|
85
|
+
* No-op by default — the inline blob source holds no subscriptions. The
|
|
86
|
+
* owning block calls this when it rebuilds the source or disconnects.
|
|
87
|
+
*/
|
|
88
|
+
dispose() { }
|
|
83
89
|
}
|
|
@@ -100,6 +100,13 @@ export declare abstract class GfxPrimitiveElementModel<Props extends BaseElement
|
|
|
100
100
|
accessor externalXYWH: SerializedXYWH | undefined;
|
|
101
101
|
accessor hidden: boolean;
|
|
102
102
|
accessor index: string;
|
|
103
|
+
/**
|
|
104
|
+
* Minimal link target attached to the element. At most one is set.
|
|
105
|
+
* Opaque to the framework; an affine widget shows a hover arrow that
|
|
106
|
+
* opens the doc ({@link linkedDocId}) or the URL ({@link externalLink}).
|
|
107
|
+
*/
|
|
108
|
+
accessor externalLink: string | undefined;
|
|
109
|
+
accessor linkedDocId: string | undefined;
|
|
103
110
|
accessor lockedBySelf: boolean | undefined;
|
|
104
111
|
accessor opacity: number;
|
|
105
112
|
accessor responseExtension: [number, number];
|
|
@@ -55,6 +55,12 @@ let GfxPrimitiveElementModel = (() => {
|
|
|
55
55
|
let _index_decorators;
|
|
56
56
|
let _index_initializers = [];
|
|
57
57
|
let _index_extraInitializers = [];
|
|
58
|
+
let _externalLink_decorators;
|
|
59
|
+
let _externalLink_initializers = [];
|
|
60
|
+
let _externalLink_extraInitializers = [];
|
|
61
|
+
let _linkedDocId_decorators;
|
|
62
|
+
let _linkedDocId_initializers = [];
|
|
63
|
+
let _linkedDocId_extraInitializers = [];
|
|
58
64
|
let _lockedBySelf_decorators;
|
|
59
65
|
let _lockedBySelf_initializers = [];
|
|
60
66
|
let _lockedBySelf_extraInitializers = [];
|
|
@@ -76,6 +82,8 @@ let GfxPrimitiveElementModel = (() => {
|
|
|
76
82
|
}), local()];
|
|
77
83
|
_hidden_decorators = [field(false)];
|
|
78
84
|
_index_decorators = [field()];
|
|
85
|
+
_externalLink_decorators = [field()];
|
|
86
|
+
_linkedDocId_decorators = [field()];
|
|
79
87
|
_lockedBySelf_decorators = [field()];
|
|
80
88
|
_opacity_decorators = [local()];
|
|
81
89
|
_responseExtension_decorators = [local()];
|
|
@@ -84,6 +92,8 @@ let GfxPrimitiveElementModel = (() => {
|
|
|
84
92
|
__esDecorate(this, null, _externalXYWH_decorators, { kind: "accessor", name: "externalXYWH", static: false, private: false, access: { has: obj => "externalXYWH" in obj, get: obj => obj.externalXYWH, set: (obj, value) => { obj.externalXYWH = value; } }, metadata: _metadata }, _externalXYWH_initializers, _externalXYWH_extraInitializers);
|
|
85
93
|
__esDecorate(this, null, _hidden_decorators, { kind: "accessor", name: "hidden", static: false, private: false, access: { has: obj => "hidden" in obj, get: obj => obj.hidden, set: (obj, value) => { obj.hidden = value; } }, metadata: _metadata }, _hidden_initializers, _hidden_extraInitializers);
|
|
86
94
|
__esDecorate(this, null, _index_decorators, { kind: "accessor", name: "index", static: false, private: false, access: { has: obj => "index" in obj, get: obj => obj.index, set: (obj, value) => { obj.index = value; } }, metadata: _metadata }, _index_initializers, _index_extraInitializers);
|
|
95
|
+
__esDecorate(this, null, _externalLink_decorators, { kind: "accessor", name: "externalLink", static: false, private: false, access: { has: obj => "externalLink" in obj, get: obj => obj.externalLink, set: (obj, value) => { obj.externalLink = value; } }, metadata: _metadata }, _externalLink_initializers, _externalLink_extraInitializers);
|
|
96
|
+
__esDecorate(this, null, _linkedDocId_decorators, { kind: "accessor", name: "linkedDocId", static: false, private: false, access: { has: obj => "linkedDocId" in obj, get: obj => obj.linkedDocId, set: (obj, value) => { obj.linkedDocId = value; } }, metadata: _metadata }, _linkedDocId_initializers, _linkedDocId_extraInitializers);
|
|
87
97
|
__esDecorate(this, null, _lockedBySelf_decorators, { kind: "accessor", name: "lockedBySelf", static: false, private: false, access: { has: obj => "lockedBySelf" in obj, get: obj => obj.lockedBySelf, set: (obj, value) => { obj.lockedBySelf = value; } }, metadata: _metadata }, _lockedBySelf_initializers, _lockedBySelf_extraInitializers);
|
|
88
98
|
__esDecorate(this, null, _opacity_decorators, { kind: "accessor", name: "opacity", static: false, private: false, access: { has: obj => "opacity" in obj, get: obj => obj.opacity, set: (obj, value) => { obj.opacity = value; } }, metadata: _metadata }, _opacity_initializers, _opacity_extraInitializers);
|
|
89
99
|
__esDecorate(this, null, _responseExtension_decorators, { kind: "accessor", name: "responseExtension", static: false, private: false, access: { has: obj => "responseExtension" in obj, get: obj => obj.responseExtension, set: (obj, value) => { obj.responseExtension = value; } }, metadata: _metadata }, _responseExtension_initializers, _responseExtension_extraInitializers);
|
|
@@ -162,7 +172,9 @@ let GfxPrimitiveElementModel = (() => {
|
|
|
162
172
|
this.#externalXYWH_accessor_storage = (__runInitializers(this, _display_extraInitializers), __runInitializers(this, _externalXYWH_initializers, undefined));
|
|
163
173
|
this.#hidden_accessor_storage = (__runInitializers(this, _externalXYWH_extraInitializers), __runInitializers(this, _hidden_initializers, false));
|
|
164
174
|
this.#index_accessor_storage = (__runInitializers(this, _hidden_extraInitializers), __runInitializers(this, _index_initializers, void 0));
|
|
165
|
-
this.#
|
|
175
|
+
this.#externalLink_accessor_storage = (__runInitializers(this, _index_extraInitializers), __runInitializers(this, _externalLink_initializers, undefined));
|
|
176
|
+
this.#linkedDocId_accessor_storage = (__runInitializers(this, _externalLink_extraInitializers), __runInitializers(this, _linkedDocId_initializers, undefined));
|
|
177
|
+
this.#lockedBySelf_accessor_storage = (__runInitializers(this, _linkedDocId_extraInitializers), __runInitializers(this, _lockedBySelf_initializers, false));
|
|
166
178
|
this.#opacity_accessor_storage = (__runInitializers(this, _lockedBySelf_extraInitializers), __runInitializers(this, _opacity_initializers, 1));
|
|
167
179
|
this.#responseExtension_accessor_storage = (__runInitializers(this, _opacity_extraInitializers), __runInitializers(this, _responseExtension_initializers, [0, 0]));
|
|
168
180
|
this.#seed_accessor_storage = (__runInitializers(this, _responseExtension_extraInitializers), __runInitializers(this, _seed_initializers, void 0));
|
|
@@ -294,6 +306,17 @@ let GfxPrimitiveElementModel = (() => {
|
|
|
294
306
|
#index_accessor_storage;
|
|
295
307
|
get index() { return this.#index_accessor_storage; }
|
|
296
308
|
set index(value) { this.#index_accessor_storage = value; }
|
|
309
|
+
#externalLink_accessor_storage;
|
|
310
|
+
/**
|
|
311
|
+
* Minimal link target attached to the element. At most one is set.
|
|
312
|
+
* Opaque to the framework; an affine widget shows a hover arrow that
|
|
313
|
+
* opens the doc ({@link linkedDocId}) or the URL ({@link externalLink}).
|
|
314
|
+
*/
|
|
315
|
+
get externalLink() { return this.#externalLink_accessor_storage; }
|
|
316
|
+
set externalLink(value) { this.#externalLink_accessor_storage = value; }
|
|
317
|
+
#linkedDocId_accessor_storage;
|
|
318
|
+
get linkedDocId() { return this.#linkedDocId_accessor_storage; }
|
|
319
|
+
set linkedDocId(value) { this.#linkedDocId_accessor_storage = value; }
|
|
297
320
|
#lockedBySelf_accessor_storage;
|
|
298
321
|
get lockedBySelf() { return this.#lockedBySelf_accessor_storage; }
|
|
299
322
|
set lockedBySelf(value) { this.#lockedBySelf_accessor_storage = value; }
|
|
@@ -90,9 +90,12 @@ let VElement = (() => {
|
|
|
90
90
|
}
|
|
91
91
|
async getUpdateComplete() {
|
|
92
92
|
const result = await super.getUpdateComplete();
|
|
93
|
+
// The inner span (and its child) may not be in the DOM yet when this is
|
|
94
|
+
// awaited mid mount/unmount — guard instead of throwing on `null`.
|
|
93
95
|
const span = this.querySelector('[data-v-element="true"]');
|
|
94
|
-
const el = span
|
|
95
|
-
|
|
96
|
+
const el = span?.firstElementChild;
|
|
97
|
+
if (el)
|
|
98
|
+
await el.updateComplete;
|
|
96
99
|
const vTexts = Array.from(this.querySelectorAll('v-text'));
|
|
97
100
|
await Promise.all(vTexts.map(vText => vText.updateComplete));
|
|
98
101
|
return result;
|