@formicoidea/labre-core-database 3.3.0 → 3.5.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/LICENSE +384 -384
- package/dist/database-page/database-page-root.js +53 -53
- package/dist/database-page/database-page.js +81 -81
- package/dist/new-source-entry.js +17 -17
- package/dist/properties-panel/properties-panel.js +100 -100
- package/dist/view-settings/rename-source-entry.js +6 -6
- package/dist/view-settings/source-entry.js +3 -3
- package/dist/workspace-sources.js +4 -4
- package/package.json +2 -2
|
@@ -76,53 +76,53 @@ export function selectionStaysInHost(store, hostBlockId, selection) {
|
|
|
76
76
|
* follows additions and deletions.
|
|
77
77
|
*/
|
|
78
78
|
export class DatabasePageRoot extends BlockComponent {
|
|
79
|
-
static { this.styles = css `
|
|
80
|
-
affine-database-page-root {
|
|
81
|
-
display: block;
|
|
82
|
-
min-height: 100%;
|
|
83
|
-
max-width: var(--affine-editor-width);
|
|
84
|
-
margin: 0 auto;
|
|
85
|
-
padding: 0 var(--affine-editor-side-padding, 24px);
|
|
86
|
-
}
|
|
87
|
-
/* A table laid out as the page is as wide as its columns
|
|
88
|
-
(data-view's data-page-layout): the root grows with it, so the page
|
|
89
|
-
scrolls sideways. A board keeps its own sideways scroller. */
|
|
90
|
-
affine-database-page-root:has(dv-table-view-ui[data-page-layout]) {
|
|
91
|
-
width: max-content;
|
|
92
|
-
min-width: 100%;
|
|
93
|
-
/* The paddings sit inside that 100%: in the content box a table
|
|
94
|
-
narrower than the page overflowed by both gutters, and every page
|
|
95
|
-
showed a sideways scrollbar (labre recette of 2.0). */
|
|
96
|
-
box-sizing: border-box;
|
|
97
|
-
/* Widened, the root is no longer centred by its auto margins: it
|
|
98
|
-
pads its left side by what centring gave the page heading (whose
|
|
99
|
-
container in doc-title is the same max-width, centred in the
|
|
100
|
-
viewport), so the heading, the view bar and the rows share one left
|
|
101
|
-
edge and the table grows to the right (labre recette of 1.1). The
|
|
102
|
-
block's sticky view bar reads the same inset. */
|
|
103
|
-
--affine-database-page-inset: max(
|
|
104
|
-
0px,
|
|
105
|
-
calc((100cqw - var(--affine-editor-width, 100cqw)) / 2)
|
|
106
|
-
);
|
|
107
|
-
padding-left: calc(
|
|
108
|
-
var(--affine-database-page-inset) +
|
|
109
|
-
var(--affine-editor-side-padding, 24px)
|
|
110
|
-
);
|
|
111
|
-
}
|
|
112
|
-
/* A phone keeps the page root's narrow padding (page-root-block.ts).
|
|
113
|
-
The variable, not the padding: the block's sticky view bar reads it,
|
|
114
|
-
and a fixed 24px left the bar at the host's wider gutter, right of
|
|
115
|
-
the title and the rows (labre recette of 2.0). */
|
|
116
|
-
@container viewport (width <= 640px) {
|
|
117
|
-
affine-database-page-root {
|
|
118
|
-
--affine-editor-side-padding: 24px;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
.affine-database-page-missing {
|
|
122
|
-
padding: 16px 0;
|
|
123
|
-
color: var(--affine-text-secondary-color);
|
|
124
|
-
font-size: var(--affine-font-sm);
|
|
125
|
-
}
|
|
79
|
+
static { this.styles = css `
|
|
80
|
+
affine-database-page-root {
|
|
81
|
+
display: block;
|
|
82
|
+
min-height: 100%;
|
|
83
|
+
max-width: var(--affine-editor-width);
|
|
84
|
+
margin: 0 auto;
|
|
85
|
+
padding: 0 var(--affine-editor-side-padding, 24px);
|
|
86
|
+
}
|
|
87
|
+
/* A table laid out as the page is as wide as its columns
|
|
88
|
+
(data-view's data-page-layout): the root grows with it, so the page
|
|
89
|
+
scrolls sideways. A board keeps its own sideways scroller. */
|
|
90
|
+
affine-database-page-root:has(dv-table-view-ui[data-page-layout]) {
|
|
91
|
+
width: max-content;
|
|
92
|
+
min-width: 100%;
|
|
93
|
+
/* The paddings sit inside that 100%: in the content box a table
|
|
94
|
+
narrower than the page overflowed by both gutters, and every page
|
|
95
|
+
showed a sideways scrollbar (labre recette of 2.0). */
|
|
96
|
+
box-sizing: border-box;
|
|
97
|
+
/* Widened, the root is no longer centred by its auto margins: it
|
|
98
|
+
pads its left side by what centring gave the page heading (whose
|
|
99
|
+
container in doc-title is the same max-width, centred in the
|
|
100
|
+
viewport), so the heading, the view bar and the rows share one left
|
|
101
|
+
edge and the table grows to the right (labre recette of 1.1). The
|
|
102
|
+
block's sticky view bar reads the same inset. */
|
|
103
|
+
--affine-database-page-inset: max(
|
|
104
|
+
0px,
|
|
105
|
+
calc((100cqw - var(--affine-editor-width, 100cqw)) / 2)
|
|
106
|
+
);
|
|
107
|
+
padding-left: calc(
|
|
108
|
+
var(--affine-database-page-inset) +
|
|
109
|
+
var(--affine-editor-side-padding, 24px)
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
/* A phone keeps the page root's narrow padding (page-root-block.ts).
|
|
113
|
+
The variable, not the padding: the block's sticky view bar reads it,
|
|
114
|
+
and a fixed 24px left the bar at the host's wider gutter, right of
|
|
115
|
+
the title and the rows (labre recette of 2.0). */
|
|
116
|
+
@container viewport (width <= 640px) {
|
|
117
|
+
affine-database-page-root {
|
|
118
|
+
--affine-editor-side-padding: 24px;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
.affine-database-page-missing {
|
|
122
|
+
padding: 16px 0;
|
|
123
|
+
color: var(--affine-text-secondary-color);
|
|
124
|
+
font-size: var(--affine-font-sm);
|
|
125
|
+
}
|
|
126
126
|
`; }
|
|
127
127
|
get hostBlockId() {
|
|
128
128
|
return this.std.get(DatabasePageHostBlockIdentifier).hostBlockId;
|
|
@@ -138,12 +138,12 @@ export class DatabasePageRoot extends BlockComponent {
|
|
|
138
138
|
const host = this.store.getModelById(this.hostBlockId);
|
|
139
139
|
const parent = host?.parent;
|
|
140
140
|
if (!host || !parent || host.flavour !== DATABASE_FLAVOUR) {
|
|
141
|
-
return html `<div
|
|
142
|
-
class="affine-database-page-missing"
|
|
143
|
-
data-testid="database-page-host-missing"
|
|
144
|
-
role="status"
|
|
145
|
-
>
|
|
146
|
-
${translateKey(this.std, ...DATABASE_PAGE_HOST_MISSING)}
|
|
141
|
+
return html `<div
|
|
142
|
+
class="affine-database-page-missing"
|
|
143
|
+
data-testid="database-page-host-missing"
|
|
144
|
+
role="status"
|
|
145
|
+
>
|
|
146
|
+
${translateKey(this.std, ...DATABASE_PAGE_HOST_MISSING)}
|
|
147
147
|
</div>`;
|
|
148
148
|
}
|
|
149
149
|
return this.host.renderChildren(parent, model => model.id === host.id);
|
|
@@ -97,85 +97,85 @@ let DatabasePageHost = (() => {
|
|
|
97
97
|
__esDecorate(this, null, _hostBlockId_decorators, { kind: "accessor", name: "hostBlockId", static: false, private: false, access: { has: obj => "hostBlockId" in obj, get: obj => obj.hostBlockId, set: (obj, value) => { obj.hostBlockId = value; } }, metadata: _metadata }, _hostBlockId_initializers, _hostBlockId_extraInitializers);
|
|
98
98
|
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
99
99
|
}
|
|
100
|
-
static { this.styles = css `
|
|
101
|
-
affine-database-page {
|
|
102
|
-
display: block;
|
|
103
|
-
height: 100%;
|
|
104
|
-
}
|
|
105
|
-
/* The page's only scroller, in both directions: the heading and the
|
|
106
|
-
views scroll as one page, and a wide table widens the page instead of
|
|
107
|
-
scrolling inside it (labre recette of 2026-10-26: a host viewport
|
|
108
|
-
around this one showed two scrollbars, then the column header, put
|
|
109
|
-
back by script on each scroll of a table that scrolled sideways
|
|
110
|
-
itself, jumped). */
|
|
111
|
-
affine-database-page > .affine-page-viewport {
|
|
112
|
-
display: flex;
|
|
113
|
-
flex-direction: column;
|
|
114
|
-
height: 100%;
|
|
115
|
-
overflow: auto;
|
|
116
|
-
/* The container the heading's narrow-screen query reads (doc-title,
|
|
117
|
-
outside the editor). Never a width to size with: on a scroller,
|
|
118
|
-
Chrome's 100cqw counts its vertical scrollbar (the editor-host
|
|
119
|
-
rule below). */
|
|
120
|
-
container-type: inline-size;
|
|
121
|
-
container-name: viewport;
|
|
122
|
-
/* A wide table scrolled sideways fades into the gutters instead of
|
|
123
|
-
being cut at the page's edges (labre recette of 2.0). The fade
|
|
124
|
-
stays in the gutter (at most 24px, the phone's), so nothing at
|
|
125
|
-
rest is faded. Its layer covers the padding box only: the two
|
|
126
|
-
layers below it give back the scrollbars, which sit between the
|
|
127
|
-
padding box and the border box.
|
|
128
|
-
A mask reads the alpha channel only, never the hue, so its opaque
|
|
129
|
-
stops are spelled currentColor: opaque in either theme and not a
|
|
130
|
-
raw colour the dark-chrome ratchet would count (ADR 0039). */
|
|
131
|
-
--affine-database-page-fade: min(
|
|
132
|
-
var(--affine-editor-side-padding, 24px),
|
|
133
|
-
24px
|
|
134
|
-
);
|
|
135
|
-
mask:
|
|
136
|
-
linear-gradient(
|
|
137
|
-
to right,
|
|
138
|
-
transparent,
|
|
139
|
-
currentColor var(--affine-database-page-fade),
|
|
140
|
-
currentColor calc(100% - var(--affine-database-page-fade)),
|
|
141
|
-
transparent
|
|
142
|
-
)
|
|
143
|
-
padding-box add,
|
|
144
|
-
linear-gradient(currentColor 0 0) border-box exclude,
|
|
145
|
-
linear-gradient(currentColor 0 0) padding-box;
|
|
146
|
-
}
|
|
147
|
-
/* The editor takes the height the heading leaves (std gives it 100%,
|
|
148
|
-
which overflowed by the heading's height: a scrollbar on a short
|
|
149
|
-
table).
|
|
150
|
-
It is also the container the page's widths read (the root's inset,
|
|
151
|
-
its narrow-screen query, the block's sticky view bar): a child of
|
|
152
|
-
the scroller, its width is the visible one. The scroller's own 100cqw
|
|
153
|
-
counted its vertical scrollbar, so as soon as a base scrolled down
|
|
154
|
-
the page overflowed sideways by that scrollbar's width and showed a
|
|
155
|
-
horizontal one (labre recette of 2.1). */
|
|
156
|
-
affine-database-page > .affine-page-viewport > editor-host {
|
|
157
|
-
flex: 1 0 auto;
|
|
158
|
-
height: auto;
|
|
159
|
-
container-type: inline-size;
|
|
160
|
-
container-name: viewport;
|
|
161
|
-
}
|
|
162
|
-
/* The heading stays in view when the page scrolls sideways, as wide as
|
|
163
|
-
the scroller shows (100%, not the scroller's 100cqw: see above). */
|
|
164
|
-
affine-database-page > .affine-page-viewport > doc-title {
|
|
165
|
-
position: sticky;
|
|
166
|
-
left: 0;
|
|
167
|
-
width: 100%;
|
|
168
|
-
}
|
|
169
|
-
/* A database page is a table, not a text: the heading sits on the view
|
|
170
|
-
bar, without the page title's bottom padding, its band's, or the
|
|
171
|
-
block's top margin and padding (the root's rule). */
|
|
172
|
-
affine-database-page
|
|
173
|
-
> .affine-page-viewport
|
|
174
|
-
> doc-title
|
|
175
|
-
.doc-title-container,
|
|
176
|
-
affine-database-page > .affine-page-viewport > doc-title .doc-title-band {
|
|
177
|
-
padding-bottom: 0;
|
|
178
|
-
}
|
|
100
|
+
static { this.styles = css `
|
|
101
|
+
affine-database-page {
|
|
102
|
+
display: block;
|
|
103
|
+
height: 100%;
|
|
104
|
+
}
|
|
105
|
+
/* The page's only scroller, in both directions: the heading and the
|
|
106
|
+
views scroll as one page, and a wide table widens the page instead of
|
|
107
|
+
scrolling inside it (labre recette of 2026-10-26: a host viewport
|
|
108
|
+
around this one showed two scrollbars, then the column header, put
|
|
109
|
+
back by script on each scroll of a table that scrolled sideways
|
|
110
|
+
itself, jumped). */
|
|
111
|
+
affine-database-page > .affine-page-viewport {
|
|
112
|
+
display: flex;
|
|
113
|
+
flex-direction: column;
|
|
114
|
+
height: 100%;
|
|
115
|
+
overflow: auto;
|
|
116
|
+
/* The container the heading's narrow-screen query reads (doc-title,
|
|
117
|
+
outside the editor). Never a width to size with: on a scroller,
|
|
118
|
+
Chrome's 100cqw counts its vertical scrollbar (the editor-host
|
|
119
|
+
rule below). */
|
|
120
|
+
container-type: inline-size;
|
|
121
|
+
container-name: viewport;
|
|
122
|
+
/* A wide table scrolled sideways fades into the gutters instead of
|
|
123
|
+
being cut at the page's edges (labre recette of 2.0). The fade
|
|
124
|
+
stays in the gutter (at most 24px, the phone's), so nothing at
|
|
125
|
+
rest is faded. Its layer covers the padding box only: the two
|
|
126
|
+
layers below it give back the scrollbars, which sit between the
|
|
127
|
+
padding box and the border box.
|
|
128
|
+
A mask reads the alpha channel only, never the hue, so its opaque
|
|
129
|
+
stops are spelled currentColor: opaque in either theme and not a
|
|
130
|
+
raw colour the dark-chrome ratchet would count (ADR 0039). */
|
|
131
|
+
--affine-database-page-fade: min(
|
|
132
|
+
var(--affine-editor-side-padding, 24px),
|
|
133
|
+
24px
|
|
134
|
+
);
|
|
135
|
+
mask:
|
|
136
|
+
linear-gradient(
|
|
137
|
+
to right,
|
|
138
|
+
transparent,
|
|
139
|
+
currentColor var(--affine-database-page-fade),
|
|
140
|
+
currentColor calc(100% - var(--affine-database-page-fade)),
|
|
141
|
+
transparent
|
|
142
|
+
)
|
|
143
|
+
padding-box add,
|
|
144
|
+
linear-gradient(currentColor 0 0) border-box exclude,
|
|
145
|
+
linear-gradient(currentColor 0 0) padding-box;
|
|
146
|
+
}
|
|
147
|
+
/* The editor takes the height the heading leaves (std gives it 100%,
|
|
148
|
+
which overflowed by the heading's height: a scrollbar on a short
|
|
149
|
+
table).
|
|
150
|
+
It is also the container the page's widths read (the root's inset,
|
|
151
|
+
its narrow-screen query, the block's sticky view bar): a child of
|
|
152
|
+
the scroller, its width is the visible one. The scroller's own 100cqw
|
|
153
|
+
counted its vertical scrollbar, so as soon as a base scrolled down
|
|
154
|
+
the page overflowed sideways by that scrollbar's width and showed a
|
|
155
|
+
horizontal one (labre recette of 2.1). */
|
|
156
|
+
affine-database-page > .affine-page-viewport > editor-host {
|
|
157
|
+
flex: 1 0 auto;
|
|
158
|
+
height: auto;
|
|
159
|
+
container-type: inline-size;
|
|
160
|
+
container-name: viewport;
|
|
161
|
+
}
|
|
162
|
+
/* The heading stays in view when the page scrolls sideways, as wide as
|
|
163
|
+
the scroller shows (100%, not the scroller's 100cqw: see above). */
|
|
164
|
+
affine-database-page > .affine-page-viewport > doc-title {
|
|
165
|
+
position: sticky;
|
|
166
|
+
left: 0;
|
|
167
|
+
width: 100%;
|
|
168
|
+
}
|
|
169
|
+
/* A database page is a table, not a text: the heading sits on the view
|
|
170
|
+
bar, without the page title's bottom padding, its band's, or the
|
|
171
|
+
block's top margin and padding (the root's rule). */
|
|
172
|
+
affine-database-page
|
|
173
|
+
> .affine-page-viewport
|
|
174
|
+
> doc-title
|
|
175
|
+
.doc-title-container,
|
|
176
|
+
affine-database-page > .affine-page-viewport > doc-title .doc-title-band {
|
|
177
|
+
padding-bottom: 0;
|
|
178
|
+
}
|
|
179
179
|
`; }
|
|
180
180
|
/** The editor of the page, once `store` and `hostBlockId` are set. */
|
|
181
181
|
get std() {
|
|
@@ -235,8 +235,8 @@ let DatabasePageHost = (() => {
|
|
|
235
235
|
render() {
|
|
236
236
|
// The page viewport the page extensions, and `<doc-title>`, look for
|
|
237
237
|
// above their host.
|
|
238
|
-
return html `<div class="affine-page-viewport">
|
|
239
|
-
${this.heading ?? nothing}${this.editorHost ?? nothing}
|
|
238
|
+
return html `<div class="affine-page-viewport">
|
|
239
|
+
${this.heading ?? nothing}${this.editorHost ?? nothing}
|
|
240
240
|
</div>`;
|
|
241
241
|
}
|
|
242
242
|
#store_accessor_storage;
|
package/dist/new-source-entry.js
CHANGED
|
@@ -86,10 +86,10 @@ export function newSourceEntry(std, naming, entry) {
|
|
|
86
86
|
if (suggested$.value === undefined)
|
|
87
87
|
return;
|
|
88
88
|
const value = verdictOf(naming, name$.value);
|
|
89
|
-
return html `<div
|
|
90
|
-
role="status"
|
|
91
|
-
data-testid="${entry.testId}-verdict"
|
|
92
|
-
data-verdict=${value}
|
|
89
|
+
return html `<div
|
|
90
|
+
role="status"
|
|
91
|
+
data-testid="${entry.testId}-verdict"
|
|
92
|
+
data-verdict=${value}
|
|
93
93
|
style=${styleMap({
|
|
94
94
|
padding: '0 6px',
|
|
95
95
|
fontSize: '12px',
|
|
@@ -97,9 +97,9 @@ export function newSourceEntry(std, naming, entry) {
|
|
|
97
97
|
color: value === 'ok'
|
|
98
98
|
? 'var(--affine-text-secondary-color)'
|
|
99
99
|
: 'var(--affine-error-color)',
|
|
100
|
-
})}
|
|
101
|
-
>
|
|
102
|
-
${t(VERDICT_WORDING[value])}
|
|
100
|
+
})}
|
|
101
|
+
>
|
|
102
|
+
${t(VERDICT_WORDING[value])}
|
|
103
103
|
</div>`;
|
|
104
104
|
};
|
|
105
105
|
return menu.subMenu({
|
|
@@ -187,11 +187,11 @@ export function typedSourceEntry(std, naming, listed, entry) {
|
|
|
187
187
|
// No "+" on a refused name (labre recette of 2.3.3): an icon made the
|
|
188
188
|
// status line read as a button.
|
|
189
189
|
if (verdict !== 'ok') {
|
|
190
|
-
return html `<div
|
|
191
|
-
role="status"
|
|
192
|
-
aria-disabled="true"
|
|
193
|
-
data-testid="${entry.testId}-typed"
|
|
194
|
-
data-verdict=${verdict}
|
|
190
|
+
return html `<div
|
|
191
|
+
role="status"
|
|
192
|
+
aria-disabled="true"
|
|
193
|
+
data-testid="${entry.testId}-typed"
|
|
194
|
+
data-verdict=${verdict}
|
|
195
195
|
style=${styleMap({
|
|
196
196
|
display: 'flex',
|
|
197
197
|
alignItems: 'center',
|
|
@@ -201,13 +201,13 @@ export function typedSourceEntry(std, naming, listed, entry) {
|
|
|
201
201
|
lineHeight: '22px',
|
|
202
202
|
color: 'var(--affine-text-disable-color)',
|
|
203
203
|
cursor: 'default',
|
|
204
|
-
})}
|
|
205
|
-
>
|
|
206
|
-
<span style="color: var(--affine-error-color)"
|
|
204
|
+
})}
|
|
205
|
+
>
|
|
206
|
+
<span style="color: var(--affine-error-color)"
|
|
207
207
|
>${std
|
|
208
208
|
? translateKey(std, ...VERDICT_WORDING[verdict])
|
|
209
|
-
: VERDICT_WORDING[verdict][1]}</span
|
|
210
|
-
>
|
|
209
|
+
: VERDICT_WORDING[verdict][1]}</span
|
|
210
|
+
>
|
|
211
211
|
</div>`;
|
|
212
212
|
}
|
|
213
213
|
// The typed text verbatim, so the menu's own search keeps the entry.
|
|
@@ -96,71 +96,71 @@ let DatabasePropertiesPanel = (() => {
|
|
|
96
96
|
}
|
|
97
97
|
static { this.styles = [
|
|
98
98
|
panelHeaderStyles,
|
|
99
|
-
css `
|
|
100
|
-
affine-database-properties-panel {
|
|
101
|
-
${unsafeCSS(dataViewCssVariable())}
|
|
102
|
-
display: flex;
|
|
103
|
-
flex-direction: column;
|
|
104
|
-
min-width: 0;
|
|
105
|
-
font-family: var(--affine-font-family);
|
|
106
|
-
color: var(--affine-text-primary-color);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
.affine-database-properties-panel-button {
|
|
110
|
-
display: inline-flex;
|
|
111
|
-
align-items: center;
|
|
112
|
-
justify-content: center;
|
|
113
|
-
width: 28px;
|
|
114
|
-
height: 28px;
|
|
115
|
-
padding: 0;
|
|
116
|
-
border: none;
|
|
117
|
-
border-radius: 4px;
|
|
118
|
-
background: transparent;
|
|
119
|
-
cursor: pointer;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
.affine-database-properties-panel-button:hover {
|
|
123
|
-
background: var(--affine-hover-color);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
.affine-database-properties-panel-button:focus-visible,
|
|
127
|
-
.affine-database-properties-panel-toggle:focus-visible {
|
|
128
|
-
outline: 2px solid var(--affine-primary-color);
|
|
129
|
-
outline-offset: 1px;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
.affine-database-properties-panel-bar {
|
|
133
|
-
display: flex;
|
|
134
|
-
justify-content: flex-end;
|
|
135
|
-
padding: 0 8px 4px;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
.affine-database-properties-panel-toggle {
|
|
139
|
-
padding: 4px 8px;
|
|
140
|
-
border: none;
|
|
141
|
-
border-radius: 4px;
|
|
142
|
-
background: transparent;
|
|
143
|
-
font-size: 12px;
|
|
144
|
-
line-height: 20px;
|
|
145
|
-
font-weight: 500;
|
|
146
|
-
color: var(--affine-primary-color);
|
|
147
|
-
cursor: pointer;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
.affine-database-properties-panel-toggle:hover {
|
|
151
|
-
background: var(--affine-hover-color);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
.affine-database-properties-panel-list {
|
|
155
|
-
padding: 0 4px;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
.affine-database-properties-panel-empty {
|
|
159
|
-
padding: 8px 12px;
|
|
160
|
-
font-size: 14px;
|
|
161
|
-
line-height: 22px;
|
|
162
|
-
color: var(--affine-text-secondary-color);
|
|
163
|
-
}
|
|
99
|
+
css `
|
|
100
|
+
affine-database-properties-panel {
|
|
101
|
+
${unsafeCSS(dataViewCssVariable())}
|
|
102
|
+
display: flex;
|
|
103
|
+
flex-direction: column;
|
|
104
|
+
min-width: 0;
|
|
105
|
+
font-family: var(--affine-font-family);
|
|
106
|
+
color: var(--affine-text-primary-color);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.affine-database-properties-panel-button {
|
|
110
|
+
display: inline-flex;
|
|
111
|
+
align-items: center;
|
|
112
|
+
justify-content: center;
|
|
113
|
+
width: 28px;
|
|
114
|
+
height: 28px;
|
|
115
|
+
padding: 0;
|
|
116
|
+
border: none;
|
|
117
|
+
border-radius: 4px;
|
|
118
|
+
background: transparent;
|
|
119
|
+
cursor: pointer;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.affine-database-properties-panel-button:hover {
|
|
123
|
+
background: var(--affine-hover-color);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.affine-database-properties-panel-button:focus-visible,
|
|
127
|
+
.affine-database-properties-panel-toggle:focus-visible {
|
|
128
|
+
outline: 2px solid var(--affine-primary-color);
|
|
129
|
+
outline-offset: 1px;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.affine-database-properties-panel-bar {
|
|
133
|
+
display: flex;
|
|
134
|
+
justify-content: flex-end;
|
|
135
|
+
padding: 0 8px 4px;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.affine-database-properties-panel-toggle {
|
|
139
|
+
padding: 4px 8px;
|
|
140
|
+
border: none;
|
|
141
|
+
border-radius: 4px;
|
|
142
|
+
background: transparent;
|
|
143
|
+
font-size: 12px;
|
|
144
|
+
line-height: 20px;
|
|
145
|
+
font-weight: 500;
|
|
146
|
+
color: var(--affine-primary-color);
|
|
147
|
+
cursor: pointer;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.affine-database-properties-panel-toggle:hover {
|
|
151
|
+
background: var(--affine-hover-color);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.affine-database-properties-panel-list {
|
|
155
|
+
padding: 0 4px;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.affine-database-properties-panel-empty {
|
|
159
|
+
padding: 8px 12px;
|
|
160
|
+
font-size: 14px;
|
|
161
|
+
line-height: 22px;
|
|
162
|
+
color: var(--affine-text-secondary-color);
|
|
163
|
+
}
|
|
164
164
|
`,
|
|
165
165
|
]; }
|
|
166
166
|
connectedCallback() {
|
|
@@ -179,22 +179,22 @@ let DatabasePropertiesPanel = (() => {
|
|
|
179
179
|
_renderHeader() {
|
|
180
180
|
const panel = this.std.getOptional(PropertiesPanelProvider);
|
|
181
181
|
const close = this._t(PROPERTIES_PANEL_CLOSE);
|
|
182
|
-
return html `<div class="affine-panel-header">
|
|
183
|
-
<div class="affine-panel-header-title">
|
|
184
|
-
${this._t(PROPERTIES_PANEL_TITLE)}
|
|
185
|
-
</div>
|
|
182
|
+
return html `<div class="affine-panel-header">
|
|
183
|
+
<div class="affine-panel-header-title">
|
|
184
|
+
${this._t(PROPERTIES_PANEL_TITLE)}
|
|
185
|
+
</div>
|
|
186
186
|
${panel
|
|
187
|
-
? html `<button
|
|
188
|
-
type="button"
|
|
189
|
-
class="affine-panel-header-button affine-database-properties-panel-button"
|
|
190
|
-
data-testid="database-properties-panel-close"
|
|
191
|
-
aria-label=${close}
|
|
192
|
-
title=${close}
|
|
193
|
-
@click=${this._close}
|
|
194
|
-
>
|
|
195
|
-
${CloseIcon({ width: '20px', height: '20px' })}
|
|
187
|
+
? html `<button
|
|
188
|
+
type="button"
|
|
189
|
+
class="affine-panel-header-button affine-database-properties-panel-button"
|
|
190
|
+
data-testid="database-properties-panel-close"
|
|
191
|
+
aria-label=${close}
|
|
192
|
+
title=${close}
|
|
193
|
+
@click=${this._close}
|
|
194
|
+
>
|
|
195
|
+
${CloseIcon({ width: '20px', height: '20px' })}
|
|
196
196
|
</button>`
|
|
197
|
-
: nothing}
|
|
197
|
+
: nothing}
|
|
198
198
|
</div>`;
|
|
199
199
|
}
|
|
200
200
|
_renderBody(view) {
|
|
@@ -209,34 +209,34 @@ let DatabasePropertiesPanel = (() => {
|
|
|
209
209
|
};
|
|
210
210
|
return html `${readonly
|
|
211
211
|
? nothing
|
|
212
|
-
: html `<div class="affine-database-properties-panel-bar">
|
|
213
|
-
<button
|
|
214
|
-
type="button"
|
|
215
|
-
class="affine-database-properties-panel-toggle"
|
|
216
|
-
data-testid="database-properties-panel-toggle-all"
|
|
217
|
-
@click=${toggleAll}
|
|
218
|
-
>
|
|
219
|
-
${this._t(allShown ? PROPERTIES_PANEL_HIDE_ALL : PROPERTIES_PANEL_SHOW_ALL)}
|
|
220
|
-
</button>
|
|
221
|
-
</div>`}
|
|
222
|
-
<div class="affine-database-properties-panel-list" ?inert=${readonly}>
|
|
223
|
-
<data-view-properties-setting
|
|
224
|
-
.view=${view}
|
|
225
|
-
.wording=${this._wording}
|
|
226
|
-
></data-view-properties-setting>
|
|
212
|
+
: html `<div class="affine-database-properties-panel-bar">
|
|
213
|
+
<button
|
|
214
|
+
type="button"
|
|
215
|
+
class="affine-database-properties-panel-toggle"
|
|
216
|
+
data-testid="database-properties-panel-toggle-all"
|
|
217
|
+
@click=${toggleAll}
|
|
218
|
+
>
|
|
219
|
+
${this._t(allShown ? PROPERTIES_PANEL_HIDE_ALL : PROPERTIES_PANEL_SHOW_ALL)}
|
|
220
|
+
</button>
|
|
221
|
+
</div>`}
|
|
222
|
+
<div class="affine-database-properties-panel-list" ?inert=${readonly}>
|
|
223
|
+
<data-view-properties-setting
|
|
224
|
+
.view=${view}
|
|
225
|
+
.wording=${this._wording}
|
|
226
|
+
></data-view-properties-setting>
|
|
227
227
|
</div>`;
|
|
228
228
|
}
|
|
229
229
|
render() {
|
|
230
230
|
void this._mounts$.value;
|
|
231
231
|
const view = propertiesPanelView(this.std, this.request);
|
|
232
|
-
return html `${this._renderHeader()}
|
|
232
|
+
return html `${this._renderHeader()}
|
|
233
233
|
${view
|
|
234
234
|
? this._renderBody(view)
|
|
235
|
-
: html `<div
|
|
236
|
-
class="affine-database-properties-panel-empty"
|
|
237
|
-
data-testid="database-properties-panel-unavailable"
|
|
238
|
-
>
|
|
239
|
-
${this._t(PROPERTIES_PANEL_UNAVAILABLE)}
|
|
235
|
+
: html `<div
|
|
236
|
+
class="affine-database-properties-panel-empty"
|
|
237
|
+
data-testid="database-properties-panel-unavailable"
|
|
238
|
+
>
|
|
239
|
+
${this._t(PROPERTIES_PANEL_UNAVAILABLE)}
|
|
240
240
|
</div>`}`;
|
|
241
241
|
}
|
|
242
242
|
#std_accessor_storage;
|
|
@@ -90,17 +90,17 @@ export function renameSourceEntry(std, target) {
|
|
|
90
90
|
const message = refusal$.value ?? warning(step);
|
|
91
91
|
if (!message)
|
|
92
92
|
return;
|
|
93
|
-
return html `<div
|
|
94
|
-
role="status"
|
|
95
|
-
data-testid="${TEST_ID}-status"
|
|
93
|
+
return html `<div
|
|
94
|
+
role="status"
|
|
95
|
+
data-testid="${TEST_ID}-status"
|
|
96
96
|
style=${styleMap({
|
|
97
97
|
padding: '0 6px',
|
|
98
98
|
fontSize: '12px',
|
|
99
99
|
lineHeight: '20px',
|
|
100
100
|
color: 'var(--affine-error-color)',
|
|
101
|
-
})}
|
|
102
|
-
>
|
|
103
|
-
${message}
|
|
101
|
+
})}
|
|
102
|
+
>
|
|
103
|
+
${message}
|
|
104
104
|
</div>`;
|
|
105
105
|
};
|
|
106
106
|
const warning = (step) => {
|
|
@@ -145,9 +145,9 @@ export function databaseViewSettingsMenu() {
|
|
|
145
145
|
menu.action({
|
|
146
146
|
name: wording(VIEW_SETTINGS_SOURCE),
|
|
147
147
|
prefix: DatabaseTableViewIcon(),
|
|
148
|
-
postfix: html ` <div style="font-size: 14px;">
|
|
149
|
-
${currentSourceTitle(std, change.dataSource)}
|
|
150
|
-
</div>
|
|
148
|
+
postfix: html ` <div style="font-size: 14px;">
|
|
149
|
+
${currentSourceTitle(std, change.dataSource)}
|
|
150
|
+
</div>
|
|
151
151
|
${ArrowRightSmallIcon()}`,
|
|
152
152
|
testId: 'dv-view-setting-source',
|
|
153
153
|
select: () => {
|
|
@@ -52,9 +52,9 @@ export function isViewSource(source, viewSourceId, viewDatabaseId) {
|
|
|
52
52
|
export function databaseLabel(source, untitled, selected = false) {
|
|
53
53
|
if (source.databaseId === undefined)
|
|
54
54
|
return undefined;
|
|
55
|
-
return html `<span
|
|
56
|
-
data-testid="source-database-label"
|
|
57
|
-
style="margin-left: auto; padding-left: 8px; font-size: 12px; color: var(--affine-text-secondary-color); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px;"
|
|
58
|
-
>${source.databaseTitle || untitled}</span
|
|
55
|
+
return html `<span
|
|
56
|
+
data-testid="source-database-label"
|
|
57
|
+
style="margin-left: auto; padding-left: 8px; font-size: 12px; color: var(--affine-text-secondary-color); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px;"
|
|
58
|
+
>${source.databaseTitle || untitled}</span
|
|
59
59
|
>${selected ? DoneIcon() : undefined}`;
|
|
60
60
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formicoidea/labre-core-database",
|
|
3
3
|
"description": "Labre core-database editing chrome for @formicoidea/labre-core.",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.5.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"author": "lajola",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"dist"
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@formicoidea/labre-core": "3.
|
|
30
|
+
"@formicoidea/labre-core": "3.5.0",
|
|
31
31
|
"@blocksuite/icons": "^2.2.12",
|
|
32
32
|
"@preact/signals-core": "^1.8.0",
|
|
33
33
|
"lit": "^3.2.0"
|