@link-foundation/ui-components 0.0.0-stage → 0.0.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,46 @@
|
|
|
1
|
+
disclosure-machine: machine
|
|
2
|
+
initial closed
|
|
3
|
+
context
|
|
4
|
+
disabled false
|
|
5
|
+
action focus-content
|
|
6
|
+
focus content
|
|
7
|
+
action restore-focus
|
|
8
|
+
focus trigger
|
|
9
|
+
state closed
|
|
10
|
+
on toggle
|
|
11
|
+
target open
|
|
12
|
+
when not-disabled
|
|
13
|
+
on open
|
|
14
|
+
target open
|
|
15
|
+
when not-disabled
|
|
16
|
+
state open
|
|
17
|
+
entry focus-content
|
|
18
|
+
exit restore-focus
|
|
19
|
+
on toggle
|
|
20
|
+
target closing
|
|
21
|
+
on close
|
|
22
|
+
target closing
|
|
23
|
+
state closing
|
|
24
|
+
after 500ms
|
|
25
|
+
target closed
|
|
26
|
+
on toggle
|
|
27
|
+
target open
|
|
28
|
+
when not-disabled
|
|
29
|
+
on open
|
|
30
|
+
target open
|
|
31
|
+
when not-disabled
|
|
32
|
+
part trigger
|
|
33
|
+
attr aria-expanded
|
|
34
|
+
in open
|
|
35
|
+
attr data-state
|
|
36
|
+
state
|
|
37
|
+
key Enter toggle
|
|
38
|
+
key Space toggle
|
|
39
|
+
on press toggle
|
|
40
|
+
part content
|
|
41
|
+
attr hidden
|
|
42
|
+
present
|
|
43
|
+
in closed
|
|
44
|
+
attr data-state
|
|
45
|
+
state
|
|
46
|
+
key Escape close
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The reference machines as text, so they load without a file system or a
|
|
3
|
+
* bundler. They are byte-equal to the `.lino` files next to this module;
|
|
4
|
+
* tests/behavior/parse-machine.test.js checks that they stay in sync.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/** A two-state toggle button (`aria-pressed`). */
|
|
8
|
+
export const TOGGLE_MACHINE = `toggle-machine: machine
|
|
9
|
+
initial off
|
|
10
|
+
context
|
|
11
|
+
pressed false
|
|
12
|
+
disabled false
|
|
13
|
+
action set-pressed
|
|
14
|
+
set pressed true
|
|
15
|
+
action clear-pressed
|
|
16
|
+
set pressed false
|
|
17
|
+
state off
|
|
18
|
+
on toggle
|
|
19
|
+
target on
|
|
20
|
+
do set-pressed
|
|
21
|
+
when not-disabled
|
|
22
|
+
state on
|
|
23
|
+
on toggle
|
|
24
|
+
target off
|
|
25
|
+
do clear-pressed
|
|
26
|
+
when not-disabled
|
|
27
|
+
part root
|
|
28
|
+
attr aria-pressed
|
|
29
|
+
context pressed
|
|
30
|
+
key Enter toggle
|
|
31
|
+
key Space toggle
|
|
32
|
+
on press toggle
|
|
33
|
+
`;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* A disclosure (`aria-expanded`): opening focuses the content, closing
|
|
37
|
+
* restores focus to the trigger and hides the content after 500 ms.
|
|
38
|
+
*/
|
|
39
|
+
export const DISCLOSURE_MACHINE = `disclosure-machine: machine
|
|
40
|
+
initial closed
|
|
41
|
+
context
|
|
42
|
+
disabled false
|
|
43
|
+
action focus-content
|
|
44
|
+
focus content
|
|
45
|
+
action restore-focus
|
|
46
|
+
focus trigger
|
|
47
|
+
state closed
|
|
48
|
+
on toggle
|
|
49
|
+
target open
|
|
50
|
+
when not-disabled
|
|
51
|
+
on open
|
|
52
|
+
target open
|
|
53
|
+
when not-disabled
|
|
54
|
+
state open
|
|
55
|
+
entry focus-content
|
|
56
|
+
exit restore-focus
|
|
57
|
+
on toggle
|
|
58
|
+
target closing
|
|
59
|
+
on close
|
|
60
|
+
target closing
|
|
61
|
+
state closing
|
|
62
|
+
after 500ms
|
|
63
|
+
target closed
|
|
64
|
+
on toggle
|
|
65
|
+
target open
|
|
66
|
+
when not-disabled
|
|
67
|
+
on open
|
|
68
|
+
target open
|
|
69
|
+
when not-disabled
|
|
70
|
+
part trigger
|
|
71
|
+
attr aria-expanded
|
|
72
|
+
in open
|
|
73
|
+
attr data-state
|
|
74
|
+
state
|
|
75
|
+
key Enter toggle
|
|
76
|
+
key Space toggle
|
|
77
|
+
on press toggle
|
|
78
|
+
part content
|
|
79
|
+
attr hidden
|
|
80
|
+
present
|
|
81
|
+
in closed
|
|
82
|
+
attr data-state
|
|
83
|
+
state
|
|
84
|
+
key Escape close
|
|
85
|
+
`;
|
|
86
|
+
|
|
87
|
+
/** The reference machines by their element ID. */
|
|
88
|
+
export const REFERENCE_MACHINES = Object.freeze({
|
|
89
|
+
'toggle-machine': TOGGLE_MACHINE,
|
|
90
|
+
'disclosure-machine': DISCLOSURE_MACHINE,
|
|
91
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
toggle-machine: machine
|
|
2
|
+
initial off
|
|
3
|
+
context
|
|
4
|
+
pressed false
|
|
5
|
+
disabled false
|
|
6
|
+
action set-pressed
|
|
7
|
+
set pressed true
|
|
8
|
+
action clear-pressed
|
|
9
|
+
set pressed false
|
|
10
|
+
state off
|
|
11
|
+
on toggle
|
|
12
|
+
target on
|
|
13
|
+
do set-pressed
|
|
14
|
+
when not-disabled
|
|
15
|
+
state on
|
|
16
|
+
on toggle
|
|
17
|
+
target off
|
|
18
|
+
do clear-pressed
|
|
19
|
+
when not-disabled
|
|
20
|
+
part root
|
|
21
|
+
attr aria-pressed
|
|
22
|
+
context pressed
|
|
23
|
+
key Enter toggle
|
|
24
|
+
key Space toggle
|
|
25
|
+
on press toggle
|
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read a behaviour state machine written in Links Notation into a plain,
|
|
3
|
+
* serialisable machine object. Text is read only by ui-core `parse` (the
|
|
4
|
+
* official `links-notation` parser); this module walks the links it
|
|
5
|
+
* returns and never evaluates any value.
|
|
6
|
+
*
|
|
7
|
+
* ```lino
|
|
8
|
+
* (toggle-machine: machine
|
|
9
|
+
* (initial off)
|
|
10
|
+
* (context (pressed false))
|
|
11
|
+
* (action set-pressed (set pressed true))
|
|
12
|
+
* (state off (on toggle (target on) (do set-pressed) (when not-disabled)))
|
|
13
|
+
* (state on (on toggle (target off) (do (set pressed false))))
|
|
14
|
+
* (part root (attr aria-pressed (context pressed)) (key Enter toggle)))
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* States are flat: nested, parallel and history states are future work.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { parse } from '@link-foundation/ui-core';
|
|
21
|
+
import { diagnostic } from './diagnostics.js';
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @typedef {string | RawValue[]} RawValue a ui-core raw value
|
|
25
|
+
*
|
|
26
|
+
* @typedef {object} Action a step of a transition, an entry or an exit
|
|
27
|
+
* @property {string} type the action name (`set`, `toggle`, a machine
|
|
28
|
+
* action or a registry name)
|
|
29
|
+
* @property {RawValue[]} args
|
|
30
|
+
*
|
|
31
|
+
* @typedef {object} Transition
|
|
32
|
+
* @property {string|null} target the next state; `null` keeps the state
|
|
33
|
+
* (an internal transition: actions only, no exit or entry)
|
|
34
|
+
* @property {Action[]} actions the `(do ...)` actions, in order
|
|
35
|
+
* @property {string[]} guards the `(when ...)` guard names; all must pass
|
|
36
|
+
*
|
|
37
|
+
* @typedef {Transition & {delay: number}} DelayedTransition
|
|
38
|
+
*
|
|
39
|
+
* @typedef {object} StateNode
|
|
40
|
+
* @property {Action[]} entry
|
|
41
|
+
* @property {Action[]} exit
|
|
42
|
+
* @property {Record<string, Transition[]>} on transitions by event; the
|
|
43
|
+
* first one whose guards pass is taken
|
|
44
|
+
* @property {DelayedTransition[]} after
|
|
45
|
+
*
|
|
46
|
+
* @typedef {object} PartSpec
|
|
47
|
+
* @property {{name: string, value: RawValue}[]} attrs `(attr NAME VALUE)`
|
|
48
|
+
* @property {{key: string, event: string}[]} keys `(key KEY EVENT)`
|
|
49
|
+
* @property {{event: string, send: string}[]} events `(on EVENT SEND)`:
|
|
50
|
+
* a UI event of the part element (`press`, `focus`, ...) sends a
|
|
51
|
+
* machine event
|
|
52
|
+
*
|
|
53
|
+
* @typedef {object} Machine
|
|
54
|
+
* @property {string|null} id
|
|
55
|
+
* @property {string|null} initial
|
|
56
|
+
* @property {Record<string, unknown>} context the initial context
|
|
57
|
+
* @property {Record<string, Action[]>} actions machine actions:
|
|
58
|
+
* `(action NAME STEP...)`, a name for a list of steps
|
|
59
|
+
* @property {Record<string, StateNode>} states
|
|
60
|
+
* @property {Record<string, PartSpec>} parts
|
|
61
|
+
*
|
|
62
|
+
* @typedef {ReturnType<typeof diagnostic>} Diagnostic
|
|
63
|
+
*/
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* The value of a context atom: `true`, `false` and decimal numbers are
|
|
67
|
+
* typed, every other atom stays text, and a link stays a list.
|
|
68
|
+
* @param {RawValue} raw
|
|
69
|
+
* @returns {unknown}
|
|
70
|
+
*/
|
|
71
|
+
export function toValue(raw) {
|
|
72
|
+
if (Array.isArray(raw)) {
|
|
73
|
+
return raw.map(toValue);
|
|
74
|
+
}
|
|
75
|
+
if (typeof raw !== 'string') {
|
|
76
|
+
return raw;
|
|
77
|
+
}
|
|
78
|
+
if (raw === 'true' || raw === 'false') {
|
|
79
|
+
return raw === 'true';
|
|
80
|
+
}
|
|
81
|
+
const number = raw.trim() === '' ? NaN : Number(raw);
|
|
82
|
+
return Number.isFinite(number) ? number : raw;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const UNITS = [
|
|
86
|
+
['ms', 1],
|
|
87
|
+
['s', 1000],
|
|
88
|
+
];
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* A delay in milliseconds: `500ms`, `2s` or a number of milliseconds;
|
|
92
|
+
* `NaN` when it is none of these.
|
|
93
|
+
* @param {RawValue} raw
|
|
94
|
+
*/
|
|
95
|
+
export function parseDelay(raw) {
|
|
96
|
+
if (typeof raw !== 'string') {
|
|
97
|
+
return NaN;
|
|
98
|
+
}
|
|
99
|
+
for (const [unit, factor] of UNITS) {
|
|
100
|
+
if (raw.endsWith(unit)) {
|
|
101
|
+
const amount = raw.slice(0, -unit.length);
|
|
102
|
+
return amount === '' ? NaN : toDelay(Number(amount) * factor);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return raw === '' ? NaN : toDelay(Number(raw));
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const toDelay = (ms) => (Number.isFinite(ms) && ms >= 0 ? ms : NaN);
|
|
109
|
+
|
|
110
|
+
/** Every sublink of a node as `[head, ...values]`, properties first. */
|
|
111
|
+
function entriesOf(node) {
|
|
112
|
+
const entries = (node.properties ?? []).map((p) => [p.name, ...p.values]);
|
|
113
|
+
for (const raw of node.unknown ?? []) {
|
|
114
|
+
if (Array.isArray(raw) && typeof raw[0] === 'string') {
|
|
115
|
+
entries.push(raw);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return entries;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/** Split `[head, ...values]` sublinks of a link (atoms are skipped). */
|
|
122
|
+
const linksOf = (values) =>
|
|
123
|
+
values.filter((v) => Array.isArray(v) && typeof v[0] === 'string');
|
|
124
|
+
|
|
125
|
+
/** Read the actions of a `(do ...)`, `(entry ...)` or `(exit ...)`. */
|
|
126
|
+
function readActions(values, report) {
|
|
127
|
+
const actions = [];
|
|
128
|
+
for (const value of values) {
|
|
129
|
+
if (typeof value === 'string') {
|
|
130
|
+
actions.push({ type: value, args: [] });
|
|
131
|
+
} else if (Array.isArray(value) && typeof value[0] === 'string') {
|
|
132
|
+
actions.push({ type: value[0], args: value.slice(1) });
|
|
133
|
+
} else {
|
|
134
|
+
report('invalid-action', 'error', {});
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
return actions;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/** Read `(target T)`, `(do ...)` and `(when ...)` of a transition. */
|
|
141
|
+
function readTransition(links, report, at) {
|
|
142
|
+
const transition = { target: null, actions: [], guards: [] };
|
|
143
|
+
for (const [head, ...values] of links) {
|
|
144
|
+
if (head === 'target' && typeof values[0] === 'string') {
|
|
145
|
+
transition.target = values[0];
|
|
146
|
+
} else if (head === 'do') {
|
|
147
|
+
transition.actions.push(...readActions(values, report));
|
|
148
|
+
} else if (head === 'when') {
|
|
149
|
+
transition.guards.push(...values.filter((v) => typeof v === 'string'));
|
|
150
|
+
} else {
|
|
151
|
+
report('unknown-field', 'warning', { ...at, field: head });
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return transition;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/** Read `(state NAME (on ...) (entry ...) (exit ...) (after ...))`. */
|
|
158
|
+
function readState(name, values, report) {
|
|
159
|
+
const state = { entry: [], exit: [], on: {}, after: [] };
|
|
160
|
+
const at = { state: name };
|
|
161
|
+
for (const [head, ...rest] of linksOf(values)) {
|
|
162
|
+
if (head === 'entry' || head === 'exit') {
|
|
163
|
+
state[head].push(...readActions(rest, report));
|
|
164
|
+
} else if (head === 'on') {
|
|
165
|
+
const [event, ...links] = rest;
|
|
166
|
+
if (typeof event !== 'string') {
|
|
167
|
+
report('invalid-transition', 'error', at);
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
const transition = readTransition(linksOf(links), report, at);
|
|
171
|
+
(state.on[event] ??= []).push(transition);
|
|
172
|
+
} else if (head === 'after') {
|
|
173
|
+
const [delay, ...links] = rest;
|
|
174
|
+
const ms = parseDelay(delay);
|
|
175
|
+
if (Number.isNaN(ms)) {
|
|
176
|
+
report('invalid-delay', 'error', { ...at, delay: String(delay) });
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
state.after.push({
|
|
180
|
+
delay: ms,
|
|
181
|
+
...readTransition(linksOf(links), report, at),
|
|
182
|
+
});
|
|
183
|
+
} else {
|
|
184
|
+
report('unknown-field', 'warning', { ...at, field: head });
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return state;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/** Read `(part NAME (attr ...) (key ...) (on ...))`. */
|
|
191
|
+
function readPart(values, report) {
|
|
192
|
+
const part = { attrs: [], keys: [], events: [] };
|
|
193
|
+
for (const [head, ...rest] of linksOf(values)) {
|
|
194
|
+
const [first, second] = rest;
|
|
195
|
+
if (head === 'attr' && typeof first === 'string' && rest.length === 2) {
|
|
196
|
+
part.attrs.push({ name: first, value: second });
|
|
197
|
+
} else if (
|
|
198
|
+
(head === 'key' || head === 'on') &&
|
|
199
|
+
typeof first === 'string' &&
|
|
200
|
+
typeof second === 'string'
|
|
201
|
+
) {
|
|
202
|
+
if (head === 'key') {
|
|
203
|
+
part.keys.push({ key: first, event: second });
|
|
204
|
+
} else {
|
|
205
|
+
part.events.push({ event: first, send: second });
|
|
206
|
+
}
|
|
207
|
+
} else {
|
|
208
|
+
report('unknown-field', 'warning', { field: head });
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
return part;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/** Read `(context (name value) ...)` into an object. */
|
|
215
|
+
function readContext(values, context) {
|
|
216
|
+
for (const link of linksOf(values)) {
|
|
217
|
+
const [name, ...rest] = link;
|
|
218
|
+
context[name] =
|
|
219
|
+
rest.length === 1 ? toValue(rest[0]) : rest.map((v) => toValue(v));
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/** Report transitions to states that do not exist. */
|
|
224
|
+
function checkTargets(machine, report) {
|
|
225
|
+
for (const [name, state] of Object.entries(machine.states)) {
|
|
226
|
+
const transitions = [...Object.values(state.on).flat(), ...state.after];
|
|
227
|
+
for (const { target } of transitions) {
|
|
228
|
+
if (target !== null && !Object.hasOwn(machine.states, target)) {
|
|
229
|
+
report('unknown-target', 'error', { state: name, target });
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
if (machine.initial === null) {
|
|
234
|
+
report('missing-initial', 'error', {});
|
|
235
|
+
} else if (!Object.hasOwn(machine.states, machine.initial)) {
|
|
236
|
+
report('unknown-initial', 'error', { state: machine.initial });
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/** The fields that declare a named state, action or part. */
|
|
241
|
+
const NAMED = new Set(['state', 'action', 'part']);
|
|
242
|
+
|
|
243
|
+
/** Read `(state NAME ...)`, `(action NAME ...)` or `(part NAME ...)`. */
|
|
244
|
+
function readNamed(machine, head, [name, ...rest], report) {
|
|
245
|
+
if (head === 'state') {
|
|
246
|
+
if (Object.hasOwn(machine.states, name)) {
|
|
247
|
+
report('duplicate-state', 'error', { state: name });
|
|
248
|
+
} else {
|
|
249
|
+
machine.states[name] = readState(name, rest, report);
|
|
250
|
+
}
|
|
251
|
+
} else if (head === 'action') {
|
|
252
|
+
if (Object.hasOwn(machine.actions, name)) {
|
|
253
|
+
report('duplicate-action', 'error', { action: name });
|
|
254
|
+
}
|
|
255
|
+
machine.actions[name] = readActions(rest, report);
|
|
256
|
+
} else {
|
|
257
|
+
machine.parts[name] = readPart(rest, report);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/** Read one machine element (a ui-core node or a store element view). */
|
|
262
|
+
function readMachine(node, diagnostics) {
|
|
263
|
+
const id = node.id ?? null;
|
|
264
|
+
const report = (code, severity, at) =>
|
|
265
|
+
diagnostics.push(diagnostic(code, severity, { machine: id, ...at }));
|
|
266
|
+
/** @type {Machine} */
|
|
267
|
+
const machine = {
|
|
268
|
+
id,
|
|
269
|
+
initial: null,
|
|
270
|
+
context: {},
|
|
271
|
+
actions: {},
|
|
272
|
+
states: {},
|
|
273
|
+
parts: {},
|
|
274
|
+
};
|
|
275
|
+
for (const [head, ...values] of entriesOf(node)) {
|
|
276
|
+
if (head === 'initial' && typeof values[0] === 'string') {
|
|
277
|
+
machine.initial = values[0];
|
|
278
|
+
} else if (head === 'context') {
|
|
279
|
+
readContext(values, machine.context);
|
|
280
|
+
} else if (NAMED.has(head) && typeof values[0] === 'string') {
|
|
281
|
+
readNamed(machine, head, values, report);
|
|
282
|
+
} else if (head !== 'note' && head !== 'machine') {
|
|
283
|
+
report('unknown-field', 'warning', { field: head });
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
checkTargets(machine, report);
|
|
287
|
+
return machine;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/** The candidate nodes of a source: text, a ui-core document or a node. */
|
|
291
|
+
function nodesOf(source, diagnostics, options) {
|
|
292
|
+
if (typeof source === 'string') {
|
|
293
|
+
const document = parse(source, options.parseOptions);
|
|
294
|
+
diagnostics.push(...document.diagnostics);
|
|
295
|
+
return document.roots;
|
|
296
|
+
}
|
|
297
|
+
if (source !== null && typeof source === 'object') {
|
|
298
|
+
return Array.isArray(source.roots) ? source.roots : [source];
|
|
299
|
+
}
|
|
300
|
+
return [];
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Read every `machine` element of a source.
|
|
305
|
+
* @param {string | object} source LiNo text, a ui-core document, or one
|
|
306
|
+
* node (a ui-core node or a ui-store element view of kind `machine`)
|
|
307
|
+
* @param {{parseOptions?: object}} [options]
|
|
308
|
+
* @returns {{machines: Map<string, Machine>, diagnostics: Diagnostic[]}}
|
|
309
|
+
*/
|
|
310
|
+
export function parseMachines(source, options = {}) {
|
|
311
|
+
const diagnostics = [];
|
|
312
|
+
const machines = new Map();
|
|
313
|
+
const visit = (node) => {
|
|
314
|
+
if (node?.kind === 'machine') {
|
|
315
|
+
const machine = readMachine(node, diagnostics);
|
|
316
|
+
machines.set(machine.id ?? `_${machines.size}`, machine);
|
|
317
|
+
}
|
|
318
|
+
(node?.children ?? []).forEach(visit);
|
|
319
|
+
};
|
|
320
|
+
nodesOf(source, diagnostics, options).forEach(visit);
|
|
321
|
+
return { machines, diagnostics };
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* Read the first `machine` element of a source.
|
|
326
|
+
* @param {string | object} source LiNo text, a ui-core document or node
|
|
327
|
+
* @param {{parseOptions?: object}} [options]
|
|
328
|
+
* @returns {{machine: Machine|null, diagnostics: Diagnostic[]}}
|
|
329
|
+
*/
|
|
330
|
+
export function parseMachine(source, options = {}) {
|
|
331
|
+
const { machines, diagnostics } = parseMachines(source, options);
|
|
332
|
+
const [machine = null] = machines.values();
|
|
333
|
+
if (machine === null) {
|
|
334
|
+
diagnostics.push(
|
|
335
|
+
diagnostic('invalid-machine', 'error', {
|
|
336
|
+
reason: 'no element of kind machine',
|
|
337
|
+
})
|
|
338
|
+
);
|
|
339
|
+
}
|
|
340
|
+
return { machine, diagnostics };
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/** Thrown by `createMachine` for a machine with errors. */
|
|
344
|
+
export class MachineError extends Error {
|
|
345
|
+
/** @param {Diagnostic[]} diagnostics */
|
|
346
|
+
constructor(diagnostics) {
|
|
347
|
+
super(diagnostics.map((d) => d.message).join('; '));
|
|
348
|
+
this.name = 'MachineError';
|
|
349
|
+
this.diagnostics = diagnostics;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* A machine from LiNo text or a node; throws a `MachineError` listing the
|
|
355
|
+
* error diagnostics when there are any (warnings are ignored).
|
|
356
|
+
* @param {string | object} source
|
|
357
|
+
* @param {{parseOptions?: object}} [options]
|
|
358
|
+
* @returns {Machine}
|
|
359
|
+
*/
|
|
360
|
+
export function createMachine(source, options) {
|
|
361
|
+
const { machine, diagnostics } = parseMachine(source, options);
|
|
362
|
+
const errors = diagnostics.filter((d) => d.severity === 'error');
|
|
363
|
+
if (errors.length > 0) {
|
|
364
|
+
throw new MachineError(errors);
|
|
365
|
+
}
|
|
366
|
+
return machine;
|
|
367
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Activity charts
|
|
2
|
+
|
|
3
|
+
Serve `packages/ui-components/examples/activity-charts.html` with
|
|
4
|
+
`node scripts/serve-static.mjs` from the repository root. The gallery reads
|
|
5
|
+
[activity-charts.lino](../../examples/activity-charts.lino); data fetching and
|
|
6
|
+
consumer text stay with the application.
|
|
7
|
+
|
|
8
|
+
All options round-trip through `parseChart` / `chartToLino`. Object properties
|
|
9
|
+
use camelCase; LiNo uses kebab-case. Assign objects to `uiChart.spec`. The
|
|
10
|
+
`tooltip.content` callback stays in memory; serialization writes only its layer.
|
|
11
|
+
|
|
12
|
+
| Object option | LiNo | Behavior |
|
|
13
|
+
| ------------------------------------------- | -------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
14
|
+
| `encoding.y.scale: {type: 'log', base: 10}` | `scale` with `type log`, `base 10` under the field | Positive powers are ticks. Nonpositive values clamp to the positive domain minimum; `layoutChart().diagnostics` and the element's `chart-diagnostic` event report each row. Original values remain in the table and tooltip. |
|
|
15
|
+
| `cornerRadius: 4` | `corner-radius 4` | Round the two corners at the value end of vertical or horizontal bars, including negative values. |
|
|
16
|
+
| `labels: 'peaks'` or `'last'` | `labels peaks` or `labels last` | Label interior local maxima or the final point of each Cartesian series. |
|
|
17
|
+
| `emphasis: 'favourite'` | `emphasis favourite` | Values `true`, `1`, `'true'`, `'1'` add a star and accessible emphasis text. |
|
|
18
|
+
| `topN: 5` | `top-n 5` | Composition retains five largest categories and aggregates the remainder as muted Other, last. Shares use the total including Other. |
|
|
19
|
+
| `weekStart: 1` | `week-start 1` | Calendar weekday origin, 0 Sunday through 6 Saturday; default Sunday. |
|
|
20
|
+
| `thresholds: [1,3,5,7]` | `thresholds 1 3 5 7` | Four increasing boundaries produce five calendar levels; omitted boundaries use data quantiles. |
|
|
21
|
+
| `ongoingEnd: '2026-01-01'` | `ongoing-end 2026-01-01` | Timeline snapshot date for absent or `ongoing` ends. Default is January 1 of the year after the latest supplied date, keeping rendering deterministic. |
|
|
22
|
+
|
|
23
|
+
A calendar encodes `x` as a temporal date and `y` as a quantitative value. It
|
|
24
|
+
lays out supplied days in UTC week columns and weekday rows, with month labels,
|
|
25
|
+
Mon/Wed/Fri labels and a Less–More legend. A full year such as 2025 spans 53
|
|
26
|
+
columns (alignment can require 54 for a leap year). The scroll region opens at
|
|
27
|
+
the newest week. Up/Down move one day, Left/Right one week when that day exists;
|
|
28
|
+
Home/End reach the first/last supplied day. The table retains every supplied day.
|
|
29
|
+
|
|
30
|
+
A range encodes temporal `x` (start), temporal `x2` (end), nominal `y` (row name)
|
|
31
|
+
and optional `color` (category). End fields can be omitted or contain `ongoing`.
|
|
32
|
+
Ends before starts are rejected. Solid, hatched and dotted patterns cycle with
|
|
33
|
+
categories in both bars and legend. Tab focuses bars; arrows and Home/End
|
|
34
|
+
navigate and announce rows. A composition uses quantitative `theta` and nominal
|
|
35
|
+
`color`, aggregates repeated categories and draws one horizontal 100% bar with a
|
|
36
|
+
name/percentage legend. Tables retain original rows rather than aggregated ones.
|
|
37
|
+
|
|
38
|
+
```js
|
|
39
|
+
chart.spec = {
|
|
40
|
+
...spec,
|
|
41
|
+
tooltip: {
|
|
42
|
+
layer: 'top',
|
|
43
|
+
content: (datum) => ({
|
|
44
|
+
title: datum.name,
|
|
45
|
+
value: datum.count,
|
|
46
|
+
rows: [['Source', 'Snapshot']],
|
|
47
|
+
}),
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Top tooltips use the shared `positionFloating` helper and a manual popover,
|
|
53
|
+
escaping `overflow` and `clip-path` ancestors. They anchor to the pointer or the
|
|
54
|
+
keyboard mark's top centre, and prefer the left side in the rightmost 40% of
|
|
55
|
+
the plot. Viewport collision handling still applies. Escape, blur, rerender and
|
|
56
|
+
disconnection dismiss the tooltip and release positioning listeners. Content is
|
|
57
|
+
rendered as text, including callback values. `layer: 'inline'` retains the inline
|
|
58
|
+
layer. Existing charts without tooltip configuration retain plain text tooltips.
|
|
59
|
+
|
|
60
|
+
A `tag-cloud` has `label`, `min-size` (default 12), `max-size` (default 36) and
|
|
61
|
+
`items` containing `item NAME` with optional `count`, `color` and `emphasis true`.
|
|
62
|
+
Object items use `{name, count, color, emphasis}`. Sizes interpolate with
|
|
63
|
+
`log(1 + count)` relative to the largest count; missing/zero counts use the
|
|
64
|
+
minimum. DOM output is a semantic list with counts in accessible names and stars
|
|
65
|
+
for emphasized items. SVG export keeps a title for each item.
|
|
66
|
+
|
|
67
|
+
A stat tile accepts `notation compact`, `compact-threshold 10000`, `hint TEXT`
|
|
68
|
+
and `footnote` with `label` and `href`. Object options are `notation`,
|
|
69
|
+
`compactThreshold`, `hint`, `footnote: {label, href}`. Compact formatting starts
|
|
70
|
+
at the absolute threshold using English short notation, so 123456 becomes 123K;
|
|
71
|
+
the exact value stays in the SVG title, accessible name and table. The footnote
|
|
72
|
+
is a real keyboard-focusable link. HTTP(S), mailto, root-relative and fragment
|
|
73
|
+
links are accepted.
|
|
74
|
+
|
|
75
|
+
These extensions use SVG even when `renderer: 'echarts'` is requested, preserving
|
|
76
|
+
the same geometry, tooltips and keyboard behavior. The standalone ECharts adapter
|
|
77
|
+
rejects extended specs with an explicit error; original chart specs keep their
|
|
78
|
+
existing optional ECharts renderer.
|