@mistriwork/engine 1.0.0-rc.17 → 1.0.0-rc.19

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.
Files changed (64) hide show
  1. package/dist/adapters/adapter.d.ts +35 -2
  2. package/dist/adapters/adapter.js +32 -1
  3. package/dist/adapters/postgres.js +8 -4
  4. package/dist/adapters/scoped/scopedReads.js +23 -5
  5. package/dist/adapters/scoped/sqliteTriggers.js +65 -38
  6. package/dist/adapters/sqlite.js +8 -4
  7. package/dist/server/columnGrants.d.ts +5 -0
  8. package/dist/server/connections.d.ts +1 -0
  9. package/dist/server/connections.js +13 -3
  10. package/dist/server/http/firstPaint.d.ts +5 -1
  11. package/dist/server/http/firstPaint.js +4 -4
  12. package/dist/server/httpConnection.d.ts +4 -2
  13. package/dist/server/httpConnection.js +10 -3
  14. package/dist/server/journalStore.d.ts +2 -2
  15. package/dist/server/journalStore.js +33 -10
  16. package/dist/server/resourceReadHttp.d.ts +4 -2
  17. package/dist/server/resourceReadHttp.js +40 -4
  18. package/dist/server/resourceReadOperations.d.ts +4 -0
  19. package/dist/server/scaffoldMachine.js +12 -1
  20. package/dist/shared/boardLanes.d.ts +44 -0
  21. package/dist/shared/boardLanes.js +69 -0
  22. package/dist/shared/builtInThemes.js +26 -20
  23. package/dist/shared/dashboardAsks.d.ts +2 -0
  24. package/dist/shared/filter.d.ts +2 -0
  25. package/dist/shared/filter.js +3 -2
  26. package/dist/shared/form.d.ts +24 -1
  27. package/dist/shared/form.js +53 -0
  28. package/dist/shared/keysetPage.js +3 -0
  29. package/dist/shared/listInference.d.ts +91 -0
  30. package/dist/shared/listInference.js +323 -0
  31. package/dist/shared/listPresentations.d.ts +3 -0
  32. package/dist/shared/listQuestion.d.ts +2 -0
  33. package/dist/shared/listQuestion.js +1 -0
  34. package/dist/shared/pageAnatomy.d.ts +27 -3
  35. package/dist/shared/pageAnatomy.js +217 -36
  36. package/dist/shared/pageModel.d.ts +17 -1
  37. package/dist/shared/pageModel.js +8 -0
  38. package/dist/shared/query.d.ts +2 -0
  39. package/dist/shared/query.js +11 -3
  40. package/dist/shared/reads.d.ts +9 -0
  41. package/dist/shared/reads.js +9 -0
  42. package/dist/shared/recordLabel.d.ts +5 -0
  43. package/dist/shared/recordLabel.js +22 -2
  44. package/dist/shared/recordReads.d.ts +30 -0
  45. package/dist/shared/recordReads.js +72 -8
  46. package/dist/shared/referenceSubline.d.ts +18 -0
  47. package/dist/shared/referenceSubline.js +62 -0
  48. package/dist/shared/resourceHttp.d.ts +5 -0
  49. package/dist/shared/rowScope.js +52 -6
  50. package/dist/shared/schema.d.ts +2 -0
  51. package/dist/shared/servedApp.d.ts +18 -0
  52. package/dist/shared/servedApp.js +10 -0
  53. package/dist/shared/theme.js +20 -3
  54. package/dist/shared/themeLooks.js +61 -35
  55. package/dist/shared/themeRecipeWords.d.ts +5 -0
  56. package/dist/shared/themeRecipeWords.js +6 -1
  57. package/dist/shared/themeRecipes.d.ts +6 -1
  58. package/dist/shared/themeRecipes.js +4 -0
  59. package/dist/shared/themeType.js +2 -1
  60. package/dist/shared/view.js +29 -2
  61. package/dist/shared/viewLabels.js +16 -0
  62. package/dist/shared/viewPaths.d.ts +9 -0
  63. package/package.json +4 -1
  64. package/schema/theme.d.ts +9 -4
