@link-foundation/ui-components 0.0.0-stage → 0.1.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/CONFIGURATIONS.md +74 -0
- package/ICONS.md +76 -0
- package/LICENSE +24 -0
- package/README.md +1499 -2
- package/bin/lino-network.mjs +71 -0
- package/dist/icons/ATTRIBUTION.md +602 -0
- package/dist/icons/NOTICE.lino +1261 -0
- package/dist/icons/brand.js +31 -0
- package/dist/icons/brand.svg +3 -0
- package/dist/icons/licenses/brand/DISCLAIMER.md +51 -0
- package/dist/icons/licenses/brand/LICENSE.md +30 -0
- package/dist/icons/licenses/lucide/LICENSE +43 -0
- package/dist/icons/licenses/material-symbols/LICENSE +202 -0
- package/dist/icons/licenses/material-symbols/NOTICE +12 -0
- package/dist/icons/licenses/tabler/LICENSE +21 -0
- package/dist/icons/lucide.js +681 -0
- package/dist/icons/lucide.svg +34 -0
- package/dist/icons/material-symbols.js +681 -0
- package/dist/icons/material-symbols.svg +34 -0
- package/dist/icons/own.js +521 -0
- package/dist/icons/own.svg +34 -0
- package/dist/icons/tabler.js +681 -0
- package/dist/icons/tabler.svg +34 -0
- package/dist/network-layout-NOTICE.md +6 -0
- package/dist/network-layout-d3-dispatch-LICENSE.txt +13 -0
- package/dist/network-layout-d3-force-LICENSE.txt +13 -0
- package/dist/network-layout-d3-quadtree-LICENSE.txt +13 -0
- package/dist/network-layout-d3-timer-LICENSE.txt +13 -0
- package/dist/network-layout-dagre-LICENSE.txt +19 -0
- package/dist/network-layout.worker.mjs +2 -0
- package/package.json +246 -4
- package/src/a11y/announce.js +88 -0
- package/src/a11y/bind-machine.js +181 -0
- package/src/a11y/focus.js +169 -0
- package/src/a11y/index.d.ts +89 -0
- package/src/a11y/index.js +19 -0
- package/src/a11y/keys.js +182 -0
- package/src/a11y/roving.js +167 -0
- package/src/a11y/typeahead.js +82 -0
- package/src/behavior/actions.js +235 -0
- package/src/behavior/diagnostics.js +73 -0
- package/src/behavior/dom.d.ts +38 -0
- package/src/behavior/dom.js +420 -0
- package/src/behavior/index.d.ts +211 -0
- package/src/behavior/index.js +29 -0
- package/src/behavior/interpret.js +454 -0
- package/src/behavior/machines/disclosure.lino +46 -0
- package/src/behavior/machines/index.js +91 -0
- package/src/behavior/machines/toggle.lino +25 -0
- package/src/behavior/parse-machine.js +367 -0
- package/src/charts/README.md +78 -0
- package/src/charts/activity-layout.js +350 -0
- package/src/charts/activity-model.js +130 -0
- package/src/charts/activity-validation.js +31 -0
- package/src/charts/chart-model.js +667 -0
- package/src/charts/chart.js +518 -0
- package/src/charts/echarts-adapter.d.ts +23 -0
- package/src/charts/echarts-adapter.js +240 -0
- package/src/charts/element.js +330 -0
- package/src/charts/errors.js +62 -0
- package/src/charts/gauge.js +27 -0
- package/src/charts/index.d.ts +344 -0
- package/src/charts/index.js +59 -0
- package/src/charts/layout.js +542 -0
- package/src/charts/lino.js +158 -0
- package/src/charts/mark-options.js +78 -0
- package/src/charts/read.js +101 -0
- package/src/charts/renderer-features.js +8 -0
- package/src/charts/scales.js +223 -0
- package/src/charts/small-model.js +223 -0
- package/src/charts/small-svg.js +269 -0
- package/src/charts/sparkline.js +27 -0
- package/src/charts/stat-tile.js +37 -0
- package/src/charts/summary.js +193 -0
- package/src/charts/svg-renderer.js +226 -0
- package/src/charts/svg.js +69 -0
- package/src/charts/tag-cloud.js +129 -0
- package/src/charts/tokens.js +171 -0
- package/src/charts/tooltip.js +47 -0
- package/src/charts/values.js +146 -0
- package/src/chat/README.md +142 -0
- package/src/chat/actions.js +75 -0
- package/src/chat/chat-contract.js +95 -0
- package/src/chat/chat-list.js +42 -0
- package/src/chat/chat-model.js +125 -0
- package/src/chat/chat.css +228 -0
- package/src/chat/composer.js +131 -0
- package/src/chat/day-separator.js +12 -0
- package/src/chat/dom.js +33 -0
- package/src/chat/follow.js +49 -0
- package/src/chat/index.d.ts +142 -0
- package/src/chat/index.js +13 -0
- package/src/chat/message-bubble.js +191 -0
- package/src/chat/message-stream.js +331 -0
- package/src/chat/reasoning-trace.js +70 -0
- package/src/chat/selection.js +39 -0
- package/src/chat/skins/bubbles.lino +2 -0
- package/src/chat/skins/cards.lino +4 -0
- package/src/chat/skins/compact.lino +4 -0
- package/src/chat/skins/signal.lino +25 -0
- package/src/chat/skins/t3.lino +25 -0
- package/src/chat/skins/telegram.lino +31 -0
- package/src/chat/skins/whatsapp.lino +25 -0
- package/src/chat/stream-keys.js +57 -0
- package/src/chat/stream-window.js +159 -0
- package/src/chat/vocabulary.js +19 -0
- package/src/controls/accordion.js +160 -0
- package/src/controls/avatar.js +80 -0
- package/src/controls/badge.js +48 -0
- package/src/controls/button-template.js +32 -0
- package/src/controls/button.js +97 -0
- package/src/controls/catalog.lino +84 -0
- package/src/controls/checkbox.js +112 -0
- package/src/controls/chip.js +140 -0
- package/src/controls/choices.js +45 -0
- package/src/controls/color-field.js +217 -0
- package/src/controls/color-popover.js +135 -0
- package/src/controls/color-rgb.js +80 -0
- package/src/controls/color.js +67 -0
- package/src/controls/combobox.js +192 -0
- package/src/controls/dom.js +261 -0
- package/src/controls/icon-button.js +33 -0
- package/src/controls/index.d.ts +163 -0
- package/src/controls/index.js +182 -0
- package/src/controls/kinds-text.js +358 -0
- package/src/controls/kinds.lino +350 -0
- package/src/controls/label.js +52 -0
- package/src/controls/link.js +101 -0
- package/src/controls/listbox.js +144 -0
- package/src/controls/machines/button.lino +20 -0
- package/src/controls/machines/checkbox.lino +17 -0
- package/src/controls/machines/chip.lino +20 -0
- package/src/controls/machines/color-field.lino +23 -0
- package/src/controls/machines/combobox.lino +82 -0
- package/src/controls/machines/icon-button.lino +20 -0
- package/src/controls/machines/index.js +586 -0
- package/src/controls/machines/number-field.lino +71 -0
- package/src/controls/machines/radio-group.lino +17 -0
- package/src/controls/machines/select.lino +122 -0
- package/src/controls/machines/slider.lino +99 -0
- package/src/controls/machines/switch.lino +19 -0
- package/src/controls/machines/text-area.lino +26 -0
- package/src/controls/machines/text-field.lino +26 -0
- package/src/controls/number-field.js +239 -0
- package/src/controls/numeric-keys.js +125 -0
- package/src/controls/option.js +54 -0
- package/src/controls/progress.js +76 -0
- package/src/controls/radio-group.js +234 -0
- package/src/controls/select.js +229 -0
- package/src/controls/slider.js +234 -0
- package/src/controls/stories.js +172 -0
- package/src/controls/styles.css +1060 -0
- package/src/controls/switch.js +95 -0
- package/src/controls/text-area.js +39 -0
- package/src/controls/text-field.js +131 -0
- package/src/controls/vocabulary.js +164 -0
- package/src/data/data.css +95 -0
- package/src/data/index.d.ts +83 -0
- package/src/data/index.js +10 -0
- package/src/data/keyboard.js +189 -0
- package/src/data/list.js +215 -0
- package/src/data/render-data.js +116 -0
- package/src/data/selection-dom.js +39 -0
- package/src/data/selection-model.js +43 -0
- package/src/data/sort-model.js +42 -0
- package/src/data/source.js +45 -0
- package/src/data/table.js +160 -0
- package/src/data/tree-model.js +41 -0
- package/src/data/tree.js +55 -0
- package/src/data/viewport.js +216 -0
- package/src/data/virtual-range.js +92 -0
- package/src/data/vocabulary.js +67 -0
- package/src/diagrams/diagram-model.js +511 -0
- package/src/diagrams/diagram.js +204 -0
- package/src/diagrams/index.d.ts +225 -0
- package/src/diagrams/index.js +48 -0
- package/src/diagrams/layout-dagre.js +164 -0
- package/src/diagrams/layout-plugins.js +131 -0
- package/src/diagrams/mermaid-export.js +232 -0
- package/src/diagrams/mermaid-view.js +229 -0
- package/src/diagrams/svg-diagram.js +215 -0
- package/src/editor/code-editor.js +206 -0
- package/src/editor/documents-model.js +170 -0
- package/src/editor/documents-persistence.js +85 -0
- package/src/editor/editor-engine.js +22 -0
- package/src/editor/editor-ui.js +203 -0
- package/src/editor/editor.css +106 -0
- package/src/editor/engines/codemirror.js +227 -0
- package/src/editor/engines/monaco.js +219 -0
- package/src/editor/index.d.ts +111 -0
- package/src/editor/index.js +14 -0
- package/src/editor/lino-highlight.js +106 -0
- package/src/editor/lino-structure.js +85 -0
- package/src/editor/validate-lino.js +43 -0
- package/src/embed/README.md +161 -0
- package/src/embed/controller.js +223 -0
- package/src/embed/element.js +141 -0
- package/src/embed/index.d.ts +75 -0
- package/src/embed/index.js +9 -0
- package/src/embed/providers/telegram.d.ts +3 -0
- package/src/embed/providers/telegram.js +38 -0
- package/src/embed/providers/vk.d.ts +3 -0
- package/src/embed/providers/vk.js +42 -0
- package/src/embed/providers/x.d.ts +3 -0
- package/src/embed/providers/x.js +31 -0
- package/src/embed/registry.js +35 -0
- package/src/embed/script.js +73 -0
- package/src/embed/view.js +122 -0
- package/src/icons/adapters/lucide.d.ts +15 -0
- package/src/icons/adapters/lucide.js +142 -0
- package/src/icons/adapters/material-symbols.d.ts +13 -0
- package/src/icons/adapters/material-symbols.js +113 -0
- package/src/icons/adapters/shared.d.ts +38 -0
- package/src/icons/adapters/shared.js +157 -0
- package/src/icons/adapters/simple-icons.d.ts +9 -0
- package/src/icons/adapters/simple-icons.js +38 -0
- package/src/icons/adapters/tabler.d.ts +9 -0
- package/src/icons/adapters/tabler.js +86 -0
- package/src/icons/icon-registry.js +215 -0
- package/src/icons/icon.js +356 -0
- package/src/icons/index.d.ts +123 -0
- package/src/icons/index.js +30 -0
- package/src/icons/names.js +51 -0
- package/src/icons/own-icons.js +521 -0
- package/src/icons/presentation.js +55 -0
- package/src/icons/svg.js +136 -0
- package/src/index.d.ts +14 -0
- package/src/index.js +40 -0
- package/src/layout/README.md +102 -0
- package/src/layout/app-shell.js +150 -0
- package/src/layout/catalog.lino +27 -0
- package/src/layout/dock-model.js +576 -0
- package/src/layout/dock-view.js +312 -0
- package/src/layout/dock.js +352 -0
- package/src/layout/dom.js +312 -0
- package/src/layout/grid.js +192 -0
- package/src/layout/index.d.ts +267 -0
- package/src/layout/index.js +60 -0
- package/src/layout/layer-manager.js +120 -0
- package/src/layout/layout.css +760 -0
- package/src/layout/menu.js +141 -0
- package/src/layout/nav-strip.js +174 -0
- package/src/layout/page-links.js +166 -0
- package/src/layout/panel.js +26 -0
- package/src/layout/pref-switches.js +209 -0
- package/src/layout/split-model.js +270 -0
- package/src/layout/split.js +430 -0
- package/src/layout/stack.js +86 -0
- package/src/layout/surfaces.js +119 -0
- package/src/layout/tab-group.js +151 -0
- package/src/layout/tab-strip.js +277 -0
- package/src/layout/vocabulary.js +229 -0
- package/src/layout/window-frame.js +222 -0
- package/src/layout/window.js +146 -0
- package/src/links-view/animator.js +144 -0
- package/src/links-view/configuration-classes.js +150 -0
- package/src/links-view/configuration-model.js +191 -0
- package/src/links-view/configuration-notations.js +230 -0
- package/src/links-view/configurations.d.ts +73 -0
- package/src/links-view/configurations.js +33 -0
- package/src/links-view/create-layout-runner.js +79 -0
- package/src/links-view/doublet-curves.js +239 -0
- package/src/links-view/doublet-layout.js +148 -0
- package/src/links-view/doublet-markers.js +109 -0
- package/src/links-view/doublet-options.js +369 -0
- package/src/links-view/doublet-svg.js +156 -0
- package/src/links-view/doublet.js +230 -0
- package/src/links-view/export.js +146 -0
- package/src/links-view/geometry.js +409 -0
- package/src/links-view/index.d.ts +1029 -0
- package/src/links-view/index.js +140 -0
- package/src/links-view/labels.js +28 -0
- package/src/links-view/layout-worker-entry.mjs +2 -0
- package/src/links-view/layout-worker.js +28 -0
- package/src/links-view/layouts/circle.js +7 -0
- package/src/links-view/layouts/force.js +76 -0
- package/src/links-view/layouts/grid.js +7 -0
- package/src/links-view/layouts/hex.js +8 -0
- package/src/links-view/layouts/index.js +15 -0
- package/src/links-view/layouts/layered.js +29 -0
- package/src/links-view/layouts/regular.js +27 -0
- package/src/links-view/layouts/spiral.js +10 -0
- package/src/links-view/link-view.js +494 -0
- package/src/links-view/links-gallery.js +306 -0
- package/src/links-view/links-network.js +496 -0
- package/src/links-view/lino-network-source.js +122 -0
- package/src/links-view/lino-network.js +233 -0
- package/src/links-view/lino-to-network.js +252 -0
- package/src/links-view/markers.js +192 -0
- package/src/links-view/model.js +233 -0
- package/src/links-view/network-editor/dom.js +36 -0
- package/src/links-view/network-editor/editor.js +202 -0
- package/src/links-view/network-editor/model.js +163 -0
- package/src/links-view/network-editor/options.js +265 -0
- package/src/links-view/network-editor/panels.js +423 -0
- package/src/links-view/network-editor/presets.js +76 -0
- package/src/links-view/network-editor/provider.js +93 -0
- package/src/links-view/network-editor/remap.js +45 -0
- package/src/links-view/network-editor/schema.js +224 -0
- package/src/links-view/network-editor/share.js +232 -0
- package/src/links-view/network-editor/styles.js +19 -0
- package/src/links-view/network-editor/url-sync.js +131 -0
- package/src/links-view/network-interaction.js +228 -0
- package/src/links-view/network-model.js +85 -0
- package/src/links-view/network-renderer.js +259 -0
- package/src/links-view/network-scene.js +245 -0
- package/src/links-view/network-source.js +82 -0
- package/src/links-view/network-vocabulary.js +18 -0
- package/src/links-view/presentation.js +199 -0
- package/src/links-view/render-canvas.js +102 -0
- package/src/links-view/render-svg.js +118 -0
- package/src/links-view/scene.js +233 -0
- package/src/links-view/solver-job.js +106 -0
- package/src/links-view/tokens.js +114 -0
- package/src/links-view/zoom-pan.js +203 -0
- package/src/overlays/catalog.lino +89 -0
- package/src/overlays/context-menu.js +110 -0
- package/src/overlays/dialog.js +117 -0
- package/src/overlays/dom.js +168 -0
- package/src/overlays/drawer.js +8 -0
- package/src/overlays/index.d.ts +80 -0
- package/src/overlays/index.js +25 -0
- package/src/overlays/kinds.lino +137 -0
- package/src/overlays/list-popover.js +129 -0
- package/src/overlays/machines/index.js +71 -0
- package/src/overlays/machines/surface.lino +11 -0
- package/src/overlays/machines/tabs.lino +7 -0
- package/src/overlays/machines/toast.lino +16 -0
- package/src/overlays/machines/tooltip.lino +29 -0
- package/src/overlays/menu.js +240 -0
- package/src/overlays/popover.js +194 -0
- package/src/overlays/position.js +84 -0
- package/src/overlays/radial-geometry.js +38 -0
- package/src/overlays/radial-menu.js +50 -0
- package/src/overlays/styles.css +155 -0
- package/src/overlays/tabs.js +125 -0
- package/src/overlays/toast-queue.js +105 -0
- package/src/overlays/toast.js +163 -0
- package/src/overlays/tooltip.js +110 -0
- package/src/overlays/vocabulary.js +3 -0
- package/src/settings/conditions.js +44 -0
- package/src/settings/control-for.js +62 -0
- package/src/settings/field-control.js +201 -0
- package/src/settings/index.d.ts +201 -0
- package/src/settings/index.js +3 -0
- package/src/settings/messages.js +112 -0
- package/src/settings/miniature.js +26 -0
- package/src/settings/panel-actions.js +234 -0
- package/src/settings/panel-model.js +49 -0
- package/src/settings/panel-refresh.js +56 -0
- package/src/settings/panel-rows.js +200 -0
- package/src/settings/preset-cards.js +43 -0
- package/src/settings/saved-looks.js +227 -0
- package/src/settings/section-layout.js +95 -0
- package/src/settings/section-tabs.js +175 -0
- package/src/settings/settings-panel.js +192 -0
- package/src/settings/settings.css +178 -0
- package/stories/accordion.lino +14 -0
- package/stories/alert-dialog.lino +4 -0
- package/stories/app-bar.lino +10 -0
- package/stories/avatar.lino +7 -0
- package/stories/badge.lino +12 -0
- package/stories/button.lino +17 -0
- package/stories/card.lino +10 -0
- package/stories/checkbox.lino +14 -0
- package/stories/chip.lino +19 -0
- package/stories/color-field.lino +9 -0
- package/stories/combobox.lino +10 -0
- package/stories/container.lino +11 -0
- package/stories/context-menu.lino +15 -0
- package/stories/dialog.lino +16 -0
- package/stories/drawer.lino +12 -0
- package/stories/icon-button.lino +13 -0
- package/stories/label.lino +7 -0
- package/stories/link-cards.lino +9 -0
- package/stories/link.lino +9 -0
- package/stories/menu-item.lino +6 -0
- package/stories/menu-separator.lino +7 -0
- package/stories/menu.lino +30 -0
- package/stories/nav-strip.lino +11 -0
- package/stories/number-field.lino +16 -0
- package/stories/option.lino +10 -0
- package/stories/paper.lino +11 -0
- package/stories/popover.lino +4 -0
- package/stories/pref-switches.lino +4 -0
- package/stories/progress.lino +14 -0
- package/stories/radial-menu.lino +19 -0
- package/stories/radio-group.lino +22 -0
- package/stories/radio.lino +10 -0
- package/stories/section-nav.lino +9 -0
- package/stories/select.lino +16 -0
- package/stories/slider.lino +14 -0
- package/stories/switch.lino +10 -0
- package/stories/tab-panel.lino +7 -0
- package/stories/tab.lino +7 -0
- package/stories/tabs.lino +25 -0
- package/stories/text-area.lino +12 -0
- package/stories/text-field.lino +23 -0
- package/stories/titled-section.lino +7 -0
- package/stories/toast.lino +3 -0
- package/stories/toaster.lino +2 -0
- package/stories/tooltip.lino +3 -0
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { make } from '../layout/dom.js';
|
|
2
|
+
import { nextSort } from './sort-model.js';
|
|
3
|
+
|
|
4
|
+
/** Column records are parsed LiNo links: (name: column (label Name) ...). */
|
|
5
|
+
export function columnsOf(el) {
|
|
6
|
+
return (el.props.get('columns') ?? [])
|
|
7
|
+
.filter((value) => value && typeof value === 'object')
|
|
8
|
+
.map((value) => {
|
|
9
|
+
const values = value.values ?? value;
|
|
10
|
+
const name = value.id ?? String(values[0]).replace(/:$/, '');
|
|
11
|
+
const props = new Map(
|
|
12
|
+
values.filter(Array.isArray).map(([key, ...value]) => [key, value])
|
|
13
|
+
);
|
|
14
|
+
return {
|
|
15
|
+
name,
|
|
16
|
+
label: props.get('label')?.[0] ?? name,
|
|
17
|
+
sortable: props.get('sortable')?.[0] === 'true',
|
|
18
|
+
align: props.get('align')?.[0] ?? 'start',
|
|
19
|
+
width: Number(props.get('width')?.[0]) || 160,
|
|
20
|
+
};
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** Grid header cells also serve as keyboard-sort and resize targets. */
|
|
25
|
+
export function createTableHeader(state) {
|
|
26
|
+
const { root, document } = state;
|
|
27
|
+
const header = make(document, 'div', {
|
|
28
|
+
class: 'ui-data-header',
|
|
29
|
+
role: 'row',
|
|
30
|
+
'aria-rowindex': 1,
|
|
31
|
+
});
|
|
32
|
+
root.append(header);
|
|
33
|
+
const releases = new Set();
|
|
34
|
+
function resize(cell, column, handle) {
|
|
35
|
+
const setWidth = (width) => {
|
|
36
|
+
state.widths.set(column.name, Math.max(48, width));
|
|
37
|
+
state.refresh();
|
|
38
|
+
};
|
|
39
|
+
handle.addEventListener('keydown', (event) => {
|
|
40
|
+
if (!['ArrowLeft', 'ArrowRight', 'Home', 'End'].includes(event.key)) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
event.preventDefault();
|
|
44
|
+
event.stopPropagation();
|
|
45
|
+
const width = state.widths.get(column.name) ?? column.width;
|
|
46
|
+
setWidth(
|
|
47
|
+
event.key === 'Home'
|
|
48
|
+
? 48
|
|
49
|
+
: event.key === 'End'
|
|
50
|
+
? 600
|
|
51
|
+
: width + (event.key === 'ArrowRight' ? 10 : -10)
|
|
52
|
+
);
|
|
53
|
+
});
|
|
54
|
+
handle.addEventListener('pointerdown', (event) => {
|
|
55
|
+
if (event.button !== 0) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
event.preventDefault();
|
|
59
|
+
event.stopPropagation();
|
|
60
|
+
handle.focus({ preventScroll: true });
|
|
61
|
+
const x = event.clientX;
|
|
62
|
+
const width = state.widths.get(column.name) ?? column.width;
|
|
63
|
+
const move = (e) => setWidth(width + e.clientX - x);
|
|
64
|
+
const release = () => {
|
|
65
|
+
document.removeEventListener('pointermove', move);
|
|
66
|
+
document.removeEventListener('pointerup', release);
|
|
67
|
+
document.removeEventListener('pointercancel', release);
|
|
68
|
+
releases.delete(release);
|
|
69
|
+
};
|
|
70
|
+
document.addEventListener('pointermove', move);
|
|
71
|
+
document.addEventListener('pointerup', release);
|
|
72
|
+
document.addEventListener('pointercancel', release);
|
|
73
|
+
releases.add(release);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
function render() {
|
|
77
|
+
state.columns.forEach((column, i) => {
|
|
78
|
+
let cell = header.children[i];
|
|
79
|
+
if (!cell || cell.dataset.column !== column.name) {
|
|
80
|
+
const old = cell;
|
|
81
|
+
cell = make(document, 'div', {
|
|
82
|
+
role: 'columnheader',
|
|
83
|
+
'data-column': column.name,
|
|
84
|
+
'aria-colindex': i + 1,
|
|
85
|
+
});
|
|
86
|
+
const button = make(document, 'button', {
|
|
87
|
+
type: 'button',
|
|
88
|
+
'data-sort': column.name,
|
|
89
|
+
});
|
|
90
|
+
button.addEventListener('click', () => {
|
|
91
|
+
if (!state.columns.find((c) => c.name === column.name)?.sortable) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
state.sort = nextSort(state.sort, column.name);
|
|
95
|
+
state.refresh();
|
|
96
|
+
state.send('sort', { column: column.name, ...state.sort });
|
|
97
|
+
});
|
|
98
|
+
button.tabIndex = -1;
|
|
99
|
+
cell.append(button);
|
|
100
|
+
const handle = make(document, 'span', {
|
|
101
|
+
role: 'separator',
|
|
102
|
+
tabindex: 0,
|
|
103
|
+
'aria-orientation': 'vertical',
|
|
104
|
+
'aria-label': `Resize ${column.label}`,
|
|
105
|
+
'aria-valuemin': 48,
|
|
106
|
+
class: 'ui-data-resize',
|
|
107
|
+
});
|
|
108
|
+
resize(cell, column, handle);
|
|
109
|
+
cell.append(handle);
|
|
110
|
+
if (old) {
|
|
111
|
+
old.replaceWith(cell);
|
|
112
|
+
} else {
|
|
113
|
+
header.append(cell);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
const direction =
|
|
117
|
+
state.sort?.column === column.name ? state.sort.direction : 'none';
|
|
118
|
+
if (column.sortable) {
|
|
119
|
+
cell.setAttribute('aria-sort', direction);
|
|
120
|
+
} else {
|
|
121
|
+
cell.removeAttribute('aria-sort');
|
|
122
|
+
}
|
|
123
|
+
cell.firstChild.setAttribute('aria-disabled', String(!column.sortable));
|
|
124
|
+
cell.firstChild.tabIndex = state.inHeader && i === state.cell ? 0 : -1;
|
|
125
|
+
cell.firstChild.textContent = `${column.label}${direction === 'ascending' ? ' ↑' : direction === 'descending' ? ' ↓' : ''}`;
|
|
126
|
+
cell.lastChild.setAttribute(
|
|
127
|
+
'aria-valuenow',
|
|
128
|
+
state.widths.get(column.name) ?? column.width
|
|
129
|
+
);
|
|
130
|
+
});
|
|
131
|
+
while (header.children.length > state.columns.length) {
|
|
132
|
+
header.lastChild.remove();
|
|
133
|
+
}
|
|
134
|
+
root.setAttribute('aria-colcount', state.columns.length);
|
|
135
|
+
}
|
|
136
|
+
return { header, render, disconnect: () => releases.forEach((fn) => fn()) };
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export function drawCells(state, row, item, index) {
|
|
140
|
+
row.style.gridTemplateColumns = state.trackSizes();
|
|
141
|
+
state.columns.forEach((column, i) => {
|
|
142
|
+
let cell = row.children[i];
|
|
143
|
+
if (!cell) {
|
|
144
|
+
cell = make(state.document, 'div', { role: 'gridcell' });
|
|
145
|
+
row.append(cell);
|
|
146
|
+
}
|
|
147
|
+
cell.setAttribute('aria-colindex', i + 1);
|
|
148
|
+
cell.tabIndex =
|
|
149
|
+
!state.inHeader && String(item.id) === state.active && i === state.cell
|
|
150
|
+
? 0
|
|
151
|
+
: -1;
|
|
152
|
+
cell.dataset.cell = i;
|
|
153
|
+
cell.style.textAlign = column.align;
|
|
154
|
+
cell.textContent = String(item[column.name] ?? '');
|
|
155
|
+
});
|
|
156
|
+
while (row.children.length > state.columns.length) {
|
|
157
|
+
row.lastChild.remove();
|
|
158
|
+
}
|
|
159
|
+
row.setAttribute('aria-rowindex', index + 2);
|
|
160
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { itemKey } from './source.js';
|
|
2
|
+
|
|
3
|
+
/** Iterative preorder projection: large/deep trees need no recursive DOM. */
|
|
4
|
+
export function flattenTree(items, expanded, loaded = new Map()) {
|
|
5
|
+
const visible = [];
|
|
6
|
+
const stack = items
|
|
7
|
+
.map((item, i) => ({
|
|
8
|
+
item,
|
|
9
|
+
level: 1,
|
|
10
|
+
parent: null,
|
|
11
|
+
position: i + 1,
|
|
12
|
+
size: items.length,
|
|
13
|
+
}))
|
|
14
|
+
.reverse();
|
|
15
|
+
while (stack.length) {
|
|
16
|
+
const entry = stack.pop();
|
|
17
|
+
const { item, level } = entry;
|
|
18
|
+
const key = itemKey(item);
|
|
19
|
+
const children = loaded.get(key) ?? item.children ?? [];
|
|
20
|
+
visible.push({
|
|
21
|
+
...item,
|
|
22
|
+
_tree: {
|
|
23
|
+
...entry,
|
|
24
|
+
item: undefined,
|
|
25
|
+
branch: item.hasChildren === true || children.length > 0,
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
if (expanded.has(key)) {
|
|
29
|
+
for (let i = children.length - 1; i >= 0; i--) {
|
|
30
|
+
stack.push({
|
|
31
|
+
item: children[i],
|
|
32
|
+
level: level + 1,
|
|
33
|
+
parent: key,
|
|
34
|
+
position: i + 1,
|
|
35
|
+
size: children.length,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return visible;
|
|
41
|
+
}
|
package/src/data/tree.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { itemKey } from './source.js';
|
|
2
|
+
|
|
3
|
+
export async function expandTree(
|
|
4
|
+
state,
|
|
5
|
+
item,
|
|
6
|
+
open = !state.expanded.has(itemKey(item))
|
|
7
|
+
) {
|
|
8
|
+
const key = itemKey(item);
|
|
9
|
+
if (!item._tree?.branch) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
if (!open) {
|
|
13
|
+
state.expanded.delete(key);
|
|
14
|
+
state.refresh();
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
state.expanded.add(key);
|
|
18
|
+
if (
|
|
19
|
+
item.hasChildren &&
|
|
20
|
+
!item.children &&
|
|
21
|
+
!state.loaded.has(key) &&
|
|
22
|
+
!state.pending.has(key)
|
|
23
|
+
) {
|
|
24
|
+
await loadChildren(state, item, key);
|
|
25
|
+
} else {
|
|
26
|
+
state.refresh();
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async function loadChildren(state, item, key) {
|
|
31
|
+
const abort = new AbortController();
|
|
32
|
+
state.pending.set(key, abort);
|
|
33
|
+
state.failures.delete(key);
|
|
34
|
+
state.refresh();
|
|
35
|
+
try {
|
|
36
|
+
if (!state.options.loadChildren) {
|
|
37
|
+
throw new Error('No loadChildren adapter');
|
|
38
|
+
}
|
|
39
|
+
const children = await state.options.loadChildren(item, {
|
|
40
|
+
signal: abort.signal,
|
|
41
|
+
});
|
|
42
|
+
if (!state.disposed && !abort.signal.aborted) {
|
|
43
|
+
state.loaded.set(key, children);
|
|
44
|
+
}
|
|
45
|
+
} catch (error) {
|
|
46
|
+
if (!state.disposed && !abort.signal.aborted) {
|
|
47
|
+
state.failures.set(key, String(error.message ?? error));
|
|
48
|
+
}
|
|
49
|
+
} finally {
|
|
50
|
+
state.pending.delete(key);
|
|
51
|
+
if (!state.disposed) {
|
|
52
|
+
state.refresh();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import {
|
|
2
|
+
anchorScrollTop,
|
|
3
|
+
indexAt,
|
|
4
|
+
listOffsets,
|
|
5
|
+
listRange,
|
|
6
|
+
} from './virtual-range.js';
|
|
7
|
+
import { itemKey } from './source.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* One observer for the viewport and all mounted rows. Observer writes are
|
|
11
|
+
* deferred to a frame, avoiding WebKit's ResizeObserver feedback loop.
|
|
12
|
+
* Rows are keyed and reconciled in place, including the focused row outside
|
|
13
|
+
* the overscan range. Measurements survive reorder/prepend by item key.
|
|
14
|
+
*/
|
|
15
|
+
export function createViewport(
|
|
16
|
+
root,
|
|
17
|
+
body,
|
|
18
|
+
{ estimate = 32, virtualized = true, draw, changed }
|
|
19
|
+
) {
|
|
20
|
+
const win = root.ownerDocument.defaultView;
|
|
21
|
+
const heights = new Map();
|
|
22
|
+
const mounted = new Map();
|
|
23
|
+
let items = [];
|
|
24
|
+
let offsets = new Float64Array([0]);
|
|
25
|
+
let active = null;
|
|
26
|
+
let frame = null;
|
|
27
|
+
let disposed = false;
|
|
28
|
+
const pending = new Map();
|
|
29
|
+
const keys = () => items.map(itemKey);
|
|
30
|
+
const snapshot = () => ({ keys: keys(), offsets, scrollTop: root.scrollTop });
|
|
31
|
+
const rebuild = () => {
|
|
32
|
+
const measured = new Map();
|
|
33
|
+
items.forEach((item, i) => {
|
|
34
|
+
if (heights.has(itemKey(item))) {
|
|
35
|
+
measured.set(i, heights.get(itemKey(item)));
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
offsets = listOffsets({ count: items.length, estimate, measured });
|
|
39
|
+
body.style.height = `${offsets.at(-1)}px`;
|
|
40
|
+
};
|
|
41
|
+
const anchorKey = () =>
|
|
42
|
+
itemKey(items[indexAt(offsets, root.scrollTop)] ?? { id: '' });
|
|
43
|
+
const schedule = () => {
|
|
44
|
+
if (frame !== null || disposed) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
frame = win.requestAnimationFrame(() => {
|
|
48
|
+
frame = null;
|
|
49
|
+
if (disposed) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const before = snapshot();
|
|
53
|
+
const anchor = anchorKey();
|
|
54
|
+
const resized = applyMeasurements(pending, heights, mounted);
|
|
55
|
+
if (resized) {
|
|
56
|
+
rebuild();
|
|
57
|
+
root.scrollTop = anchorScrollTop(before, snapshot(), anchor);
|
|
58
|
+
}
|
|
59
|
+
render();
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
const observer =
|
|
63
|
+
typeof win.ResizeObserver === 'function'
|
|
64
|
+
? new win.ResizeObserver((entries) => {
|
|
65
|
+
queueMeasurements(entries, root, pending);
|
|
66
|
+
schedule();
|
|
67
|
+
})
|
|
68
|
+
: null;
|
|
69
|
+
observer?.observe(root);
|
|
70
|
+
|
|
71
|
+
function render() {
|
|
72
|
+
if (disposed) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const focused = root.ownerDocument.activeElement;
|
|
76
|
+
const restoreFocus = body.contains(focused);
|
|
77
|
+
const wanted = wantedIndices(root, items, offsets, virtualized, active);
|
|
78
|
+
pruneRows(items, wanted, mounted, observer);
|
|
79
|
+
let previous = null;
|
|
80
|
+
for (const i of [...wanted].sort((a, b) => a - b)) {
|
|
81
|
+
const item = items[i];
|
|
82
|
+
const key = itemKey(item);
|
|
83
|
+
let row = mounted.get(key);
|
|
84
|
+
if (!row) {
|
|
85
|
+
row = root.ownerDocument.createElement('div');
|
|
86
|
+
row.className = 'ui-data-row';
|
|
87
|
+
row.dataset.key = key;
|
|
88
|
+
mounted.set(key, row);
|
|
89
|
+
observer?.observe(row);
|
|
90
|
+
}
|
|
91
|
+
draw(row, item, i);
|
|
92
|
+
row.style.position = 'absolute';
|
|
93
|
+
row.style.top = `${offsets[i]}px`;
|
|
94
|
+
row.style.minHeight = `${estimate}px`;
|
|
95
|
+
if (row.previousElementSibling !== previous || row.parentNode !== body) {
|
|
96
|
+
body.insertBefore(
|
|
97
|
+
row,
|
|
98
|
+
previous ? previous.nextSibling : body.firstChild
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
previous = row;
|
|
102
|
+
}
|
|
103
|
+
// Moving an existing DOM node blurs it in browsers without moveBefore.
|
|
104
|
+
if (
|
|
105
|
+
restoreFocus &&
|
|
106
|
+
focused.isConnected &&
|
|
107
|
+
root.ownerDocument.activeElement !== focused
|
|
108
|
+
) {
|
|
109
|
+
focused.focus({ preventScroll: true });
|
|
110
|
+
}
|
|
111
|
+
changed?.();
|
|
112
|
+
}
|
|
113
|
+
root.addEventListener('scroll', schedule, { passive: true });
|
|
114
|
+
return {
|
|
115
|
+
render,
|
|
116
|
+
setActive(key) {
|
|
117
|
+
active = key;
|
|
118
|
+
},
|
|
119
|
+
setItems(next) {
|
|
120
|
+
const before = snapshot();
|
|
121
|
+
const anchor = anchorKey();
|
|
122
|
+
items = next;
|
|
123
|
+
const present = new Set(keys());
|
|
124
|
+
for (const key of heights.keys()) {
|
|
125
|
+
if (!present.has(key)) {
|
|
126
|
+
heights.delete(key);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
rebuild();
|
|
130
|
+
root.scrollTop = anchorScrollTop(before, snapshot(), anchor);
|
|
131
|
+
render();
|
|
132
|
+
},
|
|
133
|
+
scrollTo(index) {
|
|
134
|
+
if (index < 0 || index >= items.length) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
const top = offsets[index];
|
|
138
|
+
const bottom = offsets[index + 1];
|
|
139
|
+
const height = (root.clientHeight || 320) - body.offsetTop;
|
|
140
|
+
if (top < root.scrollTop) {
|
|
141
|
+
root.scrollTop = top;
|
|
142
|
+
} else if (bottom > root.scrollTop + height) {
|
|
143
|
+
root.scrollTop = bottom - height;
|
|
144
|
+
}
|
|
145
|
+
render();
|
|
146
|
+
},
|
|
147
|
+
row: (key) => mounted.get(key),
|
|
148
|
+
disconnect() {
|
|
149
|
+
disposed = true;
|
|
150
|
+
observer?.disconnect();
|
|
151
|
+
root.removeEventListener('scroll', schedule);
|
|
152
|
+
if (frame !== null) {
|
|
153
|
+
win.cancelAnimationFrame(frame);
|
|
154
|
+
}
|
|
155
|
+
mounted.clear();
|
|
156
|
+
pending.clear();
|
|
157
|
+
heights.clear();
|
|
158
|
+
},
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function wantedIndices(root, items, offsets, virtualized, active) {
|
|
163
|
+
const { start, end } = virtualized
|
|
164
|
+
? listRange(offsets, root.scrollTop, root.clientHeight || 320)
|
|
165
|
+
: { start: 0, end: items.length };
|
|
166
|
+
const wanted = new Set();
|
|
167
|
+
for (let i = start; i < end; i++) {
|
|
168
|
+
wanted.add(i);
|
|
169
|
+
}
|
|
170
|
+
const focused = root.ownerDocument.activeElement?.closest?.('[data-key]');
|
|
171
|
+
for (const key of [active, focused?.dataset.key]) {
|
|
172
|
+
const index = items.findIndex((item) => itemKey(item) === key);
|
|
173
|
+
if (index >= 0) {
|
|
174
|
+
wanted.add(index);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
return wanted;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function pruneRows(items, wanted, mounted, observer) {
|
|
182
|
+
const kept = new Set([...wanted].map((i) => itemKey(items[i])));
|
|
183
|
+
for (const [key, row] of mounted) {
|
|
184
|
+
if (!kept.has(key)) {
|
|
185
|
+
observer?.unobserve(row);
|
|
186
|
+
row.remove();
|
|
187
|
+
mounted.delete(key);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function queueMeasurements(entries, root, pending) {
|
|
193
|
+
for (const entry of entries) {
|
|
194
|
+
if (entry.target !== root) {
|
|
195
|
+
pending.set(
|
|
196
|
+
entry.target,
|
|
197
|
+
entry.borderBoxSize?.[0]?.blockSize ??
|
|
198
|
+
entry.target.getBoundingClientRect().height
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
function applyMeasurements(pending, heights, mounted) {
|
|
205
|
+
let resized = false;
|
|
206
|
+
for (const [row, height] of pending) {
|
|
207
|
+
const key = row.dataset.key;
|
|
208
|
+
if (height > 0 && heights.get(key) !== height && mounted.get(key) === row) {
|
|
209
|
+
heights.set(key, height);
|
|
210
|
+
resized = true;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
pending.clear();
|
|
214
|
+
|
|
215
|
+
return resized;
|
|
216
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/** Pure measured virtualization, shared with timelines and other renderers. */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Cumulative row tops plus total height; invalid measurements use the estimate.
|
|
5
|
+
* @param {{count: number, estimate: number, measured?: Map<number, number>}} input
|
|
6
|
+
* @returns {Float64Array} offsets of length count + 1
|
|
7
|
+
*/
|
|
8
|
+
export function listOffsets({ count, estimate, measured = new Map() }) {
|
|
9
|
+
if (
|
|
10
|
+
!Number.isSafeInteger(count) ||
|
|
11
|
+
count < 0 ||
|
|
12
|
+
!Number.isFinite(estimate) ||
|
|
13
|
+
estimate <= 0
|
|
14
|
+
) {
|
|
15
|
+
throw new RangeError(
|
|
16
|
+
'count must be nonnegative and estimate must be positive'
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
const offsets = new Float64Array(count + 1);
|
|
20
|
+
for (let i = 0; i < count; i++) {
|
|
21
|
+
const height = measured.get(i);
|
|
22
|
+
offsets[i + 1] =
|
|
23
|
+
offsets[i] + (Number.isFinite(height) && height > 0 ? height : estimate);
|
|
24
|
+
}
|
|
25
|
+
return offsets;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Index containing y; -1 for an empty list. Clamps before/after the collection.
|
|
30
|
+
* @param {Float64Array} offsets
|
|
31
|
+
* @param {number} y
|
|
32
|
+
* @returns {number}
|
|
33
|
+
*/
|
|
34
|
+
export function indexAt(offsets, y) {
|
|
35
|
+
let low = 0;
|
|
36
|
+
let high = offsets.length - 1;
|
|
37
|
+
if (high === 0) {
|
|
38
|
+
return -1;
|
|
39
|
+
}
|
|
40
|
+
while (low < high) {
|
|
41
|
+
const mid = Math.floor((low + high + 1) / 2);
|
|
42
|
+
if (offsets[mid] <= y) {
|
|
43
|
+
low = mid;
|
|
44
|
+
} else {
|
|
45
|
+
high = mid - 1;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return Math.min(low, offsets.length - 2);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Half-open rendered range, with overscan measured in viewport heights.
|
|
53
|
+
* @param {Float64Array} offsets
|
|
54
|
+
* @param {number} scrollTop
|
|
55
|
+
* @param {number} viewportHeight
|
|
56
|
+
* @param {number} [overscan]
|
|
57
|
+
* @returns {{start: number, end: number}}
|
|
58
|
+
*/
|
|
59
|
+
export function listRange(offsets, scrollTop, viewportHeight, overscan = 1) {
|
|
60
|
+
const count = offsets.length - 1;
|
|
61
|
+
if (!count) {
|
|
62
|
+
return { start: 0, end: 0 };
|
|
63
|
+
}
|
|
64
|
+
const height = Math.max(0, viewportHeight);
|
|
65
|
+
const pad = height * Math.max(0, overscan);
|
|
66
|
+
const bottom = Math.min(offsets[count], scrollTop + height + pad);
|
|
67
|
+
let end = indexAt(offsets, bottom);
|
|
68
|
+
if (offsets[end] < bottom) {
|
|
69
|
+
end++;
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
start: Math.max(0, indexAt(offsets, Math.max(0, scrollTop - pad))),
|
|
73
|
+
end: Math.min(count, end),
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Keep a keyed row at its previous screen position, including intra-row offset.
|
|
79
|
+
* before: {keys, offsets, scrollTop}; after: {keys, offsets}.
|
|
80
|
+
* A missing anchor leaves the previous scroll position alone.
|
|
81
|
+
* @param {{keys: string[], offsets: Float64Array, scrollTop: number}} before
|
|
82
|
+
* @param {{keys: string[], offsets: Float64Array}} after
|
|
83
|
+
* @param {string} anchorKey
|
|
84
|
+
* @returns {number}
|
|
85
|
+
*/
|
|
86
|
+
export function anchorScrollTop(before, after, anchorKey) {
|
|
87
|
+
const from = before.keys.indexOf(anchorKey);
|
|
88
|
+
const to = after.keys.indexOf(anchorKey);
|
|
89
|
+
return from < 0 || to < 0
|
|
90
|
+
? before.scrollTop
|
|
91
|
+
: Math.max(0, before.scrollTop + after.offsets[to] - before.offsets[from]);
|
|
92
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { defaultVocabulary, loadVocabulary } from '@link-foundation/ui-core';
|
|
2
|
+
|
|
3
|
+
/** Additional data kinds; all values are parsed by the official LiNo reader. */
|
|
4
|
+
export const DATA_VOCABULARY_TEXT = `list: kind
|
|
5
|
+
property on action multi
|
|
6
|
+
property label string
|
|
7
|
+
property items any
|
|
8
|
+
property template string
|
|
9
|
+
property selection
|
|
10
|
+
enum single multi none
|
|
11
|
+
property virtualized boolean
|
|
12
|
+
property item-height number
|
|
13
|
+
property loading boolean
|
|
14
|
+
property error string
|
|
15
|
+
property empty string
|
|
16
|
+
children none
|
|
17
|
+
|
|
18
|
+
tree: kind
|
|
19
|
+
property on action multi
|
|
20
|
+
property label string
|
|
21
|
+
property items any
|
|
22
|
+
property template string
|
|
23
|
+
property selection
|
|
24
|
+
enum single multi none
|
|
25
|
+
property virtualized boolean
|
|
26
|
+
property item-height number
|
|
27
|
+
property loading boolean
|
|
28
|
+
property error string
|
|
29
|
+
property empty string
|
|
30
|
+
children none
|
|
31
|
+
|
|
32
|
+
table: kind
|
|
33
|
+
property on action multi
|
|
34
|
+
property label string
|
|
35
|
+
property caption string
|
|
36
|
+
property items any
|
|
37
|
+
property columns any
|
|
38
|
+
property selection
|
|
39
|
+
enum single multi none
|
|
40
|
+
property virtualized boolean
|
|
41
|
+
property item-height number
|
|
42
|
+
property loading boolean
|
|
43
|
+
property error string
|
|
44
|
+
property empty string
|
|
45
|
+
children none
|
|
46
|
+
`;
|
|
47
|
+
|
|
48
|
+
let cached;
|
|
49
|
+
export function dataVocabulary() {
|
|
50
|
+
if (!cached) {
|
|
51
|
+
const base = defaultVocabulary();
|
|
52
|
+
const data = loadVocabulary(DATA_VOCABULARY_TEXT).kinds;
|
|
53
|
+
for (const kind of data.values()) {
|
|
54
|
+
for (const name of ['note', 'machine']) {
|
|
55
|
+
kind.properties.set(
|
|
56
|
+
name,
|
|
57
|
+
base.kinds.get('document').properties.get(name)
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
cached = {
|
|
62
|
+
...base,
|
|
63
|
+
kinds: new Map([...base.kinds, ...data]),
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
return cached;
|
|
67
|
+
}
|