@almadar/std 16.192.0 → 16.193.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.
@@ -1,5 +1,5 @@
1
1
  app std-tree "1.0.0"
2
- "std-tree — generic hierarchical node browser. Fetches a flat TreeNode collection and renders it through file-tree's flat `items` mode (parentId-nested at render time by the component, not the .lolo); OPEN_NODE is the external handoff for a selected node's id. Rebindable: pass `fields` at the call site to retarget it at any parent-pointer entity (categories, org units, comment threads). Search/filter are wired (REFETCH_QUERY/REFETCH_FILTER re-fetch the flat node set server-side); pagination is deliberately NOT offered — a hierarchy is not a paged list, and paging a flat node set would sever children from parents that fell on another page."
2
+ "std-tree — generic hierarchical node browser. Fetches a flat TreeNode collection and renders it through file-tree's flat `items` mode (parentId-nested at render time by the component, not the .lolo); OPEN_NODE is the external handoff for a selected node's id. Rebindable: pass `fields` at the call site to retarget it at any parent-pointer entity (categories, org units, comment threads). Search/filter are wired (REFETCH_QUERY/REFETCH_FILTER re-fetch the flat node set server-side). `look: rail` renders the compact sidebar-navigation form (slim caption, nav-styled rows) for mounting in an app layout's sidebarTrait; SET_CURRENT marks the open record so the row highlights and its ancestors auto-expand; `childAction: true` renders a hover plus-affordance per row emitting CHILD_REQUESTED { parentId } for the host's create-draft writer; pagination is deliberately NOT offered — a hierarchy is not a paged list, and paging a flat node set would sever children from parents that fell on another page."
3
3
  type FilterSpec = { field : string!, label : string, options : [string] }
