tuidroid 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/LICENSE +674 -0
- package/README.md +181 -2
- package/dist/arrange/Mover.svelte +42 -0
- package/dist/arrange/Mover.svelte.d.ts +29 -0
- package/dist/arrange/PutAway.svelte +48 -0
- package/dist/arrange/PutAway.svelte.d.ts +30 -0
- package/dist/arrange/arrangement.svelte.d.ts +27 -0
- package/dist/arrange/arrangement.svelte.js +44 -0
- package/dist/arrange/order.d.ts +7 -0
- package/dist/arrange/order.js +20 -0
- package/dist/calendar/Calendar.svelte +328 -0
- package/dist/calendar/Calendar.svelte.d.ts +28 -0
- package/dist/calendar/MonthPicker.svelte +41 -0
- package/dist/calendar/MonthPicker.svelte.d.ts +10 -0
- package/dist/calendar/YearPicker.svelte +61 -0
- package/dist/calendar/YearPicker.svelte.d.ts +11 -0
- package/dist/calendar/dates.d.ts +23 -0
- package/dist/calendar/dates.js +54 -0
- package/dist/charts/BarChart.svelte +98 -0
- package/dist/charts/BarChart.svelte.d.ts +28 -0
- package/dist/charts/ChartFrame.svelte +133 -0
- package/dist/charts/ChartFrame.svelte.d.ts +21 -0
- package/dist/charts/ColumnChart.svelte +79 -0
- package/dist/charts/ColumnChart.svelte.d.ts +20 -0
- package/dist/charts/HeatGrid.svelte +110 -0
- package/dist/charts/HeatGrid.svelte.d.ts +22 -0
- package/dist/charts/LineChart.svelte +132 -0
- package/dist/charts/LineChart.svelte.d.ts +29 -0
- package/dist/charts/StripChart.svelte +80 -0
- package/dist/charts/StripChart.svelte.d.ts +27 -0
- package/dist/charts/scale.d.ts +17 -0
- package/dist/charts/scale.js +35 -0
- package/dist/controls/AccentStepper.svelte +24 -0
- package/dist/controls/AccentStepper.svelte.d.ts +8 -0
- package/dist/controls/Button.svelte +264 -0
- package/dist/controls/Button.svelte.d.ts +26 -0
- package/dist/controls/Cycle.svelte +27 -0
- package/dist/controls/Cycle.svelte.d.ts +31 -0
- package/dist/controls/NumberStepper.svelte +28 -0
- package/dist/controls/NumberStepper.svelte.d.ts +12 -0
- package/dist/controls/OptionStepper.svelte +42 -0
- package/dist/controls/OptionStepper.svelte.d.ts +34 -0
- package/dist/controls/Segmented.svelte +72 -0
- package/dist/controls/Segmented.svelte.d.ts +35 -0
- package/dist/controls/SettingRow.svelte +59 -0
- package/dist/controls/SettingRow.svelte.d.ts +11 -0
- package/dist/controls/Stepper.svelte +151 -0
- package/dist/controls/Stepper.svelte.d.ts +17 -0
- package/dist/controls/TextInput.svelte +176 -0
- package/dist/controls/TextInput.svelte.d.ts +12 -0
- package/dist/controls/Toggle.svelte +22 -0
- package/dist/controls/Toggle.svelte.d.ts +9 -0
- package/dist/data/BarRows.svelte +75 -0
- package/dist/data/BarRows.svelte.d.ts +15 -0
- package/dist/data/CellBar.svelte +55 -0
- package/dist/data/CellBar.svelte.d.ts +13 -0
- package/dist/data/Delta.svelte +28 -0
- package/dist/data/Delta.svelte.d.ts +11 -0
- package/dist/data/Hatch.svelte +9 -0
- package/dist/data/Hatch.svelte.d.ts +8 -0
- package/dist/data/KeyValues.svelte +56 -0
- package/dist/data/KeyValues.svelte.d.ts +14 -0
- package/dist/data/Legend.svelte +64 -0
- package/dist/data/Legend.svelte.d.ts +15 -0
- package/dist/data/Meter.svelte +46 -0
- package/dist/data/Meter.svelte.d.ts +9 -0
- package/dist/data/StackedBar.svelte +64 -0
- package/dist/data/StackedBar.svelte.d.ts +14 -0
- package/dist/data/Swatch.svelte +56 -0
- package/dist/data/Swatch.svelte.d.ts +11 -0
- package/dist/data/Table.svelte +86 -0
- package/dist/data/Table.svelte.d.ts +16 -0
- package/dist/data/Value.svelte +32 -0
- package/dist/data/Value.svelte.d.ts +12 -0
- package/dist/data/cells.d.ts +27 -0
- package/dist/data/cells.js +41 -0
- package/dist/data/fit.d.ts +10 -0
- package/dist/data/fit.js +35 -0
- package/dist/gestures/drag.d.ts +28 -0
- package/dist/gestures/drag.js +110 -0
- package/dist/gestures/hold.d.ts +7 -0
- package/dist/gestures/hold.js +59 -0
- package/dist/gestures/pick.d.ts +5 -0
- package/dist/gestures/pick.js +60 -0
- package/dist/haptics.d.ts +5 -0
- package/dist/haptics.js +16 -0
- package/dist/icons/Icon.svelte +52 -0
- package/dist/icons/Icon.svelte.d.ts +17 -0
- package/dist/icons/material.d.ts +68 -0
- package/dist/icons/material.js +69 -0
- package/dist/index.d.ts +75 -0
- package/dist/index.js +91 -0
- package/dist/layout/Alert.svelte +46 -0
- package/dist/layout/Alert.svelte.d.ts +12 -0
- package/dist/layout/Block.svelte +166 -0
- package/dist/layout/Block.svelte.d.ts +22 -0
- package/dist/layout/Panes.svelte +41 -0
- package/dist/layout/Panes.svelte.d.ts +9 -0
- package/dist/layout/Rows.svelte +37 -0
- package/dist/layout/Rows.svelte.d.ts +8 -0
- package/dist/layout/Split.svelte +18 -0
- package/dist/layout/Split.svelte.d.ts +4 -0
- package/dist/layout/Stage.svelte +59 -0
- package/dist/layout/Stage.svelte.d.ts +10 -0
- package/dist/layout/Unfold.svelte +25 -0
- package/dist/layout/Unfold.svelte.d.ts +9 -0
- package/dist/lists/ListItem.svelte +75 -0
- package/dist/lists/ListItem.svelte.d.ts +13 -0
- package/dist/lists/SwipeRow.svelte +158 -0
- package/dist/lists/SwipeRow.svelte.d.ts +21 -0
- package/dist/lists/UndoRow.svelte +37 -0
- package/dist/lists/UndoRow.svelte.d.ts +10 -0
- package/dist/motion/FlipCard.svelte +197 -0
- package/dist/motion/FlipCard.svelte.d.ts +34 -0
- package/dist/motion/Hero.svelte +59 -0
- package/dist/motion/Hero.svelte.d.ts +9 -0
- package/dist/motion/ShuffleText.svelte +42 -0
- package/dist/motion/ShuffleText.svelte.d.ts +13 -0
- package/dist/motion/TypeText.svelte +68 -0
- package/dist/motion/TypeText.svelte.d.ts +11 -0
- package/dist/motion/shuffle.d.ts +24 -0
- package/dist/motion/shuffle.js +58 -0
- package/dist/motion/still.d.ts +2 -0
- package/dist/motion/still.js +7 -0
- package/dist/motion/sweep.d.ts +14 -0
- package/dist/motion/sweep.js +59 -0
- package/dist/motion/typing.d.ts +9 -0
- package/dist/motion/typing.js +19 -0
- package/dist/motion/unfold.d.ts +4 -0
- package/dist/motion/unfold.js +13 -0
- package/dist/nav/Hang.svelte +194 -0
- package/dist/nav/Hang.svelte.d.ts +15 -0
- package/dist/nav/Pager.svelte +89 -0
- package/dist/nav/Pager.svelte.d.ts +43 -0
- package/dist/nav/Pane.svelte +93 -0
- package/dist/nav/Pane.svelte.d.ts +15 -0
- package/dist/nav/Shell.svelte +40 -0
- package/dist/nav/Shell.svelte.d.ts +34 -0
- package/dist/nav/TabBar.svelte +139 -0
- package/dist/nav/TabBar.svelte.d.ts +15 -0
- package/dist/styles/base.css +87 -0
- package/dist/styles/tokens.css +253 -0
- package/dist/text/Fields.svelte +28 -0
- package/dist/text/Fields.svelte.d.ts +8 -0
- package/dist/text/fields.d.ts +6 -0
- package/dist/text/fields.js +16 -0
- package/dist/theme/FlavourButton.svelte +55 -0
- package/dist/theme/FlavourButton.svelte.d.ts +13 -0
- package/dist/theme/Theme.svelte +48 -0
- package/dist/theme/Theme.svelte.d.ts +15 -0
- package/dist/theme/palette.d.ts +23 -0
- package/dist/theme/palette.js +55 -0
- package/dist/theme/reveal.d.ts +10 -0
- package/dist/theme/reveal.js +92 -0
- package/dist/theme/theme.d.ts +15 -0
- package/dist/theme/theme.js +21 -0
- package/package.json +72 -4
package/dist/index.js
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
// tuidroid: Svelte components drawn like a terminal. Import tuidroid/tokens.css once
|
|
2
|
+
// (and tuidroid/base.css for the page and plain elements), then the components.
|
|
3
|
+
// Theme
|
|
4
|
+
export * from './theme/palette';
|
|
5
|
+
export * from './theme/theme';
|
|
6
|
+
export { default as Theme } from './theme/Theme.svelte';
|
|
7
|
+
export { revealFlavour, revealFrames } from './theme/reveal';
|
|
8
|
+
export { default as FlavourButton } from './theme/FlavourButton.svelte';
|
|
9
|
+
// Icons
|
|
10
|
+
export { default as Icon } from './icons/Icon.svelte';
|
|
11
|
+
export { material } from './icons/material';
|
|
12
|
+
// Motion
|
|
13
|
+
export { still } from './motion/still';
|
|
14
|
+
export * from './motion/shuffle';
|
|
15
|
+
export { typingDelay, typingPieces } from './motion/typing';
|
|
16
|
+
export { default as ShuffleText } from './motion/ShuffleText.svelte';
|
|
17
|
+
export { default as TypeText } from './motion/TypeText.svelte';
|
|
18
|
+
export { default as Hero } from './motion/Hero.svelte';
|
|
19
|
+
export { unfold } from './motion/unfold';
|
|
20
|
+
export { MARKS, sweepIn, sweepPool } from './motion/sweep';
|
|
21
|
+
export { default as FlipCard } from './motion/FlipCard.svelte';
|
|
22
|
+
// Gestures
|
|
23
|
+
export * from './gestures/drag';
|
|
24
|
+
export * from './gestures/hold';
|
|
25
|
+
export * from './gestures/pick';
|
|
26
|
+
// Layout
|
|
27
|
+
export { default as Block } from './layout/Block.svelte';
|
|
28
|
+
export { default as Split } from './layout/Split.svelte';
|
|
29
|
+
export { default as Panes } from './layout/Panes.svelte';
|
|
30
|
+
export { default as Unfold } from './layout/Unfold.svelte';
|
|
31
|
+
export { default as Stage } from './layout/Stage.svelte';
|
|
32
|
+
export { default as Alert } from './layout/Alert.svelte';
|
|
33
|
+
export { default as Rows } from './layout/Rows.svelte';
|
|
34
|
+
// Calendar
|
|
35
|
+
export * from './calendar/dates';
|
|
36
|
+
export { default as Calendar } from './calendar/Calendar.svelte';
|
|
37
|
+
export { default as MonthPicker } from './calendar/MonthPicker.svelte';
|
|
38
|
+
export { default as YearPicker } from './calendar/YearPicker.svelte';
|
|
39
|
+
// Arranging
|
|
40
|
+
export * from './arrange/order';
|
|
41
|
+
export { Arrangement } from './arrange/arrangement.svelte';
|
|
42
|
+
export { default as Mover } from './arrange/Mover.svelte';
|
|
43
|
+
export { default as PutAway } from './arrange/PutAway.svelte';
|
|
44
|
+
// Lists
|
|
45
|
+
export { default as SwipeRow } from './lists/SwipeRow.svelte';
|
|
46
|
+
export { default as ListItem } from './lists/ListItem.svelte';
|
|
47
|
+
export { default as UndoRow } from './lists/UndoRow.svelte';
|
|
48
|
+
// Navigation
|
|
49
|
+
export { default as TabBar } from './nav/TabBar.svelte';
|
|
50
|
+
export { default as Pager } from './nav/Pager.svelte';
|
|
51
|
+
export { default as Hang } from './nav/Hang.svelte';
|
|
52
|
+
export { default as Pane } from './nav/Pane.svelte';
|
|
53
|
+
export { default as Shell } from './nav/Shell.svelte';
|
|
54
|
+
// Text
|
|
55
|
+
export { default as Fields } from './text/Fields.svelte';
|
|
56
|
+
export * from './text/fields';
|
|
57
|
+
// Controls
|
|
58
|
+
export { default as Button } from './controls/Button.svelte';
|
|
59
|
+
export { default as Toggle } from './controls/Toggle.svelte';
|
|
60
|
+
export { default as Cycle } from './controls/Cycle.svelte';
|
|
61
|
+
export { default as Segmented } from './controls/Segmented.svelte';
|
|
62
|
+
export { default as Stepper } from './controls/Stepper.svelte';
|
|
63
|
+
export { default as NumberStepper } from './controls/NumberStepper.svelte';
|
|
64
|
+
export { default as OptionStepper } from './controls/OptionStepper.svelte';
|
|
65
|
+
export { default as AccentStepper } from './controls/AccentStepper.svelte';
|
|
66
|
+
export { default as TextInput } from './controls/TextInput.svelte';
|
|
67
|
+
export { default as SettingRow } from './controls/SettingRow.svelte';
|
|
68
|
+
// Data
|
|
69
|
+
export { default as Value } from './data/Value.svelte';
|
|
70
|
+
export { default as Delta } from './data/Delta.svelte';
|
|
71
|
+
export { default as Swatch } from './data/Swatch.svelte';
|
|
72
|
+
export { default as Legend } from './data/Legend.svelte';
|
|
73
|
+
export { default as Hatch } from './data/Hatch.svelte';
|
|
74
|
+
export * from './data/cells';
|
|
75
|
+
export { fit } from './data/fit';
|
|
76
|
+
export { default as CellBar } from './data/CellBar.svelte';
|
|
77
|
+
export { default as StackedBar } from './data/StackedBar.svelte';
|
|
78
|
+
export { default as BarRows } from './data/BarRows.svelte';
|
|
79
|
+
export { default as Meter } from './data/Meter.svelte';
|
|
80
|
+
export { default as KeyValues } from './data/KeyValues.svelte';
|
|
81
|
+
export { default as Table } from './data/Table.svelte';
|
|
82
|
+
// Charts
|
|
83
|
+
export * from './charts/scale';
|
|
84
|
+
export { default as ChartFrame } from './charts/ChartFrame.svelte';
|
|
85
|
+
export { default as BarChart } from './charts/BarChart.svelte';
|
|
86
|
+
export { default as LineChart } from './charts/LineChart.svelte';
|
|
87
|
+
export { default as HeatGrid } from './charts/HeatGrid.svelte';
|
|
88
|
+
export { default as StripChart } from './charts/StripChart.svelte';
|
|
89
|
+
export { default as ColumnChart } from './charts/ColumnChart.svelte';
|
|
90
|
+
// Feedback
|
|
91
|
+
export * from './haptics';
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte'
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements'
|
|
4
|
+
import Button from '../controls/Button.svelte'
|
|
5
|
+
import { tone as toneColour, type Tone } from '../theme/palette'
|
|
6
|
+
|
|
7
|
+
// A message that must be seen, pinned above the bottom edge of the screen in a border of
|
|
8
|
+
// its tone (bad, by default), above the system bar. With `onclose`, a ✕ puts it away.
|
|
9
|
+
interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
10
|
+
tone?: Tone
|
|
11
|
+
onclose?: () => void
|
|
12
|
+
closeLabel?: string
|
|
13
|
+
children: Snippet
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
let { tone = 'bad', onclose, closeLabel = 'Dismiss', children, class: className, ...rest }: Props = $props()
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<div role="alert" {...rest} class={['tui-alert', className]} style:--tui-alert-tone={toneColour(tone)}>
|
|
20
|
+
<div class="message">{@render children()}</div>
|
|
21
|
+
{#if onclose}<Button variant="glyph" icon="close" quit aria-label={closeLabel} onclick={onclose} />{/if}
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
<style>
|
|
25
|
+
@layer tuidroid {
|
|
26
|
+
.tui-alert {
|
|
27
|
+
position: fixed;
|
|
28
|
+
inset: auto 0.6em calc(0.6em + env(safe-area-inset-bottom, 0px));
|
|
29
|
+
max-width: calc(var(--tui-column) - 1.2em);
|
|
30
|
+
margin: 0 auto;
|
|
31
|
+
display: flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
gap: 1ch;
|
|
34
|
+
padding: 0.4em 1ch;
|
|
35
|
+
background: var(--tui-bg);
|
|
36
|
+
border: 1px solid var(--tui-alert-tone);
|
|
37
|
+
border-radius: var(--tui-radius);
|
|
38
|
+
color: var(--tui-alert-tone);
|
|
39
|
+
z-index: 10;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.message {
|
|
43
|
+
flex: 1;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
</style>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import { type Tone } from '../theme/palette';
|
|
4
|
+
interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
tone?: Tone;
|
|
6
|
+
onclose?: () => void;
|
|
7
|
+
closeLabel?: string;
|
|
8
|
+
children: Snippet;
|
|
9
|
+
}
|
|
10
|
+
declare const Alert: import("svelte").Component<Props, {}, "">;
|
|
11
|
+
type Alert = ReturnType<typeof Alert>;
|
|
12
|
+
export default Alert;
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte'
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements'
|
|
4
|
+
import Icon, { type IconPath } from '../icons/Icon.svelte'
|
|
5
|
+
import type { IconName } from '../icons/material'
|
|
6
|
+
import ShuffleText from '../motion/ShuffleText.svelte'
|
|
7
|
+
import { tone as toneColour, type Tone } from '../theme/palette'
|
|
8
|
+
|
|
9
|
+
// A ratatui-style block: a rounded 1px border with titles set into its top edge, cut out
|
|
10
|
+
// of the line by the background behind it (--tui-block-cut, the page's by default).
|
|
11
|
+
// The left title follows its `icon`; `heading` replaces it when it needs markup. The
|
|
12
|
+
// right one is `titleRight`, which runs the letter shuffle as it changes with `shuffle`,
|
|
13
|
+
// or `headingRight` (a live value, a span picker, Close). `actions` are buttons set
|
|
14
|
+
// into the bottom edge (Button variant="edge"), spread along it or gathered at one end.
|
|
15
|
+
// A `tone` colours the border and the Values inside. `titleEnd` slides the left title to
|
|
16
|
+
// the right edge, linearly, in step with a FlipCard's scan line.
|
|
17
|
+
interface Props extends HTMLAttributes<HTMLElement> {
|
|
18
|
+
title?: string
|
|
19
|
+
icon?: IconName | IconPath
|
|
20
|
+
level?: 1 | 2 | 3 | 4 | 5 | 6 // the title's heading level
|
|
21
|
+
titleRight?: string | number
|
|
22
|
+
shuffle?: boolean
|
|
23
|
+
heading?: Snippet
|
|
24
|
+
headingRight?: Snippet
|
|
25
|
+
actions?: Snippet
|
|
26
|
+
actionsAlign?: 'between' | 'start' | 'end' | 'center'
|
|
27
|
+
tone?: Tone
|
|
28
|
+
titleEnd?: boolean
|
|
29
|
+
children?: Snippet
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
let {
|
|
33
|
+
title = '',
|
|
34
|
+
icon,
|
|
35
|
+
level = 2,
|
|
36
|
+
titleRight = '',
|
|
37
|
+
shuffle = false,
|
|
38
|
+
heading,
|
|
39
|
+
headingRight,
|
|
40
|
+
actions,
|
|
41
|
+
actionsAlign = 'between',
|
|
42
|
+
tone,
|
|
43
|
+
titleEnd = false,
|
|
44
|
+
children,
|
|
45
|
+
class: className,
|
|
46
|
+
...rest
|
|
47
|
+
}: Props = $props()
|
|
48
|
+
|
|
49
|
+
const id = $props.id()
|
|
50
|
+
const named = $derived(!!(heading || title))
|
|
51
|
+
</script>
|
|
52
|
+
|
|
53
|
+
<section
|
|
54
|
+
aria-labelledby={named ? `${id}-title` : undefined}
|
|
55
|
+
{...rest}
|
|
56
|
+
class={['tui-block', className, { 'with-actions': actions }]}
|
|
57
|
+
style:--tui-block-tone={tone && toneColour(tone)}
|
|
58
|
+
>
|
|
59
|
+
{#if named}
|
|
60
|
+
<svelte:element this={`h${level}`} id="{id}-title" class={['tui-block-title', 'left', { end: titleEnd }]}
|
|
61
|
+
>{#if heading}{@render heading()}{:else}{#if icon}<span class="mark"><Icon {icon} /></span>{/if}{title}{/if}</svelte:element
|
|
62
|
+
>
|
|
63
|
+
{/if}
|
|
64
|
+
{#if headingRight}
|
|
65
|
+
<span class="tui-block-title right">{@render headingRight()}</span>
|
|
66
|
+
{:else if titleRight !== ''}
|
|
67
|
+
<span class="tui-block-title right"
|
|
68
|
+
>{#if shuffle}<ShuffleText text={titleRight} />{:else}{titleRight}{/if}</span
|
|
69
|
+
>
|
|
70
|
+
{/if}
|
|
71
|
+
{@render children?.()}
|
|
72
|
+
{#if actions}<div class="actions {actionsAlign}">{@render actions()}</div>{/if}
|
|
73
|
+
</section>
|
|
74
|
+
|
|
75
|
+
<style>
|
|
76
|
+
@layer tuidroid {
|
|
77
|
+
.tui-block {
|
|
78
|
+
--tui-block-pad-x: 1ch; /* Split reaches out by as much, border to border */
|
|
79
|
+
position: relative;
|
|
80
|
+
min-height: 0;
|
|
81
|
+
display: flex;
|
|
82
|
+
flex-direction: column;
|
|
83
|
+
border: 1px solid var(--tui-block-border, var(--tui-block-tone, var(--tui-border)));
|
|
84
|
+
border-radius: var(--tui-radius);
|
|
85
|
+
padding: 0.7em var(--tui-block-pad-x) 0.4em;
|
|
86
|
+
transition: border-color var(--tui-tone) ease;
|
|
87
|
+
|
|
88
|
+
/* Room above the bottom edge for the buttons set into it. */
|
|
89
|
+
&.with-actions {
|
|
90
|
+
padding-bottom: 1.3em;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.tui-block-title {
|
|
95
|
+
position: absolute;
|
|
96
|
+
top: -0.62em;
|
|
97
|
+
margin: 0;
|
|
98
|
+
padding: 0 0.6ch;
|
|
99
|
+
background: var(--tui-block-cut, var(--tui-bg));
|
|
100
|
+
color: var(--tui-accent);
|
|
101
|
+
font: inherit;
|
|
102
|
+
line-height: 1.2;
|
|
103
|
+
white-space: nowrap;
|
|
104
|
+
|
|
105
|
+
/* An edge button in the top edge (a pane's Close): its tap area reaches above and
|
|
106
|
+
below the line while its words sit on it with the title's. */
|
|
107
|
+
& :global(.tui-button.edge) {
|
|
108
|
+
margin: -0.6em -0.7ch;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.left {
|
|
113
|
+
left: 1ch;
|
|
114
|
+
transition:
|
|
115
|
+
left calc(0.4s * var(--tui-motion)) linear,
|
|
116
|
+
transform calc(0.4s * var(--tui-motion)) linear;
|
|
117
|
+
|
|
118
|
+
&.end {
|
|
119
|
+
left: calc(100% - 1ch);
|
|
120
|
+
transform: translateX(-100%);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.right {
|
|
125
|
+
right: 1ch;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.mark {
|
|
129
|
+
margin-right: 0.6ch;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/* The bottom edge's buttons: a row centred on the border line, each cutting the line
|
|
133
|
+
with the background like a title. */
|
|
134
|
+
.actions {
|
|
135
|
+
position: absolute;
|
|
136
|
+
left: 0.4ch;
|
|
137
|
+
right: 0.4ch;
|
|
138
|
+
bottom: 0;
|
|
139
|
+
transform: translateY(50%);
|
|
140
|
+
display: flex;
|
|
141
|
+
align-items: center;
|
|
142
|
+
gap: 0.4ch;
|
|
143
|
+
pointer-events: none;
|
|
144
|
+
|
|
145
|
+
& > :global(*) {
|
|
146
|
+
pointer-events: auto;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
&.between {
|
|
150
|
+
justify-content: space-between;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
&.start {
|
|
154
|
+
justify-content: flex-start;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
&.end {
|
|
158
|
+
justify-content: flex-end;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
&.center {
|
|
162
|
+
justify-content: center;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
</style>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import { type IconPath } from '../icons/Icon.svelte';
|
|
4
|
+
import type { IconName } from '../icons/material';
|
|
5
|
+
import { type Tone } from '../theme/palette';
|
|
6
|
+
interface Props extends HTMLAttributes<HTMLElement> {
|
|
7
|
+
title?: string;
|
|
8
|
+
icon?: IconName | IconPath;
|
|
9
|
+
level?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
10
|
+
titleRight?: string | number;
|
|
11
|
+
shuffle?: boolean;
|
|
12
|
+
heading?: Snippet;
|
|
13
|
+
headingRight?: Snippet;
|
|
14
|
+
actions?: Snippet;
|
|
15
|
+
actionsAlign?: 'between' | 'start' | 'end' | 'center';
|
|
16
|
+
tone?: Tone;
|
|
17
|
+
titleEnd?: boolean;
|
|
18
|
+
children?: Snippet;
|
|
19
|
+
}
|
|
20
|
+
declare const Block: import("svelte").Component<Props, {}, "">;
|
|
21
|
+
type Block = ReturnType<typeof Block>;
|
|
22
|
+
export default Block;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte'
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements'
|
|
4
|
+
|
|
5
|
+
// A column of Blocks, --tui-gap apart, with room above the first for its title and
|
|
6
|
+
// below the last for its edge buttons. With `scroll` it fills its parent's height and
|
|
7
|
+
// scrolls up and down only, so a sideways drag stays a page swipe. Each block keeps
|
|
8
|
+
// its own height; one that opens from a button goes in an Unfold.
|
|
9
|
+
interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
10
|
+
scroll?: boolean
|
|
11
|
+
children: Snippet
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
let { scroll = false, children, class: className, ...rest }: Props = $props()
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<div {...rest} class={['tui-panes', className, { scroll }]}>{@render children()}</div>
|
|
18
|
+
|
|
19
|
+
<style>
|
|
20
|
+
@layer tuidroid {
|
|
21
|
+
.tui-panes {
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-direction: column;
|
|
24
|
+
gap: var(--tui-gap);
|
|
25
|
+
padding: 0.7em 0 0.8em;
|
|
26
|
+
|
|
27
|
+
& > :global(*) {
|
|
28
|
+
flex: none;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* The scroll reaches up into the room above, so the first title is not cut off. */
|
|
32
|
+
&.scroll {
|
|
33
|
+
height: 100%;
|
|
34
|
+
box-sizing: border-box;
|
|
35
|
+
overflow-y: auto;
|
|
36
|
+
overscroll-behavior: contain;
|
|
37
|
+
touch-action: pan-y;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
</style>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
scroll?: boolean;
|
|
5
|
+
children: Snippet;
|
|
6
|
+
}
|
|
7
|
+
declare const Panes: import("svelte").Component<Props, {}, "">;
|
|
8
|
+
type Panes = ReturnType<typeof Panes>;
|
|
9
|
+
export default Panes;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte'
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements'
|
|
4
|
+
|
|
5
|
+
// Settings in rows whose parts line up down the column, whatever their labels' lengths:
|
|
6
|
+
// each row (SettingRow, Stepper) takes the grid's columns as its own (subgrid), the
|
|
7
|
+
// labels at the left, the values after them, the controls at the right. A hint under a
|
|
8
|
+
// row spans the width. On its own, outside Rows, a row is a plain line.
|
|
9
|
+
interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
10
|
+
children: Snippet
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
let { children, class: className, ...rest }: Props = $props()
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<div {...rest} class={['tui-rows', className]}>{@render children()}</div>
|
|
17
|
+
|
|
18
|
+
<style>
|
|
19
|
+
@layer tuidroid {
|
|
20
|
+
.tui-rows {
|
|
21
|
+
display: grid;
|
|
22
|
+
grid-template-columns: [label] max-content [value] minmax(0, 1fr) [controls] auto;
|
|
23
|
+
column-gap: 1ch;
|
|
24
|
+
align-items: center;
|
|
25
|
+
|
|
26
|
+
& > :global(.tui-row) {
|
|
27
|
+
display: grid;
|
|
28
|
+
grid-column: 1 / -1;
|
|
29
|
+
grid-template-columns: subgrid;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
& > :global(:not(.tui-row)) {
|
|
33
|
+
grid-column: 1 / -1;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
</style>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
children: Snippet;
|
|
5
|
+
}
|
|
6
|
+
declare const Rows: import("svelte").Component<Props, {}, "">;
|
|
7
|
+
type Rows = ReturnType<typeof Rows>;
|
|
8
|
+
export default Rows;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements'
|
|
3
|
+
|
|
4
|
+
// A rule across a Block, border to border, like a ratatui split.
|
|
5
|
+
let { class: className, ...rest }: HTMLAttributes<HTMLHRElement> = $props()
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<hr {...rest} class={['tui-split', className]} />
|
|
9
|
+
|
|
10
|
+
<style>
|
|
11
|
+
@layer tuidroid {
|
|
12
|
+
.tui-split {
|
|
13
|
+
border: 0;
|
|
14
|
+
border-top: 1px solid var(--tui-block-border, var(--tui-block-tone, var(--tui-border)));
|
|
15
|
+
margin: 0.4em calc(-1 * var(--tui-block-pad-x, 0px));
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
</style>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte'
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements'
|
|
4
|
+
|
|
5
|
+
// A screen's face, in three rows, the outer two always equal, so what sits in the middle
|
|
6
|
+
// (a Hero, a word) stays put whatever opens `below` it. `fill` spans all three instead,
|
|
7
|
+
// centred: a gate, an ending. Past its height it scrolls, up and down only.
|
|
8
|
+
interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
9
|
+
fill?: boolean
|
|
10
|
+
below?: Snippet
|
|
11
|
+
children: Snippet
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
let { fill = false, below, children, class: className, ...rest }: Props = $props()
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<div {...rest} class={['tui-stage', className]}>
|
|
18
|
+
<div class={fill ? 'fill' : 'center'}>{@render children()}</div>
|
|
19
|
+
{#if below && !fill}<div class="below">{@render below()}</div>{/if}
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
<style>
|
|
23
|
+
@layer tuidroid {
|
|
24
|
+
.tui-stage {
|
|
25
|
+
flex: 1;
|
|
26
|
+
min-height: 0;
|
|
27
|
+
overflow-y: auto;
|
|
28
|
+
touch-action: pan-y;
|
|
29
|
+
container-type: inline-size;
|
|
30
|
+
display: grid;
|
|
31
|
+
grid-template-rows: minmax(0, 1fr) auto minmax(0, 1fr);
|
|
32
|
+
grid-template-columns: minmax(0, 1fr);
|
|
33
|
+
text-align: center;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.center {
|
|
37
|
+
grid-row: 2;
|
|
38
|
+
display: flex;
|
|
39
|
+
flex-direction: column;
|
|
40
|
+
align-items: center;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.below {
|
|
44
|
+
grid-row: 3;
|
|
45
|
+
align-self: start;
|
|
46
|
+
display: flex;
|
|
47
|
+
flex-direction: column;
|
|
48
|
+
gap: 0.15em;
|
|
49
|
+
padding-top: 0.6em;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.fill {
|
|
53
|
+
grid-row: 1 / -1;
|
|
54
|
+
align-self: stretch;
|
|
55
|
+
display: grid;
|
|
56
|
+
place-items: center;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
</style>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
fill?: boolean;
|
|
5
|
+
below?: Snippet;
|
|
6
|
+
children: Snippet;
|
|
7
|
+
}
|
|
8
|
+
declare const Stage: import("svelte").Component<Props, {}, "">;
|
|
9
|
+
type Stage = ReturnType<typeof Stage>;
|
|
10
|
+
export default Stage;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte'
|
|
3
|
+
import { unfold } from '../motion/unfold'
|
|
4
|
+
|
|
5
|
+
// What opens below the block it belongs to in a column (Panes): it unfolds from nothing,
|
|
6
|
+
// pushing the blocks under it down, and folds back up when `open` goes false. The
|
|
7
|
+
// column's gap above it is inside it, so it grows from the block above's edge.
|
|
8
|
+
let { open, duration = 240, children }: { open: boolean; duration?: number; children: Snippet } = $props()
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
{#if open}<div class="tui-unfold" transition:unfold={{ duration }}>{@render children()}</div>{/if}
|
|
12
|
+
|
|
13
|
+
<style>
|
|
14
|
+
@layer tuidroid {
|
|
15
|
+
.tui-unfold {
|
|
16
|
+
margin-top: calc(-1 * var(--tui-gap));
|
|
17
|
+
|
|
18
|
+
&::before {
|
|
19
|
+
content: '';
|
|
20
|
+
display: block;
|
|
21
|
+
height: var(--tui-gap);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
</style>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
open: boolean;
|
|
4
|
+
duration?: number;
|
|
5
|
+
children: Snippet;
|
|
6
|
+
};
|
|
7
|
+
declare const Unfold: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
8
|
+
type Unfold = ReturnType<typeof Unfold>;
|
|
9
|
+
export default Unfold;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte'
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements'
|
|
4
|
+
|
|
5
|
+
// An entry in a list (a fast, a word): its title on a line of its own with `actions` at
|
|
6
|
+
// its end (✎ ✕ glyph buttons), and the rest under it. `mark` draws a bar of colour down
|
|
7
|
+
// its start edge (its deepest stage). Put it in a SwipeRow to swipe it.
|
|
8
|
+
interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
9
|
+
title?: string
|
|
10
|
+
heading?: Snippet // in place of `title`, when it needs markup
|
|
11
|
+
level?: 2 | 3 | 4 | 5 | 6
|
|
12
|
+
mark?: string
|
|
13
|
+
actions?: Snippet
|
|
14
|
+
children?: Snippet
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
let { title = '', heading, level = 3, mark, actions, children, class: className, ...rest }: Props = $props()
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<div {...rest} class={['tui-list-item', className, { marked: mark }]} style:--mark={mark}>
|
|
21
|
+
<div class="title">
|
|
22
|
+
<svelte:element this={`h${level}`} class="name"
|
|
23
|
+
>{#if heading}{@render heading()}{:else}{title}{/if}</svelte:element
|
|
24
|
+
>
|
|
25
|
+
{#if actions}<span class="actions">{@render actions()}</span>{/if}
|
|
26
|
+
</div>
|
|
27
|
+
{@render children?.()}
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
<style>
|
|
31
|
+
@layer tuidroid {
|
|
32
|
+
.tui-list-item {
|
|
33
|
+
position: relative;
|
|
34
|
+
padding: 0.5em 1ch 0.3em;
|
|
35
|
+
|
|
36
|
+
&.marked {
|
|
37
|
+
padding-left: 1.6ch;
|
|
38
|
+
|
|
39
|
+
&::before {
|
|
40
|
+
content: '';
|
|
41
|
+
position: absolute;
|
|
42
|
+
left: 0.3ch;
|
|
43
|
+
top: 0.5em;
|
|
44
|
+
bottom: 0.4em;
|
|
45
|
+
width: 0.35ch;
|
|
46
|
+
border-radius: 1px;
|
|
47
|
+
background: var(--mark);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
& :global(p) {
|
|
52
|
+
margin: 0;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.title {
|
|
57
|
+
display: flex;
|
|
58
|
+
align-items: center;
|
|
59
|
+
gap: 1ch;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.name {
|
|
63
|
+
flex: 1;
|
|
64
|
+
min-width: 0;
|
|
65
|
+
margin: 0;
|
|
66
|
+
font: inherit;
|
|
67
|
+
color: var(--tui-accent);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.actions {
|
|
71
|
+
display: inline-flex;
|
|
72
|
+
margin: -0.35em -0.6ch -0.35em 0;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
</style>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
title?: string;
|
|
5
|
+
heading?: Snippet;
|
|
6
|
+
level?: 2 | 3 | 4 | 5 | 6;
|
|
7
|
+
mark?: string;
|
|
8
|
+
actions?: Snippet;
|
|
9
|
+
children?: Snippet;
|
|
10
|
+
}
|
|
11
|
+
declare const ListItem: import("svelte").Component<Props, {}, "">;
|
|
12
|
+
type ListItem = ReturnType<typeof ListItem>;
|
|
13
|
+
export default ListItem;
|