@@ -59,7 +59,7 @@ function withPalettes(look) {
59
59
  The title weight (`type.roles.title.weight`) is never past 700: a heavier
60
60
  ask resolved a book face to its Black cut, a masthead where a title was
61
61
  meant, and broke the record's head. Mono titles at 700; Lumen's and Sage's
62
- softer titles at 600; Workshop's condensed capitals at 700.
62
+ softer titles at 600; Workshop's condensed bold at 700.
63
63
 
64
64
  Each wears every palette in lookPalettes.ts; its own colors are its
65
65
  default palette's (Workshop's Safety orange, Lumen's Cobalt, Mono's and
@@ -67,30 +67,40 @@ function withPalettes(look) {
67
67
  book's own deep green). */
68
68
  const HOUSE = [
69
69
  {
70
- // The desk as a workbench, ported from a field report's theme: warm paper,
71
- // ink-black type and fills, and one restrained hue — Safety orange unless
72
- // a palette says another. The hue reaches only the marks a reader takes
73
- // for the brand color: the primary verb (the ink's words on it, as a
74
- // hazard tag prints them), links and the current tab's rule, a 3px marker
75
- // beside the menu's ink block (like a tool's slot on a pegboard), the
76
- // focus ring, a checked box and the first chart series. Fills, rules and
77
- // selection stay the ink, and nothing is tinted. Titles, section heads
78
- // and labels are Barlow's semi-condensed bold in capitals, the rest
79
- // Barlow; heavy 2px ink rules part the sections and stand under a
80
- // table's heads, corners are near-square and nothing floats; the menu
81
- // sits on a faint grain (workshopLook.css; docs/design.md, Workshop).
70
+ // The desk as a workbench, ported from a field report's theme, and
71
+ // refreshed in rc.18 so the work sits on white: the warm paper and its
72
+ // grain frame it (the top bar, the menu and one band behind a page's
73
+ // head: a list's title, tabs and filters, a record's trail, name and
74
+ // facts), as a sheet is clipped to a board, and rows, fields and cards
75
+ // stay white. Ink-black type and one restrained hue — Safety orange
76
+ // unless a palette says another. The hue reaches only the marks a reader
77
+ // takes for the brand color: the primary verb, filled, with the ink's
78
+ // words on it as a hazard tag prints them (the look's one idea), links
79
+ // and the current tab's rule, a 3px marker beside the menu's current
80
+ // entry (like a tool's slot on a pegboard), the focus ring, a checked
81
+ // box and the first chart series. The current entry is a soft tint of
82
+ // the menu's ink, by day and by night: the brightest thing on a screen
83
+ // is the orange verb, never the menu. Barlow's semi-condensed bold sets
84
+ // the titles, in sentence case, a stat's figures and the App's name, the
85
+ // one word in capitals (the brand's stamp); sections, tabs, column heads
86
+ // and labels are Barlow in sentence case, the labels in the muted ink.
87
+ // Hairlines part the sections and close a table's heads, corners are
88
+ // near-square and nothing floats (workshopLook.css; docs/design.md,
89
+ // Workshop).
82
90
  id: 'workshop',
83
91
  label: 'Workshop',
84
92
  defaultPalette: 'safety',
85
93
  colors: {
86
94
  light: {
87
- ground: '#f2ede3',
88
- surface: '#faf8f3',
89
- raised: '#ece6da',
95
+ // White to work on; the paper (#f2ede3) is the frame's: the menu, the bar and the band behind a page's head,
96
+ // which is the raised ground (recipes.header 'band'), so a hovered row is the paper too.
97
+ ground: '#fbfaf7',
98
+ surface: '#ffffff',
99
+ raised: '#f2ede3',
90
100
  ink: '#1b1813',
91
101
  inkMuted: '#4f483d',
92
102
  inkSubtle: '#5f574b',
93
- line: '#ddd5c6',
103
+ line: '#e6e1d8',
94
104
  lineStrong: '#8b8274',
95
105
  lineControl: '#7d7466',
96
106
  accentInk: '#1b1813',
@@ -100,54 +110,65 @@ const HOUSE = [
100
110
  shadow: '#3a3020',
101
111
  status: { good: '#106b38', warning: '#934a06', critical: '#c52a2a', info: '#2f5578' },
102
112
  nav: {
103
- ground: '#ebe5d9',
113
+ ground: '#f2ede3',
104
114
  ink: '#1b1813',
105
115
  muted: '#4f483d',
106
116
  line: '#d8cfbe',
107
117
  accent: '#1b1813',
118
+ // The current entry: the ink at 7% over the paper, in the ink, its orange slot kept (workshopLook.css).
119
+ current: '#e3ded4',
120
+ onCurrent: '#1b1813',
108
121
  },
109
- rules: { section: '#1b1813', head: '#1b1813' },
122
+ // Hairlines, not 2px of ink: a section and a table's heads stand on the rule a row does.
123
+ rules: { section: '#e6e1d8', head: '#e6e1d8' },
110
124
  chart: ['#2b2620', '#9a6cf7', '#0e9a6c', '#d97706', '#e0428a', '#0e8fb0', '#a3510b', '#94a3b8'],
111
125
  },
112
126
  dark: {
113
- ground: '#15130f',
114
- surface: '#1d1a15',
115
- raised: '#26221c',
127
+ ground: '#121110',
128
+ surface: '#1a1917',
129
+ raised: '#24221f',
116
130
  ink: '#efe9de',
117
131
  inkMuted: '#c2b9aa',
118
132
  inkSubtle: '#a59c8d',
119
- line: '#2f2a22',
133
+ line: '#2c2a26',
120
134
  lineStrong: '#6d6555',
121
135
  lineControl: '#7a7262',
122
136
  accentInk: '#efe9de',
123
- accentSoft: '#2c261e',
137
+ accentSoft: '#2a2723',
124
138
  primary: '#efe9de',
125
139
  link: '#efe9de',
126
140
  status: { good: '#4ade80', warning: '#fbbf24', critical: '#f87171', info: '#91a8ff' },
127
141
  nav: {
128
- ground: '#110f0c',
142
+ ground: '#0f0e0d',
129
143
  ink: '#efe9de',
130
144
  muted: '#b3aa9b',
131
- line: '#26221c',
145
+ line: '#24221f',
132
146
  accent: '#efe9de',
147
+ // The ink at 10% over the menu's ground, not the inverted cream block, which was the brightest thing on a
148
+ // screen at night.
149
+ current: '#252422',
150
+ onCurrent: '#efe9de',
133
151
  },
134
- rules: { section: '#8a8170', head: '#8a8170' },
152
+ rules: { section: '#2c2a26', head: '#2c2a26' },
135
153
  chart: ['#d9d0c0', '#9a78ec', '#12a678', '#c88317', '#e0559b', '#1597b9', '#d26b3b', '#6b7694'],
136
154
  },
137
155
  },
138
156
  shape: {
139
157
  radius: { control: '2px', field: '2px', pill: '2px', panel: '2px' },
140
158
  elevation: 'flat',
141
- border: { panel: '1px', rule: '2px' },
159
+ border: { panel: '1px', rule: '1px' },
142
160
  },
143
161
  type: {
144
162
  font: { ui: BARLOW, data: BARLOW, heading: BARLOW_CONDENSED },
145
163
  base: '14px',
146
164
  roles: {
147
- title: { face: 'heading', size: '30px', weight: 700, case: 'upper', tracking: '0.01em', leading: 1.1 },
148
- heading: { face: 'heading', size: '22px', weight: 700, case: 'upper', tracking: '0.01em' },
149
- section: { face: 'heading', size: '15px', weight: 700, case: 'upper', tracking: '0.04em' },
150
- label: { face: 'heading', weight: 700, case: 'upper', tracking: '0.06em' },
165
+ // A page still names itself in the workshop's voice, the condensed bold, in sentence case.
166
+ title: { face: 'heading', size: '28px', weight: 700, case: 'none', tracking: '0em', leading: 1.15 },
167
+ heading: { face: 'heading', size: '23px', weight: 700, case: 'none', tracking: '0em' },
168
+ section: { face: 'ui', size: '15px', weight: 600, case: 'none', tracking: '0em' },
169
+ // A step under the base, in the semibold the look already ships: Barlow comes at 400 and 600 only, so a 500
170
+ // drew at 400, as loud as the values under it. The muted ink (parts below) keeps the 600 quieter than a value.
171
+ label: { face: 'ui', size: '12px', weight: 600, case: 'none', tracking: '0em' },
151
172
  data: { features: ['tnum'] },
152
173
  figure: { face: 'heading', size: '38px', weight: 700, features: ['tnum'] },
153
174
  nav: { weight: 500 },
@@ -162,7 +183,8 @@ const HOUSE = [
162
183
  bar: 'ruled',
163
184
  tabs: 'rule',
164
185
  windows: 'segmented',
165
- stat: 'ruled',
186
+ // One divided strip of figures, not a 2px ink rule over each.
187
+ stat: 'divided',
166
188
  section: 'open',
167
189
  fields: 'open',
168
190
  table: 'open',
@@ -170,14 +192,17 @@ const HOUSE = [
170
192
  board: 'ruled',
171
193
  chart: 'plain',
172
194
  buttons: 'keyed',
195
+ // A filter not yet asked for is a key on a solid edge, as the search beside it is, not a dashed place.
196
+ filters: 'solid',
173
197
  links: 'plain',
174
- rules: 'ink',
198
+ rules: 'hairline',
175
199
  avatar: 'plain',
176
200
  workflow: 'markers',
177
201
  banner: 'plain',
178
202
  steps: 'strip',
179
203
  lanes: 'tag',
180
- header: 'plain',
204
+ // The paper under a page's head: the frame reaches the title, tabs and filters, and the rows start on white.
205
+ header: 'band',
181
206
  },
182
207
  },
183
208
  {
@@ -283,6 +308,7 @@ const HOUSE = [
283
308
  board: 'strip',
284
309
  chart: 'line',
285
310
  buttons: 'raised',
311
+ filters: 'quiet',
286
312
  rules: 'hairline',
287
313
  avatar: 'round',
288
314
  workflow: 'markers',
@@ -127,6 +127,11 @@ export declare const RECIPE_WORDS: {
127
127
  readonly band: 'A record’s head and a list’s are one band of the raised ground from edge to edge: the trail, the title, its status, facts and verbs, a list’s tabs and filters; the contents keep their edge.';
128
128
  readonly hero: 'A band, with the record’s avatar large beside its title (above it on a phone); a record without one, and a list, draw the band.';
129
129
  };
130
+ readonly filters: {
131
+ readonly dashed: 'A list’s filter not yet asked for is its name behind a +, on a dashed hairline: a place for a filter, not a field.';
132
+ readonly solid: 'A list’s filter not yet asked for is its name behind a + on a solid edge: a key, as the search beside it is, not a place.';
133
+ readonly quiet: 'A list’s filter not yet asked for has no edge, its name in the muted ink, until a pointer is over it: then it sits on the raised ground.';
134
+ };
130
135
  readonly required: {
131
136
  readonly star: 'A required field wears a red star after its label; an optional one wears nothing.';
132
137
  readonly 'optional-word': 'A required field wears nothing and an optional one says “(optional)” after its label, quietly; the form’s own words, in the reader’s language.';
@@ -115,6 +115,11 @@ export const RECIPE_WORDS = {
115
115
  band: 'A record’s head and a list’s are one band of the raised ground from edge to edge: the trail, the title, its status, facts and verbs, a list’s tabs and filters; the contents keep their edge.',
116
116
  hero: 'A band, with the record’s avatar large beside its title (above it on a phone); a record without one, and a list, draw the band.',
117
117
  },
118
+ filters: {
119
+ dashed: 'A list’s filter not yet asked for is its name behind a +, on a dashed hairline: a place for a filter, not a field.',
120
+ solid: 'A list’s filter not yet asked for is its name behind a + on a solid edge: a key, as the search beside it is, not a place.',
121
+ quiet: 'A list’s filter not yet asked for has no edge, its name in the muted ink, until a pointer is over it: then it sits on the raised ground.',
122
+ },
118
123
  required: {
119
124
  star: 'A required field wears a red star after its label; an optional one wears nothing.',
120
125
  'optional-word': 'A required field wears nothing and an optional one says “(optional)” after its label, quietly; the form’s own words, in the reader’s language.',
@@ -149,7 +154,7 @@ export const TYPE_WORDS = {
149
154
  heading: 'A list naming itself over its rows: its face, size (16px to 28px), leading, tracking, weight (omitted, the title’s), case and features.',
150
155
  section: 'A section’s title on a record and a dashboard: its face, case and features; a dashboard’s section title also takes a size (12px to 20px), tracking and weight.',
151
156
  body: 'Prose, fields and the interface, at the base size: its leading (1.35 to 1.8) and features.',
152
- label: 'A column’s head, a stat’s label and a record’s tabs, at the base size: their face, tracking, weight (400 to 700), case and features; upper sets them a step smaller.',
157
+ label: 'A column’s head, a stat’s label and a record’s tabs, at the base size: their face, size (11px to 14px), tracking, weight (400 to 700), case and features; upper sets them a step smaller unless a size is said.',
153
158
  data: 'A table’s cells and a record’s values, in the data face at the base size: their features, tabular figures kept, and its reach: every value, or figures only (figures, keys and dates, a record header’s facts too).',
154
159
  figure: 'A stat’s figure: its face, size (18px to 40px), tracking, weight and features, tabular figures kept.',
155
160
  nav: 'The menu’s entries in the bar, at the base size: their face, tracking, weight (400 to 600) and case; upper sets them a step smaller.',
@@ -134,6 +134,11 @@ export declare const RECIPE_MENU: {
134
134
  readonly band: null;
135
135
  readonly hero: null;
136
136
  };
137
+ readonly filters: {
138
+ readonly dashed: null;
139
+ readonly solid: 'workshop';
140
+ readonly quiet: 'lumen';
141
+ };
137
142
  readonly required: {
138
143
  readonly star: null;
139
144
  readonly 'optional-word': null;
@@ -206,7 +211,7 @@ export declare function typeAttributes(type: ThemeTypeDefinition | undefined): R
206
211
  * The published parts a theme may dress one by one (themeParts.ts says what each may take and how it is worn). Here,
207
212
  * with the words the root wears for them, because the first paint sets `data-parts` as it sets the recipes'.
208
213
  */
209
- export declare const THEME_PARTS: readonly ["ground", "bar", "bar.search", "nav", "nav.item", "nav.current", "nav.group", "logo", "page.title", "tabs", "tab.current", "section", "section.title", "stat", "stat.figure", "fields", "field.label", "table", "table.head", "table.row", "status", "tag", "button.primary", "button.secondary", "button.quiet", "link", "board.lane", "board.card", "workflow.step", "banner", "steps.step", "avatar", "menu", "dialog", "chart"];
214
+ export declare const THEME_PARTS: readonly ["ground", "bar", "bar.search", "nav", "nav.item", "nav.current", "nav.group", "logo", "page.title", "tabs", "tab.current", "section", "section.title", "stat", "stat.figure", "fields", "field.label", "table", "table.head", "table.row", "status", "tag", "button.primary", "button.secondary", "button.quiet", "link", "board.lane", "board.card", "workflow.step", "banner", "steps.step", "avatar", "identityMark", "menu", "dialog", "chart"];
210
215
  /** What a part style may say, in the order its words are written. */
211
216
  export declare const PART_PROPERTIES: readonly ['ground', 'ink', 'edge', 'radius', 'lift', 'face', 'weight', 'case'];
212
217
  /** The root's `data-parts`: one word per property a part says (`stat:ground button.primary:case`); undefined when none. */
@@ -30,6 +30,9 @@ export const RECIPE_MENU = {
30
30
  steps: { flat: null, tinted: 'lumen', strip: 'lumen' },
31
31
  lanes: { tint: null, tag: 'brand', plain: 'brand' },
32
32
  header: { plain: null, band: null, hero: null },
33
+ /* A list's filter not yet asked for: its own part, so a theme may keep its keyed or raised buttons and still pick the
34
+ adders' edge (Workshop keys them solid; Lumen's are quiet, as its raised buttons were). */
35
+ filters: { dashed: null, solid: 'workshop', quiet: 'lumen' },
33
36
  /* The four below are a form's: their rules are in @mistriwork/ui's forms.css, which arrives with the first control
34
37
  a page draws, so no first stylesheet carries them and the menu names no sheet of a look. */
35
38
  required: { star: null, 'optional-word': null },
@@ -213,6 +216,7 @@ export const THEME_PARTS = [
213
216
  'banner',
214
217
  'steps.step',
215
218
  'avatar',
219
+ 'identityMark',
216
220
  'menu',
217
221
  'dialog',
218
222
  'chart',
@@ -26,7 +26,8 @@ export const TYPE_ROLES = {
26
26
  },
27
27
  section: { takes: ['face', 'size', 'tracking', 'weight', 'case', 'features'], size: [12, 20], weights: WEIGHTS },
28
28
  body: { takes: ['leading', 'features'], leading: [1.35, 1.8] },
29
- label: { takes: ['face', 'tracking', 'weight', 'case', 'features'], weights: [400, 500, 600, 700] },
29
+ /* A step either side of the base (text-xs to text-md): a label is filed-under words, never a heading's size. */
30
+ label: { takes: ['face', 'size', 'tracking', 'weight', 'case', 'features'], size: [11, 14], weights: [400, 500, 600, 700] },
30
31
  data: { takes: ['features', 'reach'] },
31
32
  figure: { takes: ['face', 'size', 'tracking', 'weight', 'features'], size: [18, 40], weights: WEIGHTS },
32
33
  nav: { takes: ['face', 'tracking', 'weight', 'case'], weights: [400, 500, 600] },
@@ -35,7 +35,7 @@
35
35
  * a second predicate builder existing to disagree with the first.
36
36
  */
37
37
  import { ANSI_STYLE, buildWhere, collate, orderClauseSql, } from './filter.js';
38
- import { clampLimit, clampOffset, countStatement } from './reads.js';
38
+ import { clampLimit, clampOffset, countStatement, LANE_ROW } from './reads.js';
39
39
  import { aggregateInput, declaredOrder, findTable, } from './schema.js';
40
40
  import { ANY_CONDITION, anyConditions, expandSegments, parseQuery, splitClauseTail } from './query.js';
41
41
  import { stitchedListProblem } from './stitchedPaths.js';
@@ -345,8 +345,33 @@ export function compileView(schema, view, style, offset = 0, scope) {
345
345
  }
346
346
  const limit = clampLimit(view.limit);
347
347
  const skip = clampOffset(offset);
348
+ /* A board's lanes: the partition's path is planned with the rest, before the joins are frozen. */
349
+ const lanes = view.lanes ? { by: qualify(view.lanes.by), most: clampLimit(view.lanes.limit) } : undefined;
348
350
  const joins = plan.clauses();
349
351
  const prefix = relations.finish();
352
+ if (lanes) {
353
+ /* The order is the window's, and so comes first in the statement: its parameters are numbered before the WHERE's. */
354
+ const within = orderClauseSql(order, style, prefix.params.length + 1);
355
+ const filtered = buildWhere(conditions, style, prefix.params.length + within.params.length + 1, qualify, qualify, membership, exists, false, typeOf);
356
+ const n = prefix.params.length + within.params.length + filtered.params.length;
357
+ const [outer, number] = [style.quote('lanes'), style.quote(LANE_ROW)];
358
+ const inner = [
359
+ `SELECT ${select.join(',\n ')},\n ROW_NUMBER() OVER (PARTITION BY ${lanes.by}${within.text}) AS ${number}`,
360
+ ` FROM ${baseRelation} ${style.quote(plan.baseAlias)}`,
361
+ ...joins,
362
+ ...(filtered.text ? [filtered.text] : []),
363
+ ];
364
+ return {
365
+ text: prefix.text +
366
+ `SELECT ${columns.map((column) => `${outer}.${style.quote(column.name)}`).join(', ')}\n FROM (\n${inner.join('\n')}\n) AS ${outer}` +
367
+ ` WHERE ${outer}.${number} <= ${style.placeholder(n + 1)} ORDER BY ${outer}.${number}` +
368
+ ` LIMIT ${style.placeholder(n + 2)} OFFSET ${style.placeholder(n + 3)}`,
369
+ params: [...prefix.params, ...within.params, ...filtered.params, lanes.most, limit, skip],
370
+ columns,
371
+ joins: plan.joins,
372
+ limit,
373
+ };
374
+ }
350
375
  /* The other side of a column comparison is a path like any other: resolved
351
376
  against this catalog, so a reader's pruned graph refuses one it may not
352
377
  read exactly as it refuses the left. */
@@ -582,7 +607,9 @@ export function parseViewQuery(schema, baseId, text, now, options = {}) {
582
607
  (c.other === undefined ? { path: c.column, op: c.op, value: c.value } : { path: c.column, op: c.op, other: c.other }))),
583
608
  },
584
609
  columns: query.columns,
585
- orderBy: query.orderBy.map((o) => aliases.has(o.column) ? { path: o.column, direction: o.direction, alias: true } : { path: o.column, direction: o.direction }),
610
+ orderBy: query.orderBy.map((o) => aliases.has(o.column)
611
+ ? { path: o.column, direction: o.direction, alias: true }
612
+ : { path: o.column, direction: o.direction, ...(o.nulls ? { nulls: o.nulls } : {}) }),
586
613
  limit: query.limit,
587
614
  errors,
588
615
  };
@@ -372,6 +372,8 @@ export function viewPaths(schema, view, plan, style, relations) {
372
372
  .join(' ');
373
373
  return `CASE ${value} ${cases} ELSE COALESCE(${value}, '') END`;
374
374
  }
375
+ if (field.date)
376
+ return dayText(value, style, literal);
375
377
  return `COALESCE(${value}, '')`;
376
378
  };
377
379
  /* A fallback chain is its first alternative with a value: each said as it would alone, an empty text
@@ -387,6 +389,20 @@ export function viewPaths(schema, view, plan, style, relations) {
387
389
  : plainType(schema, view.base, path);
388
390
  return { resolve, qualify, membership, exists, typeOf };
389
391
  }
392
+ const MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
393
+ /**
394
+ * A date or a timestamp, as text, said as a day a person reads ("Sep 13, 2026"): a name's `{starts_at|date}`
395
+ * (recordLabel.ts). Read off the text every engine writes a date as — `YYYY-MM-DD`, then any time — with SUBSTR and
396
+ * CASE alone, which all three say alike, so no engine's date functions or session settings enter a name. A value
397
+ * not written that way (an epoch, a typo in a text column) is said as it is stored. The year is always said: a
398
+ * name is read in lists of any age, and the day is the record's as stored, not moved into the reader's zone.
399
+ */
400
+ function dayText(value, style, literal) {
401
+ const month = `CASE SUBSTR(${value}, 6, 2) ${MONTHS.map((word, at) => `WHEN ${literal(String(at + 1).padStart(2, '0'))} THEN ${literal(`${word} `)}`).join(' ')} ELSE '' END`;
402
+ const day = `CASE WHEN SUBSTR(${value}, 9, 1) = '0' THEN SUBSTR(${value}, 10, 1) ELSE SUBSTR(${value}, 9, 2) END`;
403
+ const iso = `SUBSTR(${value}, 5, 1) = '-' AND SUBSTR(${value}, 8, 1) = '-'`;
404
+ return `CASE WHEN ${iso} THEN ${style.concat([month, day, literal(', '), `SUBSTR(${value}, 1, 4)`])} ELSE COALESCE(${value}, '') END`;
405
+ }
390
406
  /* What a stored column is to an expression that reads it: a yes-or-no column native or a 0/1 integer. */
391
407
  function columnRead(column) {
392
408
  if (!column)
@@ -86,6 +86,15 @@ export interface ViewDef {
86
86
  filter?: ViewFilter;
87
87
  orderBy?: ViewOrder[];
88
88
  limit?: number;
89
+ /**
90
+ * Each value of `by` (a path) its first `limit` rows in the view's order, as one statement: a board's lanes
91
+ * (adapter.ts lanesStatement, boardLanes.ts). The page then cuts across the lanes, the first of each before any
92
+ * second. Set by the run route for a board, never by a request's view.
93
+ */
94
+ lanes?: {
95
+ by: string;
96
+ limit: number;
97
+ };
89
98
  /**
90
99
  * The view written down, in the same language.
91
100
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mistriwork/engine",
3
- "version": "1.0.0-rc.17",
3
+ "version": "1.0.0-rc.19",
4
4
  "description": "The engine both products stand on: the adapters (SQLite, Postgres), the catalog, the query language, keyset pages, the HTTP kit and the shared rules. No React.",
5
5
  "homepage": "https://mistriwork.dev",
6
6
  "bugs": {
@@ -160,6 +160,7 @@
160
160
  "./shared/appNoun.js": "./dist/shared/appNoun.js",
161
161
  "./shared/autoBucket.js": "./dist/shared/autoBucket.js",
162
162
  "./shared/autoValues.js": "./dist/shared/autoValues.js",
163
+ "./shared/boardLanes.js": "./dist/shared/boardLanes.js",
163
164
  "./shared/breakdown.js": "./dist/shared/breakdown.js",
164
165
  "./shared/breakdowntext.js": "./dist/shared/breakdowntext.js",
165
166
  "./shared/decimals.js": "./dist/shared/decimals.js",
@@ -194,6 +195,7 @@
194
195
  "./shared/keysetPage.js": "./dist/shared/keysetPage.js",
195
196
  "./shared/listEmpty.js": "./dist/shared/listEmpty.js",
196
197
  "./shared/listFilters.js": "./dist/shared/listFilters.js",
198
+ "./shared/listInference.js": "./dist/shared/listInference.js",
197
199
  "./shared/listPresentations.js": "./dist/shared/listPresentations.js",
198
200
  "./shared/listQuestion.js": "./dist/shared/listQuestion.js",
199
201
  "./shared/maskQuoted.js": "./dist/shared/maskQuoted.js",
@@ -223,6 +225,7 @@
223
225
  "./shared/recordReads.js": "./dist/shared/recordReads.js",
224
226
  "./shared/recordview.js": "./dist/shared/recordview.js",
225
227
  "./shared/referenceModel.js": "./dist/shared/referenceModel.js",
228
+ "./shared/referenceSubline.js": "./dist/shared/referenceSubline.js",
226
229
  "./shared/refusal.js": "./dist/shared/refusal.js",
227
230
  "./shared/relatedCreate.js": "./dist/shared/relatedCreate.js",
228
231
  "./shared/resourceHttp.js": "./dist/shared/resourceHttp.js",
package/schema/theme.d.ts CHANGED
@@ -172,6 +172,7 @@ export type ThemePart =
172
172
  | 'banner'
173
173
  | 'steps.step'
174
174
  | 'avatar'
175
+ | 'identityMark'
175
176
  | 'menu'
176
177
  | 'dialog'
177
178
  | 'chart';
@@ -332,6 +333,9 @@ export interface ThemeRecipes {
332
333
  page's ground, on a band of the raised ground from edge to edge, or a band with the record's avatar large beside
333
334
  its title. It paints the box the page placed: it never moves a region, adds to the head or reorders it. */
334
335
  header?: 'plain' | 'band' | 'hero';
336
+ /** A list's filter not yet asked for ("+ Status"): on a dashed hairline, on a solid edge, or with no edge until a
337
+ pointer is over it. Its own part, so a theme picks it apart from its buttons. */
338
+ filters?: 'dashed' | 'solid' | 'quiet';
335
339
  /** A required field's mark: a red star after its label, or the word "(optional)" after the labels of the fields that
336
340
  may be left empty (`aria-required` stays either way). The words are the form's, in the reader's language. */
337
341
  required?: 'star' | 'optional-word';
@@ -455,8 +459,8 @@ type TypeWeight = 400 | 500 | 600 | 700 | 800 | 900;
455
459
 
456
460
  /**
457
461
  * Each kind of text, by what it is for. A role says only what differs from the look; its size is the size at the
458
- * 13px base, and grows with `base`. Body, data, label and navigation text has no size of its own: it follows the
459
- * base. A weight past 700 is for a face the theme ships at that weight (`type.faces`); `check` warns of one it does
462
+ * 13px base, and grows with `base`. Body, data and navigation text has no size of its own: it follows the base. A
463
+ * label's may be set a step either side of it. A weight past 700 is for a face the theme ships at that weight (`type.faces`); `check` warns of one it does
460
464
  * not (theme-type).
461
465
  */
462
466
  export interface ThemeTypeRoles {
@@ -471,8 +475,9 @@ export interface ThemeTypeRoles {
471
475
  section?: { face?: ThemeTypeFace; size?: TypePx; tracking?: TypeEm; weight?: TypeWeight; case?: ThemeTypeCase; features?: readonly ThemeTypeFeature[] };
472
476
  /** Prose, fields and the interface: its leading, 1.35 to 1.8. */
473
477
  body?: { leading?: number; features?: readonly ThemeTypeFeature[] };
474
- /** The short names things are filed under: a column's head, a stat's label, a record's tabs. */
475
- label?: { face?: ThemeTypeFace; tracking?: TypeEm; weight?: 400 | 500 | 600 | 700; case?: ThemeTypeCase; features?: readonly ThemeTypeFeature[] };
478
+ /** The short names things are filed under: a column's head, a stat's label, a record's tabs. 11px to 14px, a step
479
+ either side of the base; omitted, the base (a step under it in capitals). */
480
+ label?: { face?: ThemeTypeFace; size?: TypePx; tracking?: TypeEm; weight?: 400 | 500 | 600 | 700; case?: ThemeTypeCase; features?: readonly ThemeTypeFeature[] };
476
481
  /** A table's cells and a record's values, in the data face; tabular figures stay. `reach: 'figures'` sets only
477
482
  the figures, keys and dates in it (a table's, a field's and a record header's facts), and leaves names and words
478
483
  in the interface face; omitted, every value is in it, and a header's figures too. */