4
4
  orbital TreeNodeOrbital {
5
5
  type TreeNodeLoaded = Event { data : [TreeNode] } "Fired when the tree node collection finishes loading"
@@ -18,6 +18,11 @@ orbital TreeNodeOrbital {
18
18
  initial: loading
19
19
 
20
20
  state loading {
21
+ SET_CURRENT -> loading
22
+ (set @entity.id ?id)
23
+ (fetch TreeNode {
24
+ emit: { failure: TreeNodeLoadFailed, success: TreeNodeLoaded }
25
+ })
21
26
  INIT -> loading
22
27
  (fetch TreeNode {
23
28
  emit: { failure: TreeNodeLoadFailed, success: TreeNodeLoaded }
@@ -37,7 +42,13 @@ orbital TreeNodeOrbital {
37
42
  })
38
43
  TreeNodeLoaded -> browsing
39
44
  (render-ui main {
40
- children: [{
45
+ children: [(if ["=", @config.look, "rail"] {
46
+ className: "px-2 pb-1 uppercase tracking-wide"
47
+ color: muted
48
+ content: @config.title
49
+ type: typography
50
+ variant: caption
51
+ } {
41
52
  align: center
42
53
  children: [{ name: list-tree, type: icon }, {
43
54
  content: @config.title
@@ -52,7 +63,11 @@ orbital TreeNodeOrbital {
52
63
  direction: horizontal
53
64
  gap: sm
54
65
  type: stack
55
- }, { type: divider }, (if @config.bodySearch {
66
+ }), (if ["=", @config.look, "rail"] {
67
+ children: []
68
+ gap: none
69
+ type: stack
70
+ } { type: divider }), (if @config.bodySearch {
56
71
  children: [{
57
72
  className: "w-full max-w-md"
58
73
  clearable: true
@@ -84,12 +99,17 @@ orbital TreeNodeOrbital {
84
99
  type: stack
85
100
  }), {
86
101
  items: (array/map ?data (fn row {
87
- icon: @row.icon
102
+ icon: (str/default (object/get @row @config.iconField) "")
88
103
  id: @row.id
89
- label: @row.name
90
- parentId: @row.parentId
104
+ label: (str/default (object/get @row @config.labelField) "")
105
+ parentId: (str/default (object/get @row @config.parentField) "")
91
106
  }))
107
+ look: (if ["=", @config.look, "rail"] nav files)
108
+ nodeActionIcon: plus
109
+ nodeActionLabel: @config.childActionLabel
110
+ onNodeAction: (if @config.childAction ADD_CHILD null)
92
111
  onNodeSelect: OPEN_NODE
112
+ selectedId: (str/default (object/get @entity id) "")
93
113
  type: file-tree
94
114
  }]
95
115
  direction: vertical
@@ -153,7 +173,7 @@ orbital TreeNodeOrbital {
153
173
  REFETCH_QUERY -> browsing
154
174
  (fetch TreeNode {
155
175
  emit: { failure: TreeNodeLoadFailed, success: TreeNodeLoaded }
156
- filter: (or ["=", ?searchTerm, ""] (str/includes (object/get @entity name) ?searchTerm))
176
+ filter: (or ["=", ?searchTerm, ""] (str/includes (str/default (object/get @entity @config.labelField) "") ?searchTerm))
157
177
  })
158
178
  REFETCH_FILTER -> browsing
159
179
  (fetch TreeNode {
@@ -162,9 +182,25 @@ orbital TreeNodeOrbital {
162
182
  })
163
183
  OPEN_NODE -> browsing
164
184
  (set @entity.id ?id)
185
+ ;; The open record changed (routed from the host document's load
186
+ ;; events): remember it and re-fetch so the re-render highlights the
187
+ ;; row and unfolds its ancestors.
188
+ SET_CURRENT -> browsing
189
+ (set @entity.id ?id)
190
+ (fetch TreeNode {
191
+ emit: { failure: TreeNodeLoadFailed, success: TreeNodeLoaded }
192
+ })
193
+ ADD_CHILD -> browsing
194
+ (emit CHILD_REQUESTED { parentId: ?id })
165
195
  TreeNodeLoaded -> browsing
166
196
  (render-ui main {
167
- children: [{
197
+ children: [(if ["=", @config.look, "rail"] {
198
+ className: "px-2 pb-1 uppercase tracking-wide"
199
+ color: muted
200
+ content: @config.title
201
+ type: typography
202
+ variant: caption
203
+ } {
168
204
  align: center
169
205
  children: [{ name: list-tree, type: icon }, {
170
206
  content: @config.title
@@ -179,7 +215,11 @@ orbital TreeNodeOrbital {
179
215
  direction: horizontal
180
216
  gap: sm
181
217
  type: stack
182
- }, { type: divider }, (if @config.bodySearch {
218
+ }), (if ["=", @config.look, "rail"] {
219
+ children: []
220
+ gap: none
221
+ type: stack
222
+ } { type: divider }), (if @config.bodySearch {
183
223
  children: [{
184
224
  className: "w-full max-w-md"
185
225
  clearable: true
@@ -211,12 +251,17 @@ orbital TreeNodeOrbital {
211
251
  type: stack
212
252
  }), {
213
253
  items: (array/map ?data (fn row {
214
- icon: @row.icon
254
+ icon: (str/default (object/get @row @config.iconField) "")
215
255
  id: @row.id
216
- label: @row.name
217
- parentId: @row.parentId
256
+ label: (str/default (object/get @row @config.labelField) "")
257
+ parentId: (str/default (object/get @row @config.parentField) "")
218
258
  }))
259
+ look: (if ["=", @config.look, "rail"] nav files)
260
+ nodeActionIcon: plus
261
+ nodeActionLabel: @config.childActionLabel
262
+ onNodeAction: (if @config.childAction ADD_CHILD null)
219
263
  onNodeSelect: OPEN_NODE
264
+ selectedId: (str/default (object/get @entity id) "")
220
265
  type: file-tree
221
266
  }]
222
267
  direction: vertical
@@ -275,6 +320,12 @@ orbital TreeNodeOrbital {
275
320
  @description "Signals a tree node has been selected for external handoff."
276
321
  @synonyms "select, choose, open, activate"
277
322
  @tier "domain"
323
+ CHILD_REQUESTED -> external {
324
+ parentId : string!
325
+ }
326
+ @description "Create a new record under this node — the host routes it into its create-draft writer with parentId stamped."
327
+ @synonyms "new subpage, add child page, create under"
328
+ @tier "domain"
278
329
  TreeNodeLoaded {
279
330
  data : [TreeNode]
280
331
  }
@@ -291,6 +342,18 @@ orbital TreeNodeOrbital {
291
342
  }
292
343
 
293
344
  listens {
345
+ SET_CURRENT {
346
+ id : string!
347
+ }
348
+ @description "Mark this record as the open one (routed from the host document's load events); its row highlights and its ancestors auto-expand."
349
+ @synonyms "highlight current, select node, you are here"
350
+ @tier "domain"
351
+ ADD_CHILD {
352
+ id : string!
353
+ }
354
+ @description "The row's hover + affordance was clicked."
355
+ @synonyms "add inside, new child"
356
+ @tier "presentation"
294
357
  REFETCH_QUERY {
295
358
  searchTerm : string!
296
359
  }
@@ -330,6 +393,35 @@ orbital TreeNodeOrbital {
330
393
  @label "Section title"
331
394
  @description "Heading shown above the tree"
332
395
  @tier "presentation"
396
+ labelField : string = name
397
+ @label "Label column"
398
+ @description "Entity field rendered as each node's label. Config-driven on purpose: the trait-level `fields {}` remap is compiled-path-only (the JS runtime never applies it), so a rebind names its columns here and both execution paths agree."
399
+ @synonyms "title field, name column, display field"
400
+ @tier "domain"
401
+ parentField : string = parentId
402
+ @label "Parent column"
403
+ @description "Entity field holding the parent reference the hierarchy nests by."
404
+ @synonyms "parent id field, hierarchy column"
405
+ @tier "domain"
406
+ iconField : string = icon
407
+ @label "Icon column"
408
+ @description "Entity field holding each node's icon name; point it at a nonexistent field (or empty) to suppress per-node icons."
409
+ @synonyms "glyph field, icon column"
410
+ @tier "presentation"
411
+ look : "full" | "rail" = full
412
+ @label "Tree look"
413
+ @description "full = standalone section (heading, count, divider); rail = compact sidebar navigation (slim caption, nav-styled rows) for an app layout's sidebarTrait slot."
414
+ @synonyms "sidebar tree, rail look, nav tree, compact"
415
+ @tier "presentation"
416
+ childAction : boolean = false
417
+ @label "Row + affordance?"
418
+ @description "Render a hover + on every row that emits CHILD_REQUESTED { parentId } — wire it to the host's create-draft writer so new records are born inside the node."
419
+ @synonyms "add inside, new subpage button, plus on rows"
420
+ @tier "domain"
421
+ childActionLabel : string = "Add inside"
422
+ @label "Row + tooltip"
423
+ @description "Accessible label on the row's + affordance (e.g. New subpage)."
424
+ @tier "presentation"
333
425
  bodySearch : boolean = false
334
426
  @label "Show the tree's own search box?"
335
427
  @description "Embeds a search box above the tree that re-fetches the flat node set server-side. Set false (the default) when the page already provides a search affordance (a toolbar Search molecule), so the surface shows one search box instead of two."
@@ -29,8 +29,13 @@ orbital FileTreeOrbital {
29
29
  tree: @config.tree
30
30
  items: @config.items
31
31
  selectedPath: @config.selectedPath
32
+ selectedId: @config.selectedId
33
+ look: @config.look
32
34
  onFileSelect: @config.onFileSelect
33
35
  onNodeSelect: @config.onNodeSelect
36
+ onNodeAction: @config.onNodeAction
37
+ nodeActionIcon: @config.nodeActionIcon
38
+ nodeActionLabel: @config.nodeActionLabel
34
39
  className: @config.className
35
40
  indent: @config.indent
36
41
  type: file-tree
@@ -58,6 +63,14 @@ orbital FileTreeOrbital {
58
63
  @label "Selected Path"
59
64
  @description "Currently selected file path"
60
65
  @tier "presentation"
66
+ selectedId : string
67
+ @label "Selected Id"
68
+ @description "Currently selected node id, in flat `items` mode: the row highlights and every ancestor auto-expands so the selection is always visible — the 'you are here' a navigation tree needs."
69
+ @tier "presentation"
70
+ look : "files" | "nav" = files
71
+ @label "Look"
72
+ @description "Visual treatment for flat `items` mode: `files` (default) keeps the monospace file-browser look; `nav` renders a sidebar navigation tree — regular font, document icons, roomier hit areas."
73
+ @tier "presentation"
61
74
  onFileSelect : string = "FILE_SELECT"
62
75
  @label "On File Select"
63
76
  @description "Called when a file is clicked"
@@ -66,6 +79,18 @@ orbital FileTreeOrbital {
66
79
  @label "On Node Select"
67
80
  @description "Called when a node is clicked, in flat `items` mode; carries the selected node's id. Presence-gated: binding this prop is what turns on the click-to-select affordance, mirroring Badge's `onRemove`."
68
81
  @tier "presentation"
82
+ onNodeAction : string = ""
83
+ @label "On Node Action"
84
+ @description "Called from the row's hover action button, in flat `items` mode; carries that node's id. Presence-gated: binding it renders the action."
85
+ @tier "presentation"
86
+ nodeActionIcon : string
87
+ @label "Node Action Icon"
88
+ @description "Icon for the row hover action (default: plus)."
89
+ @tier "presentation"
90
+ nodeActionLabel : string
91
+ @label "Node Action Label"
92
+ @description "Accessible label/tooltip for the row hover action."
93
+ @tier "presentation"
69
94
  className : string
70
95
  @label "Class Name"
71
96
  @description "CSS class"
@@ -52,6 +52,7 @@ orbital DashboardLayoutOrbital {
52
52
  onNotificationClick: @config.onNotificationClick
53
53
  showThemeToggle: @config.showThemeToggle
54
54
  sidebarFooter: @config.sidebarFooter
55
+ sidebarContent: @config.sidebarContent
55
56
  currentPath: @config.currentPath
56
57
  onSignOut: @config.onSignOut
57
58
  layoutMode: @config.layoutMode
@@ -140,6 +141,10 @@ orbital DashboardLayoutOrbital {
140
141
  @label "Sidebar Footer"
141
142
  @description "Custom sidebar footer (optional). When omitted, the sidebar has no footer — apps that need Settings/etc. add them via navItems."
142
143
  @tier "presentation"
144
+ sidebarContent : node
145
+ @label "Sidebar Content"
146
+ @description "Optional content region rendered between the nav links and the footer — a page tree or any consumer navigation surface; scrolls independently and takes the sidebar's remaining height. Hidden in the collapsed rail."
147
+ @tier "presentation"
143
148
  currentPath : string
144
149
  @label "Current Path"
145
150
  @description "Active path used to highlight the matching nav item. Falls back to `useCurrentPagePath()` (set by `CurrentPagePathProvider`), then to `useLocation().pathname`. Production deploys can omit it; the studio preview passes the in-frame `?page=` value so highlighting works inside the embedded playground where `pathname` would be the studio route."
@@ -256,6 +256,13 @@
256
256
  "tier": "internal",
257
257
  "type": "string"
258
258
  },
259
+ "sidebarTrait": {
260
+ "description": "Optional trait rendered in the sidebar between the nav links and the footer — the Notion/Confluence-style always-visible page tree; scrolls independently. Unset renders plain nav only.",
261
+ "label": "Sidebar trait",
262
+ "synonyms": "sidebar tree, nav tree, page tree in sidebar, hierarchy rail",
263
+ "tier": "presentation",
264
+ "type": "trait"
265
+ },
259
266
  "theme": {
260
267
  "default": "@currentTheme",
261
268
  "description": "Data-theme attribute applied to the layout root (e.g. almadar-website-dark).",
@@ -510,6 +517,7 @@
510
517
  "notificationClickEvent": "@config.notificationClickEvent",
511
518
  "notifications": "@config.notifications",
512
519
  "searchEvent": "@config.searchEvent",
520
+ "sidebarContent": "@config.sidebarTrait",
513
521
  "topBarActions": "@config.topBarActions",
514
522
  "type": "@config.layoutPattern",
515
523
  "user": [