@formicoidea/labre-core-database 0.57.0 → 0.59.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.
@@ -81,6 +81,34 @@ export class DatabasePageRoot extends BlockComponent {
81
81
  affine-database-page-root div:has(> affine-database-title) {
82
82
  display: none !important;
83
83
  }
84
+ /* The view bar sits under the page heading: no top margin or padding
85
+ of the inline block. The attribute outweighs the block's emotion class
86
+ (one class); its sides and bottom stay the inline block's. */
87
+ affine-database-page-root affine-database[data-block-id] {
88
+ margin-top: 0;
89
+ padding-top: 0;
90
+ }
91
+ /* A table is as wide as its columns: the page scrolls sideways, so the
92
+ column header sticks natively to the page's top (data-view's column
93
+ header then leaves it alone). The table's own wrappers stop being
94
+ scrollers, the view bar stays in view, a viewport wide. */
95
+ affine-database-page-root:has(dv-table-view-ui) {
96
+ width: max-content;
97
+ min-width: 100%;
98
+ }
99
+ affine-database-page-root .dv-table-wrapper,
100
+ affine-database-page-root .dv-table-scroll-container {
101
+ overflow: visible;
102
+ }
103
+ affine-database-page-root affine-database-column-header {
104
+ position: sticky;
105
+ top: 0;
106
+ }
107
+ affine-database-page-root div:has(> div > affine-database-title) {
108
+ position: sticky;
109
+ left: var(--affine-editor-side-padding, 24px);
110
+ width: calc(100cqw - 2 * var(--affine-editor-side-padding, 24px));
111
+ }
84
112
  /* A phone keeps the page root's narrow padding (page-root-block.ts). */
85
113
  @container viewport (width <= 640px) {
86
114
  affine-database-page-root {
@@ -1,5 +1,5 @@
1
1
  import { type BlockStdOptions, BlockStdScope, ShadowlessElement } from '@formicoidea/labre-core/std';
2
- import { nothing, type PropertyValues } from 'lit';
2
+ import { type PropertyValues } from 'lit';
3
3
  declare const DatabasePageHost_base: typeof ShadowlessElement & import("@formicoidea/labre-core/_pkgs/global/utils/types.js").Constructor<import("@formicoidea/labre-core/global/lit").DisposableClass>;
4
4
  /**
5
5
  * The full-page database host (ADR 0035 §1, B13; labre PRD REQ-DB-7).
@@ -36,10 +36,17 @@ export declare class DatabasePageHost extends DatabasePageHost_base {
36
36
  connectedCallback(): void;
37
37
  disconnectedCallback(): void;
38
38
  protected willUpdate(changed: PropertyValues<this>): void;
39
- render(): import("lit-html").TemplateResult<1> | typeof nothing;
39
+ render(): import("lit-html").TemplateResult<1>;
40
40
  accessor store: BlockStdOptions['store'];
41
41
  /** The page-scope view extensions the host mounts its page editor with. */
42
42
  accessor extensions: BlockStdOptions['extensions'];
43
+ /**
44
+ * The page title the host draws above the views, a `<doc-title>` with its
45
+ * `bodyBlockId` set to `hostBlockId`. The page renders it inside its own
46
+ * viewport, so the title and the views scroll as one page; it shows before
47
+ * the editor exists.
48
+ */
49
+ accessor heading: HTMLElement | null;
43
50
  /** The id of the `affine:database` block whose `props.views` the page shows. */
44
51
  accessor hostBlockId: string;
45
52
  }
@@ -77,6 +77,9 @@ let DatabasePageHost = (() => {
77
77
  let _extensions_decorators;
78
78
  let _extensions_initializers = [];
79
79
  let _extensions_extraInitializers = [];
80
+ let _heading_decorators;
81
+ let _heading_initializers = [];
82
+ let _heading_extraInitializers = [];
80
83
  let _hostBlockId_decorators;
81
84
  let _hostBlockId_initializers = [];
82
85
  let _hostBlockId_extraInitializers = [];
@@ -85,22 +88,57 @@ let DatabasePageHost = (() => {
85
88
  const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
86
89
  _store_decorators = [property({ attribute: false })];
87
90
  _extensions_decorators = [property({ attribute: false })];
91
+ _heading_decorators = [property({ attribute: false })];
88
92
  _hostBlockId_decorators = [property({ attribute: false })];
89
93
  __esDecorate(this, null, _store_decorators, { kind: "accessor", name: "store", static: false, private: false, access: { has: obj => "store" in obj, get: obj => obj.store, set: (obj, value) => { obj.store = value; } }, metadata: _metadata }, _store_initializers, _store_extraInitializers);
90
94
  __esDecorate(this, null, _extensions_decorators, { kind: "accessor", name: "extensions", static: false, private: false, access: { has: obj => "extensions" in obj, get: obj => obj.extensions, set: (obj, value) => { obj.extensions = value; } }, metadata: _metadata }, _extensions_initializers, _extensions_extraInitializers);
95
+ __esDecorate(this, null, _heading_decorators, { kind: "accessor", name: "heading", static: false, private: false, access: { has: obj => "heading" in obj, get: obj => obj.heading, set: (obj, value) => { obj.heading = value; } }, metadata: _metadata }, _heading_initializers, _heading_extraInitializers);
91
96
  __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);
92
97
  if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
93
98
  }
94
99
  static { this.styles = css `
95
100
  affine-database-page {
96
101
  display: block;
102
+ height: 100%;
97
103
  }
104
+ /* The page's only scroller, in both directions: the heading and the
105
+ views scroll as one page, and a wide table widens the page instead of
106
+ scrolling inside it (labre recette of 2026-10-26: a host viewport
107
+ around this one showed two scrollbars, then the column header, put
108
+ back by script on each scroll of a table that scrolled sideways
109
+ itself, jumped). */
98
110
  affine-database-page > .affine-page-viewport {
111
+ display: flex;
112
+ flex-direction: column;
99
113
  height: 100%;
114
+ overflow: auto;
100
115
  /* The container the page root's narrow-screen query reads. */
101
116
  container-type: inline-size;
102
117
  container-name: viewport;
103
118
  }
119
+ /* The editor takes the height the heading leaves (std gives it 100%,
120
+ which overflowed by the heading's height: a scrollbar on a short
121
+ table). */
122
+ affine-database-page > .affine-page-viewport > editor-host {
123
+ flex: 1 0 auto;
124
+ height: auto;
125
+ }
126
+ /* The heading stays in view when the page scrolls sideways. */
127
+ affine-database-page > .affine-page-viewport > doc-title {
128
+ position: sticky;
129
+ left: 0;
130
+ width: 100cqw;
131
+ }
132
+ /* A database page is a table, not a text: the heading sits on the view
133
+ bar, without the page title's bottom padding, its band's, or the
134
+ block's top margin and padding (the root's rule). */
135
+ affine-database-page
136
+ > .affine-page-viewport
137
+ > doc-title
138
+ .doc-title-container,
139
+ affine-database-page > .affine-page-viewport > doc-title .doc-title-band {
140
+ padding-bottom: 0;
141
+ }
104
142
  `; }
105
143
  /** The editor of the page, once `store` and `hostBlockId` are set. */
106
144
  get std() {
@@ -154,10 +192,11 @@ let DatabasePageHost = (() => {
154
192
  this.editorHost = this._std?.render();
155
193
  }
156
194
  render() {
157
- if (!this.editorHost)
158
- return nothing;
159
- // The page viewport the page extensions look for above their host.
160
- return html `<div class="affine-page-viewport">${this.editorHost}</div>`;
195
+ // The page viewport the page extensions, and `<doc-title>`, look for
196
+ // above their host.
197
+ return html `<div class="affine-page-viewport">
198
+ ${this.heading ?? nothing}${this.editorHost ?? nothing}
199
+ </div>`;
161
200
  }
162
201
  #store_accessor_storage;
163
202
  get store() { return this.#store_accessor_storage; }
@@ -166,6 +205,15 @@ let DatabasePageHost = (() => {
166
205
  /** The page-scope view extensions the host mounts its page editor with. */
167
206
  get extensions() { return this.#extensions_accessor_storage; }
168
207
  set extensions(value) { this.#extensions_accessor_storage = value; }
208
+ #heading_accessor_storage;
209
+ /**
210
+ * The page title the host draws above the views, a `<doc-title>` with its
211
+ * `bodyBlockId` set to `hostBlockId`. The page renders it inside its own
212
+ * viewport, so the title and the views scroll as one page; it shows before
213
+ * the editor exists.
214
+ */
215
+ get heading() { return this.#heading_accessor_storage; }
216
+ set heading(value) { this.#heading_accessor_storage = value; }
169
217
  #hostBlockId_accessor_storage;
170
218
  /** The id of the `affine:database` block whose `props.views` the page shows. */
171
219
  get hostBlockId() { return this.#hostBlockId_accessor_storage; }
@@ -177,7 +225,8 @@ let DatabasePageHost = (() => {
177
225
  this.guard = undefined;
178
226
  this.#store_accessor_storage = __runInitializers(this, _store_initializers, void 0);
179
227
  this.#extensions_accessor_storage = (__runInitializers(this, _store_extraInitializers), __runInitializers(this, _extensions_initializers, []));
180
- this.#hostBlockId_accessor_storage = (__runInitializers(this, _extensions_extraInitializers), __runInitializers(this, _hostBlockId_initializers, ''));
228
+ this.#heading_accessor_storage = (__runInitializers(this, _extensions_extraInitializers), __runInitializers(this, _heading_initializers, null));
229
+ this.#hostBlockId_accessor_storage = (__runInitializers(this, _heading_extraInitializers), __runInitializers(this, _hostBlockId_initializers, ''));
181
230
  __runInitializers(this, _hostBlockId_extraInitializers);
182
231
  }
183
232
  };
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": "0.57.0",
4
+ "version": "0.59.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": "0.57.0",
30
+ "@formicoidea/labre-core": "0.59.0",
31
31
  "@blocksuite/icons": "^2.2.12",
32
32
  "@preact/signals-core": "^1.8.0",
33
33
  "lit": "^3.2.0"