@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,267 @@
|
|
|
1
|
+
/// <reference lib="dom" />
|
|
2
|
+
|
|
3
|
+
import type { UiNode, Vocabulary } from '@link-foundation/ui-core';
|
|
4
|
+
|
|
5
|
+
/* Layer manager */
|
|
6
|
+
|
|
7
|
+
export type Layer = 'base' | 'dock' | 'window' | 'popover' | 'modal' | 'toast';
|
|
8
|
+
|
|
9
|
+
/** The layers, lowest first. */
|
|
10
|
+
export const LAYERS: readonly Layer[];
|
|
11
|
+
|
|
12
|
+
export interface LayerManager {
|
|
13
|
+
/** Add a surface to a layer (on top of it). */
|
|
14
|
+
register(id: string, layer: Layer): void;
|
|
15
|
+
/** Put a surface on top of its layer. */
|
|
16
|
+
raise(id: string): void;
|
|
17
|
+
/** The z-index of a surface; a higher layer is always above a lower one. */
|
|
18
|
+
zIndexOf(id: string): number;
|
|
19
|
+
layerOf(id: string): Layer | undefined;
|
|
20
|
+
unregister(id: string): void;
|
|
21
|
+
/** Called after every change; returns the unsubscribe function. */
|
|
22
|
+
subscribe(listener: () => void): () => void;
|
|
23
|
+
/** The surfaces, lowest first. */
|
|
24
|
+
order(): string[];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function createLayerManager(options?: {
|
|
28
|
+
base?: number;
|
|
29
|
+
step?: number;
|
|
30
|
+
}): LayerManager;
|
|
31
|
+
|
|
32
|
+
/* Split model */
|
|
33
|
+
|
|
34
|
+
export interface SplitLimits {
|
|
35
|
+
min?: number | number[];
|
|
36
|
+
max?: number | number[];
|
|
37
|
+
collapsible?: boolean | boolean[];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function resizeSplit(
|
|
41
|
+
sizes: readonly number[],
|
|
42
|
+
index: number,
|
|
43
|
+
delta: number,
|
|
44
|
+
limits?: SplitLimits
|
|
45
|
+
): number[];
|
|
46
|
+
export function collapsePane(
|
|
47
|
+
sizes: readonly number[],
|
|
48
|
+
index: number,
|
|
49
|
+
limits?: SplitLimits
|
|
50
|
+
): number[];
|
|
51
|
+
export function restorePane(
|
|
52
|
+
sizes: readonly number[],
|
|
53
|
+
index: number,
|
|
54
|
+
size: number,
|
|
55
|
+
limits?: SplitLimits
|
|
56
|
+
): number[];
|
|
57
|
+
export function normalizeSizes(
|
|
58
|
+
sizes: unknown,
|
|
59
|
+
count: number,
|
|
60
|
+
total?: number
|
|
61
|
+
): number[];
|
|
62
|
+
export function paneLimits(
|
|
63
|
+
sizes: readonly number[],
|
|
64
|
+
index: number,
|
|
65
|
+
limits?: SplitLimits
|
|
66
|
+
): { min: number; max: number; collapsible: boolean };
|
|
67
|
+
export function sum(values: readonly number[]): number;
|
|
68
|
+
|
|
69
|
+
/** `(sizes 30 70)` of remembered split sizes. */
|
|
70
|
+
export function sizesToLino(sizes: readonly number[]): string;
|
|
71
|
+
/** The sizes of a `(sizes ...)` text; `null` when it is not one. */
|
|
72
|
+
export function sizesFromLino(text: string | null | undefined): number[] | null;
|
|
73
|
+
/** The current sizes of a rendered split. */
|
|
74
|
+
export function splitSizes(node: Element): number[];
|
|
75
|
+
|
|
76
|
+
/* Dock model */
|
|
77
|
+
|
|
78
|
+
export type Side = 'left' | 'right' | 'top' | 'bottom' | 'center';
|
|
79
|
+
|
|
80
|
+
export interface DockRegion {
|
|
81
|
+
id: string;
|
|
82
|
+
side: Side;
|
|
83
|
+
/** A CSS length such as `16rem`. */
|
|
84
|
+
size: string | null;
|
|
85
|
+
collapsed: boolean;
|
|
86
|
+
/** Panel ids in tab order. */
|
|
87
|
+
panels: string[];
|
|
88
|
+
/** The panel shown. */
|
|
89
|
+
active: string | null;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export interface FloatingPanel {
|
|
93
|
+
panel: string;
|
|
94
|
+
x: number;
|
|
95
|
+
y: number;
|
|
96
|
+
width: number;
|
|
97
|
+
height: number;
|
|
98
|
+
/** The region it was floated from. */
|
|
99
|
+
region: string | null;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export interface ClosedPanel {
|
|
103
|
+
panel: string;
|
|
104
|
+
/** The region it was closed in. */
|
|
105
|
+
region: string | null;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export interface DockLayout {
|
|
109
|
+
id: string | null;
|
|
110
|
+
/** The storage key of the layout. */
|
|
111
|
+
persist: string | null;
|
|
112
|
+
regions: DockRegion[];
|
|
113
|
+
floating: FloatingPanel[];
|
|
114
|
+
closed: ClosedPanel[];
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export type PanelPlace =
|
|
118
|
+
| { place: 'region'; region: DockRegion; index: number }
|
|
119
|
+
| { place: 'floating'; floating: FloatingPanel; index: number }
|
|
120
|
+
| { place: 'closed'; closed: ClosedPanel; index: number };
|
|
121
|
+
|
|
122
|
+
export const SIDES: readonly Side[];
|
|
123
|
+
export const FLOAT_DEFAULTS: Readonly<{
|
|
124
|
+
x: number;
|
|
125
|
+
y: number;
|
|
126
|
+
width: number;
|
|
127
|
+
height: number;
|
|
128
|
+
}>;
|
|
129
|
+
|
|
130
|
+
export function dockLayoutFromNode(node: UiNode): DockLayout;
|
|
131
|
+
export function dockLayoutFromLinks(
|
|
132
|
+
links: string | object | object[],
|
|
133
|
+
options?: { id?: string }
|
|
134
|
+
): DockLayout;
|
|
135
|
+
export function dockLayoutToLino(
|
|
136
|
+
layout: DockLayout,
|
|
137
|
+
options?: { indent?: string }
|
|
138
|
+
): string;
|
|
139
|
+
export function findPanel(
|
|
140
|
+
layout: DockLayout,
|
|
141
|
+
panelId: string
|
|
142
|
+
): PanelPlace | null;
|
|
143
|
+
export function panelIds(layout: DockLayout): string[];
|
|
144
|
+
export function openPanelIds(layout: DockLayout): string[];
|
|
145
|
+
export function movePanel(
|
|
146
|
+
layout: DockLayout,
|
|
147
|
+
panelId: string,
|
|
148
|
+
target: string | { region: string; index?: number; activate?: boolean }
|
|
149
|
+
): DockLayout;
|
|
150
|
+
export function floatPanel(
|
|
151
|
+
layout: DockLayout,
|
|
152
|
+
panelId: string,
|
|
153
|
+
rect?: { x?: number; y?: number; width?: number; height?: number }
|
|
154
|
+
): DockLayout;
|
|
155
|
+
export function closePanel(layout: DockLayout, panelId: string): DockLayout;
|
|
156
|
+
export function restorePanel(
|
|
157
|
+
layout: DockLayout,
|
|
158
|
+
panelId: string,
|
|
159
|
+
target?: string | { region: string; index?: number }
|
|
160
|
+
): DockLayout;
|
|
161
|
+
export function activatePanel(layout: DockLayout, panelId: string): DockLayout;
|
|
162
|
+
export function updateRegion(
|
|
163
|
+
layout: DockLayout,
|
|
164
|
+
regionId: string,
|
|
165
|
+
change: { size?: string | null; collapsed?: boolean }
|
|
166
|
+
): DockLayout;
|
|
167
|
+
/** The current layout of a rendered dock. */
|
|
168
|
+
export function dockLayout(node: Element): DockLayout | null;
|
|
169
|
+
|
|
170
|
+
/* Vocabulary */
|
|
171
|
+
|
|
172
|
+
export const LAYOUT_VOCABULARY_TEXT: string;
|
|
173
|
+
/** The ui-dialect vocabulary with the layout kinds. */
|
|
174
|
+
export function layoutVocabulary(): Vocabulary;
|
|
175
|
+
|
|
176
|
+
/* Rendered elements */
|
|
177
|
+
|
|
178
|
+
/** The options of the layout kinds: `render(container, store, { layout })`. */
|
|
179
|
+
export interface LayoutRenderOptions {
|
|
180
|
+
/** Where `remember-size` and `persist` save (e.g. `localStorage`). */
|
|
181
|
+
storage?: Pick<Storage, 'getItem' | 'setItem'>;
|
|
182
|
+
/** The layer manager of windows and floating panels. */
|
|
183
|
+
layers?: LayerManager;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/** Write the flexbox styles of a stack element (the `changed` names). */
|
|
187
|
+
export function updateFlex(
|
|
188
|
+
node: HTMLElement,
|
|
189
|
+
el: object,
|
|
190
|
+
changed: readonly string[],
|
|
191
|
+
ctx: object
|
|
192
|
+
): void;
|
|
193
|
+
export function isTrackAtom(text: string): boolean;
|
|
194
|
+
/** The CSS track list of `columns` or `rows`. */
|
|
195
|
+
export function trackList(
|
|
196
|
+
raws: readonly unknown[] | undefined
|
|
197
|
+
): string | null | undefined;
|
|
198
|
+
/** The `grid-template-areas` of `areas`. */
|
|
199
|
+
export function areaList(
|
|
200
|
+
raws: readonly unknown[] | undefined
|
|
201
|
+
): { css: string; names: Set<string> } | null | undefined;
|
|
202
|
+
|
|
203
|
+
/** The selected panel id of a rendered tab group. */
|
|
204
|
+
export function activeTab(node: Element): string | null;
|
|
205
|
+
|
|
206
|
+
export interface Rect {
|
|
207
|
+
x: number;
|
|
208
|
+
y: number;
|
|
209
|
+
width: number;
|
|
210
|
+
height: number;
|
|
211
|
+
}
|
|
212
|
+
/** A rectangle moved and sized to lie inside the viewport. */
|
|
213
|
+
export function clampRect(
|
|
214
|
+
rect: Rect,
|
|
215
|
+
viewport: { width: number; height: number }
|
|
216
|
+
): Rect;
|
|
217
|
+
export function viewportOf(document: Document): {
|
|
218
|
+
width: number;
|
|
219
|
+
height: number;
|
|
220
|
+
};
|
|
221
|
+
/** The controller of a rendered window. */
|
|
222
|
+
export function windowController(node: Element):
|
|
223
|
+
| {
|
|
224
|
+
show(focus: boolean): void;
|
|
225
|
+
hide(): void;
|
|
226
|
+
frame: { readonly rect: Rect; setRect(rect: Partial<Rect>): void };
|
|
227
|
+
}
|
|
228
|
+
| undefined;
|
|
229
|
+
|
|
230
|
+
export type ShellMode = 'bottom-bar' | 'rail' | 'drawer';
|
|
231
|
+
export const SHELL_MODES: readonly ShellMode[];
|
|
232
|
+
export const SHELL_BREAKPOINTS: readonly number[];
|
|
233
|
+
/** The mode of an app shell at a viewport width. */
|
|
234
|
+
export function shellMode(
|
|
235
|
+
width: number,
|
|
236
|
+
breakpoints?: readonly number[]
|
|
237
|
+
): ShellMode;
|
|
238
|
+
/** The mode of a rendered app shell. */
|
|
239
|
+
export function appShellMode(node: Element): ShellMode | null;
|
|
240
|
+
|
|
241
|
+
/** Quick preference fields, all registered as comfort by bindConfig. */
|
|
242
|
+
export const PREF_SWITCHES_SCHEMA: string;
|
|
243
|
+
export interface PreferenceTarget {
|
|
244
|
+
values(): Record<string, unknown>;
|
|
245
|
+
update(values: Record<string, unknown>): unknown;
|
|
246
|
+
subscribe?(listener: (values: Record<string, unknown>) => void): () => void;
|
|
247
|
+
}
|
|
248
|
+
export interface PrefSwitchOptions {
|
|
249
|
+
document?: Document;
|
|
250
|
+
target?: PreferenceTarget;
|
|
251
|
+
localizer?: { locale(): string; setLocale(locale: string): void };
|
|
252
|
+
languages?: { locale: string; label: string }[];
|
|
253
|
+
scope?: HTMLElement;
|
|
254
|
+
label?: string;
|
|
255
|
+
languageLabel?: string;
|
|
256
|
+
message?: (
|
|
257
|
+
key: string,
|
|
258
|
+
params: Record<string, unknown>
|
|
259
|
+
) => string | undefined;
|
|
260
|
+
onChange?: (values: Record<string, unknown>) => void;
|
|
261
|
+
}
|
|
262
|
+
/** Also supplied as render options.layout.preferences for the LiNo kind. */
|
|
263
|
+
export function createPrefSwitches(options?: PrefSwitchOptions): {
|
|
264
|
+
element: HTMLElement;
|
|
265
|
+
refresh(): void;
|
|
266
|
+
destroy(): void;
|
|
267
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The layout elements of ui-components: pure models (layer manager, split
|
|
3
|
+
* and dock), the layout vocabulary and the ui-dom kinds (registered when
|
|
4
|
+
* this module is imported).
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export { createLayerManager, LAYERS } from './layer-manager.js';
|
|
8
|
+
export {
|
|
9
|
+
collapsePane,
|
|
10
|
+
normalizeSizes,
|
|
11
|
+
paneLimits,
|
|
12
|
+
resizeSplit,
|
|
13
|
+
restorePane,
|
|
14
|
+
sum,
|
|
15
|
+
} from './split-model.js';
|
|
16
|
+
export {
|
|
17
|
+
activatePanel,
|
|
18
|
+
closePanel,
|
|
19
|
+
dockLayoutFromLinks,
|
|
20
|
+
dockLayoutFromNode,
|
|
21
|
+
dockLayoutToLino,
|
|
22
|
+
findPanel,
|
|
23
|
+
FLOAT_DEFAULTS,
|
|
24
|
+
floatPanel,
|
|
25
|
+
movePanel,
|
|
26
|
+
openPanelIds,
|
|
27
|
+
panelIds,
|
|
28
|
+
restorePanel,
|
|
29
|
+
SIDES,
|
|
30
|
+
updateRegion,
|
|
31
|
+
} from './dock-model.js';
|
|
32
|
+
export { LAYOUT_VOCABULARY_TEXT, layoutVocabulary } from './vocabulary.js';
|
|
33
|
+
|
|
34
|
+
import './stack.js';
|
|
35
|
+
import './grid.js';
|
|
36
|
+
import './split.js';
|
|
37
|
+
import './panel.js';
|
|
38
|
+
import './surfaces.js';
|
|
39
|
+
import './tab-group.js';
|
|
40
|
+
import './window.js';
|
|
41
|
+
import './dock.js';
|
|
42
|
+
import './app-shell.js';
|
|
43
|
+
|
|
44
|
+
export { updateFlex } from './stack.js';
|
|
45
|
+
export { areaList, isTrackAtom, trackList } from './grid.js';
|
|
46
|
+
export { sizesFromLino, sizesToLino, splitSizes } from './split.js';
|
|
47
|
+
export { activeTab } from './tab-group.js';
|
|
48
|
+
export { clampRect, viewportOf } from './window-frame.js';
|
|
49
|
+
export { windowController } from './window.js';
|
|
50
|
+
export { dockLayout } from './dock.js';
|
|
51
|
+
export {
|
|
52
|
+
appShellMode,
|
|
53
|
+
SHELL_BREAKPOINTS,
|
|
54
|
+
SHELL_MODES,
|
|
55
|
+
shellMode,
|
|
56
|
+
} from './app-shell.js';
|
|
57
|
+
|
|
58
|
+
import './page-links.js';
|
|
59
|
+
import './nav-strip.js';
|
|
60
|
+
export { createPrefSwitches, PREF_SWITCHES_SCHEMA } from './pref-switches.js';
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The layer manager: one place that decides the stacking order (`z-index`)
|
|
3
|
+
* of every floating surface. Layers have a fixed order, so raising a
|
|
4
|
+
* surface only moves it within its own layer: a raised `window` can never
|
|
5
|
+
* be drawn above a `modal` (deepcase-app issue 290).
|
|
6
|
+
*
|
|
7
|
+
* Deterministic: the order within a layer comes from a counter of `raise`
|
|
8
|
+
* calls, never from a clock.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/** The layers, lowest first. */
|
|
12
|
+
export const LAYERS = Object.freeze([
|
|
13
|
+
'base',
|
|
14
|
+
'dock',
|
|
15
|
+
'window',
|
|
16
|
+
'popover',
|
|
17
|
+
'modal',
|
|
18
|
+
'toast',
|
|
19
|
+
]);
|
|
20
|
+
|
|
21
|
+
const RANK = new Map(LAYERS.map((layer, i) => [layer, i]));
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @typedef {'base'|'dock'|'window'|'popover'|'modal'|'toast'} Layer
|
|
25
|
+
*
|
|
26
|
+
* @typedef {object} LayerManager
|
|
27
|
+
* @property {(id: string, layer: Layer) => void} register add a surface
|
|
28
|
+
* (or move it to another layer) on top of its layer
|
|
29
|
+
* @property {(id: string) => void} raise put a surface on top of its layer
|
|
30
|
+
* @property {(id: string) => number} zIndexOf the z-index of a surface;
|
|
31
|
+
* `NaN` when it is not registered
|
|
32
|
+
* @property {(id: string) => Layer|undefined} layerOf
|
|
33
|
+
* @property {(id: string) => void} unregister
|
|
34
|
+
* @property {(listener: () => void) => () => void} subscribe called after
|
|
35
|
+
* every change; returns the unsubscribe function
|
|
36
|
+
* @property {() => string[]} order the surfaces, lowest first
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @param {{ base?: number, step?: number }} [options] `base` is the
|
|
41
|
+
* z-index of the lowest surface (default 1), `step` the distance between
|
|
42
|
+
* two surfaces (default 1)
|
|
43
|
+
* @returns {LayerManager}
|
|
44
|
+
*/
|
|
45
|
+
export function createLayerManager(options = {}) {
|
|
46
|
+
const base = options.base ?? 1;
|
|
47
|
+
const step = options.step ?? 1;
|
|
48
|
+
if (!Number.isFinite(base) || !Number.isFinite(step) || step <= 0) {
|
|
49
|
+
throw new RangeError(
|
|
50
|
+
'createLayerManager: base must be a number and step a positive number'
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
/** @type {Map<string, {layer: Layer, raised: number}>} */
|
|
54
|
+
const surfaces = new Map();
|
|
55
|
+
const listeners = new Set();
|
|
56
|
+
let counter = 0;
|
|
57
|
+
/** @type {Map<string, number>|null} */
|
|
58
|
+
let indexes = null;
|
|
59
|
+
|
|
60
|
+
const compare = ([, a], [, b]) =>
|
|
61
|
+
RANK.get(a.layer) - RANK.get(b.layer) || a.raised - b.raised;
|
|
62
|
+
|
|
63
|
+
function computeIndexes() {
|
|
64
|
+
indexes ??= new Map(
|
|
65
|
+
[...surfaces].sort(compare).map(([id], rank) => [id, base + rank * step])
|
|
66
|
+
);
|
|
67
|
+
return indexes;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function changed() {
|
|
71
|
+
indexes = null;
|
|
72
|
+
for (const listener of [...listeners]) {
|
|
73
|
+
listener();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return {
|
|
78
|
+
register(id, layer) {
|
|
79
|
+
if (!RANK.has(layer)) {
|
|
80
|
+
throw new RangeError(
|
|
81
|
+
`createLayerManager: unknown layer "${layer}" (expected ${LAYERS.join(', ')})`
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
counter += 1;
|
|
85
|
+
surfaces.set(id, { layer, raised: counter });
|
|
86
|
+
changed();
|
|
87
|
+
},
|
|
88
|
+
raise(id) {
|
|
89
|
+
const surface = surfaces.get(id);
|
|
90
|
+
if (surface === undefined) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const top = Math.max(
|
|
94
|
+
...[...surfaces.values()]
|
|
95
|
+
.filter((s) => s.layer === surface.layer)
|
|
96
|
+
.map((s) => s.raised)
|
|
97
|
+
);
|
|
98
|
+
if (surface.raised === top) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
counter += 1;
|
|
102
|
+
surface.raised = counter;
|
|
103
|
+
changed();
|
|
104
|
+
},
|
|
105
|
+
zIndexOf: (id) => computeIndexes().get(id) ?? Number.NaN,
|
|
106
|
+
layerOf: (id) => surfaces.get(id)?.layer,
|
|
107
|
+
unregister(id) {
|
|
108
|
+
if (surfaces.delete(id)) {
|
|
109
|
+
changed();
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
subscribe(listener) {
|
|
113
|
+
listeners.add(listener);
|
|
114
|
+
return () => {
|
|
115
|
+
listeners.delete(listener);
|
|
116
|
+
};
|
|
117
|
+
},
|
|
118
|
+
order: () => [...computeIndexes().keys()],
|
|
119
|
+
};
|
|
120
|
+
}
|