@c9up/nebula 0.2.4 → 0.2.6
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/README.md +4 -4
- package/dist/atoms/AspectRatio.d.ts +10 -4
- package/dist/atoms/AspectRatio.js +21 -6
- package/dist/atoms/NativeSelect.d.ts +16 -0
- package/dist/atoms/NativeSelect.js +4 -1
- package/dist/atoms/Progress.d.ts +9 -1
- package/dist/atoms/Progress.js +21 -5
- package/dist/atoms/Switch.d.ts +7 -1
- package/dist/atoms/Switch.js +7 -1
- package/dist/cli/diff.d.ts +46 -0
- package/dist/cli/diff.js +73 -2
- package/dist/console/DiffCommand.js +6 -11
- package/dist/molecules/Accordion.js +1 -2
- package/dist/molecules/Collapsible.js +1 -2
- package/dist/molecules/Resizable.d.ts +6 -0
- package/dist/molecules/Resizable.js +8 -2
- package/dist/organisms/Agenda.d.ts +200 -0
- package/dist/organisms/Agenda.js +762 -0
- package/dist/organisms/AlertDialog.js +4 -5
- package/dist/organisms/Chart.d.ts +103 -15
- package/dist/organisms/Chart.js +518 -99
- package/dist/organisms/Dialog.js +7 -7
- package/dist/organisms/Sidebar.d.ts +5 -7
- package/dist/organisms/Sidebar.js +23 -6
- package/dist/organisms/Sonner.js +11 -4
- package/dist/organisms/index.d.ts +2 -1
- package/dist/organisms/index.js +2 -1
- package/dist/primitives/floatingSurface.js +60 -36
- package/dist/primitives/menuParts.js +3 -3
- package/dist/primitives/portal.d.ts +15 -0
- package/dist/primitives/portal.js +18 -1
- package/nebula.css +1 -1
- package/package.json +1 -1
- package/registry.json +13 -0
- package/src/atoms/AspectRatio.ts +21 -6
- package/src/atoms/NativeSelect.ts +20 -1
- package/src/atoms/Progress.ts +21 -5
- package/src/atoms/Switch.ts +7 -1
- package/src/cli/diff.ts +123 -2
- package/src/console/DiffCommand.ts +12 -15
- package/src/molecules/Accordion.ts +1 -2
- package/src/molecules/Collapsible.ts +1 -3
- package/src/molecules/Resizable.ts +8 -2
- package/src/organisms/Agenda.ts +1061 -0
- package/src/organisms/AlertDialog.ts +3 -5
- package/src/organisms/Chart.ts +633 -125
- package/src/organisms/Dialog.ts +6 -7
- package/src/organisms/Sidebar.ts +28 -6
- package/src/organisms/Sonner.ts +11 -4
- package/src/organisms/index.ts +26 -0
- package/src/primitives/floatingSurface.ts +74 -40
- package/src/primitives/menuParts.ts +3 -3
- package/src/primitives/portal.ts +27 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> shadcn/ui, ported to Aurora, organised as atomic design. Zero runtime dependencies, copy-the-source registry, swappable CSS engine.
|
|
4
4
|
|
|
5
|
-
Part of **[Ream](https://github.com/C9up/ream)** — a Rust-powered
|
|
5
|
+
Part of **[Ream](https://github.com/C9up/ream)** — a Rust-powered Node.js framework. Independent, publishable package.
|
|
6
6
|
|
|
7
7
|
## What this is
|
|
8
8
|
|
|
@@ -125,7 +125,7 @@ physical, because that is what the caller means.
|
|
|
125
125
|
|
|
126
126
|
## Choose your CSS engine
|
|
127
127
|
|
|
128
|
-
nebula declares **no CSS engine dependency at all**. You install the engine you want; `config/nebula.ts` names it; nebula generates the matching stubs and build command.
|
|
128
|
+
nebula declares **no CSS engine dependency at all**. You install the engine you want; `config/nebula.ts` names it; nebula generates the matching stubs and build command. The engine stays the application's own dependency: nebula ships the stubs for it, never the engine.
|
|
129
129
|
|
|
130
130
|
### The one thing you must install: `tw-animate-css`
|
|
131
131
|
|
|
@@ -195,13 +195,13 @@ resources/pages/
|
|
|
195
195
|
The rule is composition, not complexity. Slider is an atom though it is interactive, because it is one input. Card is a molecule though it is trivial, because it assembles parts.
|
|
196
196
|
|
|
197
197
|
<details>
|
|
198
|
-
<summary><strong>All
|
|
198
|
+
<summary><strong>All 77 components</strong></summary>
|
|
199
199
|
|
|
200
200
|
**atoms (22)** — AccessibleIcon, AspectRatio, Avatar, Badge, Button, Checkbox, Image, Input, Kbd, Label, Marker, NativeSelect, Progress, ScrollArea, Separator, Skeleton, Slider, Spinner, Switch, Textarea, Toggle, VisuallyHidden
|
|
201
201
|
|
|
202
202
|
**molecules (24)** — Accordion, Alert, Attachment, Breadcrumb, Bubble, ButtonGroup, Card, Collapsible, Empty, Field, InputGroup, InputOTP, Item, Message, Pagination, Picture, PieceMap, RadioGroup, Resizable, Table, Tabs, ToggleGroup, Toolbar, Typography
|
|
203
203
|
|
|
204
|
-
**organisms (
|
|
204
|
+
**organisms (28)** — Agenda, AlertDialog, Calendar, Carousel, Chart, Combobox, Command, CommandDialog, ContextMenu, DataTable, DatePicker, DateRangePicker, Dialog, Drawer, DropdownMenu, Form, HoverCard, Menubar, MessageScroller, NavigationMenu, Popover, Questionnaire, Select, Sheet, Sidebar, Sonner, Toaster, Tooltip
|
|
205
205
|
|
|
206
206
|
**templates (3)** — AppShell, AuthLayout, SettingsLayout
|
|
207
207
|
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* AspectRatio — hold a box at a fixed width-to-height ratio.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* The ratio is arbitrary, so it cannot be a utility class, and it cannot be a
|
|
5
|
+
* `style` attribute either: a Content-Security-Policy without `'unsafe-inline'`
|
|
6
|
+
* blocks those. A `.style` property passes the policy, but the server does not
|
|
7
|
+
* write properties, and the box would collapse until hydration.
|
|
8
|
+
*
|
|
9
|
+
* So the box takes its height from an empty SVG whose `viewBox` carries the
|
|
10
|
+
* ratio: an `<svg>` at full width and automatic height is as tall as its
|
|
11
|
+
* viewBox says, and a `viewBox` is an attribute the policy does not touch. The
|
|
12
|
+
* content sits over it, absolutely positioned — Radix's own structure, with the
|
|
13
|
+
* SVG in place of its padding trick.
|
|
8
14
|
*/
|
|
9
15
|
import { type Slot } from "../lib/children.js";
|
|
10
16
|
import { type Reactive } from "../lib/props.js";
|
|
@@ -1,19 +1,34 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* AspectRatio — hold a box at a fixed width-to-height ratio.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* The ratio is arbitrary, so it cannot be a utility class, and it cannot be a
|
|
5
|
+
* `style` attribute either: a Content-Security-Policy without `'unsafe-inline'`
|
|
6
|
+
* blocks those. A `.style` property passes the policy, but the server does not
|
|
7
|
+
* write properties, and the box would collapse until hydration.
|
|
8
|
+
*
|
|
9
|
+
* So the box takes its height from an empty SVG whose `viewBox` carries the
|
|
10
|
+
* ratio: an `<svg>` at full width and automatic height is as tall as its
|
|
11
|
+
* viewBox says, and a `viewBox` is an attribute the policy does not touch. The
|
|
12
|
+
* content sits over it, absolutely positioned — Radix's own structure, with the
|
|
13
|
+
* SVG in place of its padding trick.
|
|
8
14
|
*/
|
|
9
15
|
import { component, html } from "@c9up/aurora";
|
|
10
16
|
import { slot } from "../lib/children.js";
|
|
11
17
|
import { cn } from "../lib/cn.js";
|
|
12
18
|
import { read, readOr } from "../lib/props.js";
|
|
13
19
|
export const AspectRatio = component((props) => {
|
|
20
|
+
/** A ratio that is not a positive finite number would make no box at all. */
|
|
21
|
+
const ratio = () => {
|
|
22
|
+
const given = readOr(props.ratio, 1);
|
|
23
|
+
return Number.isFinite(given) && given > 0 ? given : 1;
|
|
24
|
+
};
|
|
14
25
|
return html `<div
|
|
15
26
|
data-slot="aspect-ratio"
|
|
16
|
-
style="${() => `aspect-ratio: ${readOr(props.ratio, 1)}`}"
|
|
17
27
|
class="${() => cn("relative w-full", read(props.class))}"
|
|
18
|
-
|
|
28
|
+
><svg
|
|
29
|
+
aria-hidden="true"
|
|
30
|
+
focusable="false"
|
|
31
|
+
viewBox="${() => `0 0 ${ratio()} 1`}"
|
|
32
|
+
class="block h-auto w-full"
|
|
33
|
+
></svg><div class="absolute inset-0">${slot(props.children)}</div></div>`;
|
|
19
34
|
});
|
|
@@ -37,7 +37,23 @@ export interface NativeSelectProps {
|
|
|
37
37
|
required?: Reactive<boolean>;
|
|
38
38
|
invalid?: Reactive<boolean>;
|
|
39
39
|
describedBy?: Reactive<string | undefined>;
|
|
40
|
+
/** Styles the `<select>` itself. To change the control's width, use `wrapperClass`. */
|
|
40
41
|
class?: Reactive<string>;
|
|
42
|
+
/**
|
|
43
|
+
* Sizes the control: the wrapper the chevron is positioned against.
|
|
44
|
+
*
|
|
45
|
+
* A width through `class` narrows the `<select>` and leaves the chevron at
|
|
46
|
+
* the end of a full-width wrapper, with empty space between the control and
|
|
47
|
+
* its own indicator. Merged over the wrapper's `w-full`, so `w-40` here
|
|
48
|
+
* replaces it rather than competing with it.
|
|
49
|
+
*
|
|
50
|
+
* Named deviation from shadcn, whose wrapper is `w-fit` and takes no
|
|
51
|
+
* class: there `className` sizes the control, but the control can never
|
|
52
|
+
* fill a form row, since a `w-full` select inside a `w-fit` box is only as
|
|
53
|
+
* wide as its longest option. nebula keeps the full-width default forms
|
|
54
|
+
* need and gives the width its own prop.
|
|
55
|
+
*/
|
|
56
|
+
wrapperClass?: Reactive<string>;
|
|
41
57
|
onValueChange?: (value: string, event: Event) => void;
|
|
42
58
|
}
|
|
43
59
|
export declare const NativeSelect: (props?: NativeSelectProps | undefined) => import("@c9up/aurora").TemplateResult;
|
|
@@ -65,7 +65,10 @@ export const NativeSelect = component((props) => {
|
|
|
65
65
|
>
|
|
66
66
|
${option.label}
|
|
67
67
|
</option>`;
|
|
68
|
-
return html `<div
|
|
68
|
+
return html `<div
|
|
69
|
+
data-slot="native-select"
|
|
70
|
+
class="${() => cn("relative inline-flex w-full items-center", read(props.wrapperClass))}"
|
|
71
|
+
>
|
|
69
72
|
<select
|
|
70
73
|
id="${props.id}"
|
|
71
74
|
name="${props.name}"
|
package/dist/atoms/Progress.d.ts
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Progress — a determinate progress bar.
|
|
3
3
|
*
|
|
4
|
-
* The fill is a full-width
|
|
4
|
+
* The fill is a full-width shape translated left by the remaining percentage,
|
|
5
5
|
* rather than a width animation. Transforms are composited off the main
|
|
6
6
|
* thread; animating `width` relayouts the bar on every frame, which is visible
|
|
7
7
|
* on a long upload.
|
|
8
8
|
*
|
|
9
|
+
* The shape is an SVG `<rect>` moved by its `transform` ATTRIBUTE, not a `<div>`
|
|
10
|
+
* moved by a `style` attribute. A Content-Security-Policy without
|
|
11
|
+
* `'unsafe-inline'` blocks every `style` attribute; an SVG presentation
|
|
12
|
+
* attribute is not a style attribute and passes. A `.style` property would pass
|
|
13
|
+
* too, but the server does not write properties, so the bar would read full
|
|
14
|
+
* until hydration — the attribute is in the server's markup, right from the
|
|
15
|
+
* first paint.
|
|
16
|
+
*
|
|
9
17
|
* A `value` of `null` means indeterminate, and drops `aria-valuenow` — the
|
|
10
18
|
* ARIA spec is explicit that an absent value is how "unknown progress" is
|
|
11
19
|
* expressed, and reporting `0` instead tells the user it has not started.
|
package/dist/atoms/Progress.js
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Progress — a determinate progress bar.
|
|
3
3
|
*
|
|
4
|
-
* The fill is a full-width
|
|
4
|
+
* The fill is a full-width shape translated left by the remaining percentage,
|
|
5
5
|
* rather than a width animation. Transforms are composited off the main
|
|
6
6
|
* thread; animating `width` relayouts the bar on every frame, which is visible
|
|
7
7
|
* on a long upload.
|
|
8
8
|
*
|
|
9
|
+
* The shape is an SVG `<rect>` moved by its `transform` ATTRIBUTE, not a `<div>`
|
|
10
|
+
* moved by a `style` attribute. A Content-Security-Policy without
|
|
11
|
+
* `'unsafe-inline'` blocks every `style` attribute; an SVG presentation
|
|
12
|
+
* attribute is not a style attribute and passes. A `.style` property would pass
|
|
13
|
+
* too, but the server does not write properties, so the bar would read full
|
|
14
|
+
* until hydration — the attribute is in the server's markup, right from the
|
|
15
|
+
* first paint.
|
|
16
|
+
*
|
|
9
17
|
* A `value` of `null` means indeterminate, and drops `aria-valuenow` — the
|
|
10
18
|
* ARIA spec is explicit that an absent value is how "unknown progress" is
|
|
11
19
|
* expressed, and reporting `0` instead tells the user it has not started.
|
|
@@ -39,10 +47,18 @@ export const Progress = component((props) => {
|
|
|
39
47
|
aria-label="${() => read(props.label)}"
|
|
40
48
|
class="${() => cn("bg-primary/20 relative h-2 w-full overflow-hidden rounded-full", read(props.class))}"
|
|
41
49
|
>
|
|
42
|
-
|
|
50
|
+
<svg
|
|
43
51
|
data-slot="progress-indicator"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
52
|
+
aria-hidden="true"
|
|
53
|
+
focusable="false"
|
|
54
|
+
viewBox="0 0 100 1"
|
|
55
|
+
preserveAspectRatio="none"
|
|
56
|
+
class="fill-primary block h-full w-full"
|
|
57
|
+
><rect
|
|
58
|
+
width="100"
|
|
59
|
+
height="1"
|
|
60
|
+
transform="${() => `translate(${percent() - 100} 0)`}"
|
|
61
|
+
class="transition-transform"
|
|
62
|
+
/></svg>
|
|
47
63
|
</div>`;
|
|
48
64
|
});
|
package/dist/atoms/Switch.d.ts
CHANGED
|
@@ -11,7 +11,13 @@
|
|
|
11
11
|
* retune the size without leaving the class string.
|
|
12
12
|
*/
|
|
13
13
|
import { type Reactive } from "../lib/props.js";
|
|
14
|
-
|
|
14
|
+
/**
|
|
15
|
+
* The off fill names the unchecked state, as upstream's `data-[state=unchecked]:`
|
|
16
|
+
* does. Left bare, `dark:bg-input/80` weighed as much as `checked:bg-primary`
|
|
17
|
+
* and came later in the stylesheet, so a switch that was on looked off in the
|
|
18
|
+
* dark theme.
|
|
19
|
+
*/
|
|
20
|
+
export declare const switchTrackClasses = "peer absolute inset-0 size-full appearance-none rounded-full border border-transparent shadow-xs outline-none transition-colors checked:bg-primary not-checked:bg-input dark:not-checked:bg-input/80 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50";
|
|
15
21
|
export interface SwitchProps {
|
|
16
22
|
id?: string;
|
|
17
23
|
name?: string;
|
package/dist/atoms/Switch.js
CHANGED
|
@@ -13,7 +13,13 @@
|
|
|
13
13
|
import { component, html } from "@c9up/aurora";
|
|
14
14
|
import { cn } from "../lib/cn.js";
|
|
15
15
|
import { accessor, read } from "../lib/props.js";
|
|
16
|
-
|
|
16
|
+
/**
|
|
17
|
+
* The off fill names the unchecked state, as upstream's `data-[state=unchecked]:`
|
|
18
|
+
* does. Left bare, `dark:bg-input/80` weighed as much as `checked:bg-primary`
|
|
19
|
+
* and came later in the stylesheet, so a switch that was on looked off in the
|
|
20
|
+
* dark theme.
|
|
21
|
+
*/
|
|
22
|
+
export const switchTrackClasses = "peer absolute inset-0 size-full appearance-none rounded-full border border-transparent shadow-xs outline-none transition-colors checked:bg-primary not-checked:bg-input dark:not-checked:bg-input/80 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50";
|
|
17
23
|
function inputChecked(event) {
|
|
18
24
|
const target = event.target;
|
|
19
25
|
return target instanceof HTMLInputElement ? target.checked : false;
|
package/dist/cli/diff.d.ts
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* you made from one you have not seen yet.
|
|
14
14
|
*/
|
|
15
15
|
import { type Language, type NebulaPaths } from "../config.js";
|
|
16
|
+
import { type Registry, type RegistryItem } from "./registry.js";
|
|
16
17
|
export type DiffState =
|
|
17
18
|
/** Copy, record and package all agree. */
|
|
18
19
|
"same"
|
|
@@ -36,9 +37,31 @@ export interface DiffOptions {
|
|
|
36
37
|
/** The configured language: used when the tree says nothing. */
|
|
37
38
|
defaultLanguage?: Language;
|
|
38
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* How to bring the outdated files up to date with `nebula:add --force`.
|
|
42
|
+
*
|
|
43
|
+
* `nebula:add` takes registry names, never file paths: a shared file such as
|
|
44
|
+
* `lib/icons.ts` or `primitives/menu.ts` has no name of its own and travels
|
|
45
|
+
* with the components that use it. So the outdated files are mapped back to
|
|
46
|
+
* the installed components whose copy would bring them along.
|
|
47
|
+
*/
|
|
48
|
+
export interface UpdatePlan {
|
|
49
|
+
/**
|
|
50
|
+
* Registry names to pass to `nebula:add --force`, sorted. Each one re-copies
|
|
51
|
+
* only files that are outdated or untouched — never one you edited, and
|
|
52
|
+
* never one whose history is unknown.
|
|
53
|
+
*/
|
|
54
|
+
components: string[];
|
|
55
|
+
/**
|
|
56
|
+
* Outdated files none of those names can reach without overwriting a file
|
|
57
|
+
* you changed, or that no installed component carries any more.
|
|
58
|
+
*/
|
|
59
|
+
uncovered: string[];
|
|
60
|
+
}
|
|
39
61
|
export interface DiffResult {
|
|
40
62
|
entries: DiffEntry[];
|
|
41
63
|
language: Language;
|
|
64
|
+
update: UpdatePlan;
|
|
42
65
|
}
|
|
43
66
|
/**
|
|
44
67
|
* Compare every copied component against the installed package.
|
|
@@ -47,3 +70,26 @@ export interface DiffResult {
|
|
|
47
70
|
* lists everything nebula ships, and a component nobody copied is not news.
|
|
48
71
|
*/
|
|
49
72
|
export declare function diff(options: DiffOptions): DiffResult;
|
|
73
|
+
export interface PlanOptions {
|
|
74
|
+
/**
|
|
75
|
+
* Whether the project has this component. Its own file — the registry
|
|
76
|
+
* names an item after it — being in the tree is what says so.
|
|
77
|
+
*/
|
|
78
|
+
installed: (item: RegistryItem) => boolean;
|
|
79
|
+
/** A registry path (`.ts`) as it is spelled in the copied tree. */
|
|
80
|
+
toCopy: (file: string) => string;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Pick the registry names that update the outdated files, losing nothing.
|
|
84
|
+
*
|
|
85
|
+
* A component qualifies when it is installed and everything `nebula:add
|
|
86
|
+
* --force` would rewrite for it — its files and those of every component it
|
|
87
|
+
* pulls in — is outdated or untouched. One edited, conflicting or unknown file
|
|
88
|
+
* in that set rules it out: the suggestion is printed as safe to run as is.
|
|
89
|
+
*
|
|
90
|
+
* Among those, a greedy cover keeps the command short: the component reaching
|
|
91
|
+
* the most outdated files still left goes first, ties broken by name. A shared
|
|
92
|
+
* file then rides along with a component that needed re-copying anyway, rather
|
|
93
|
+
* than every component that happens to import it being listed.
|
|
94
|
+
*/
|
|
95
|
+
export declare function planUpdate(registry: Registry, entries: readonly DiffEntry[], options: PlanOptions): UpdatePlan;
|
package/dist/cli/diff.js
CHANGED
|
@@ -17,7 +17,7 @@ import { join } from "node:path";
|
|
|
17
17
|
import { defaultPaths } from "../config.js";
|
|
18
18
|
import { detectLanguage } from "./add.js";
|
|
19
19
|
import { hashOf, readManifest } from "./manifest.js";
|
|
20
|
-
import { loadRegistry, packageRoot } from "./registry.js";
|
|
20
|
+
import { loadRegistry, packageRoot, resolveItems, } from "./registry.js";
|
|
21
21
|
/**
|
|
22
22
|
* Compare every copied component against the installed package.
|
|
23
23
|
*
|
|
@@ -57,7 +57,78 @@ export function diff(options) {
|
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
entries.sort((a, b) => a.file.localeCompare(b.file));
|
|
60
|
-
|
|
60
|
+
const toCopy = (file) => language === "ts" ? file : file.replace(/\.ts$/, ".js");
|
|
61
|
+
const update = planUpdate(registry, entries, {
|
|
62
|
+
installed: (item) => existsSync(join(target, toCopy(`${item.layer}/${item.title}.ts`))),
|
|
63
|
+
toCopy,
|
|
64
|
+
});
|
|
65
|
+
return { entries, language, update };
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Pick the registry names that update the outdated files, losing nothing.
|
|
69
|
+
*
|
|
70
|
+
* A component qualifies when it is installed and everything `nebula:add
|
|
71
|
+
* --force` would rewrite for it — its files and those of every component it
|
|
72
|
+
* pulls in — is outdated or untouched. One edited, conflicting or unknown file
|
|
73
|
+
* in that set rules it out: the suggestion is printed as safe to run as is.
|
|
74
|
+
*
|
|
75
|
+
* Among those, a greedy cover keeps the command short: the component reaching
|
|
76
|
+
* the most outdated files still left goes first, ties broken by name. A shared
|
|
77
|
+
* file then rides along with a component that needed re-copying anyway, rather
|
|
78
|
+
* than every component that happens to import it being listed.
|
|
79
|
+
*/
|
|
80
|
+
export function planUpdate(registry, entries, options) {
|
|
81
|
+
const states = new Map(entries.map((entry) => [entry.file, entry.state]));
|
|
82
|
+
const outdated = new Set(entries
|
|
83
|
+
.filter((entry) => entry.state === "outdated")
|
|
84
|
+
.map((entry) => entry.file));
|
|
85
|
+
const candidates = [];
|
|
86
|
+
for (const item of registry.items) {
|
|
87
|
+
if (!options.installed(item))
|
|
88
|
+
continue;
|
|
89
|
+
const rewritten = new Set(resolveItems(registry, [item.name]).flatMap((entry) => entry.files.map(options.toCopy)));
|
|
90
|
+
const lossy = [...rewritten].some((file) => {
|
|
91
|
+
const state = states.get(file);
|
|
92
|
+
return state !== undefined && state !== "outdated";
|
|
93
|
+
});
|
|
94
|
+
if (lossy)
|
|
95
|
+
continue;
|
|
96
|
+
const reaches = new Set([...rewritten].filter((file) => outdated.has(file)));
|
|
97
|
+
if (reaches.size > 0)
|
|
98
|
+
candidates.push({ name: item.name, reaches });
|
|
99
|
+
}
|
|
100
|
+
const left = new Set(outdated);
|
|
101
|
+
const components = [];
|
|
102
|
+
while (left.size > 0) {
|
|
103
|
+
let best;
|
|
104
|
+
for (const candidate of candidates) {
|
|
105
|
+
let count = 0;
|
|
106
|
+
for (const file of candidate.reaches)
|
|
107
|
+
if (left.has(file))
|
|
108
|
+
count += 1;
|
|
109
|
+
if (count === 0)
|
|
110
|
+
continue;
|
|
111
|
+
if (best === undefined ||
|
|
112
|
+
count > best.count ||
|
|
113
|
+
(count === best.count && candidate.name < best.name)) {
|
|
114
|
+
best = { name: candidate.name, count };
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
if (best === undefined)
|
|
118
|
+
break;
|
|
119
|
+
const chosen = best.name;
|
|
120
|
+
components.push(chosen);
|
|
121
|
+
for (const candidate of candidates) {
|
|
122
|
+
if (candidate.name !== chosen)
|
|
123
|
+
continue;
|
|
124
|
+
for (const file of candidate.reaches)
|
|
125
|
+
left.delete(file);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return {
|
|
129
|
+
components: components.sort(),
|
|
130
|
+
uncovered: [...left].sort(),
|
|
131
|
+
};
|
|
61
132
|
}
|
|
62
133
|
function compare(hashes) {
|
|
63
134
|
const { copy, source, recorded } = hashes;
|
|
@@ -62,22 +62,17 @@ export default class NebulaDiffCommand {
|
|
|
62
62
|
for (const entry of result.entries) {
|
|
63
63
|
out.push(` ${entry.state.padEnd(9)} ${entry.file.padEnd(width)} ${EXPLAIN[entry.state]}`);
|
|
64
64
|
}
|
|
65
|
-
const
|
|
66
|
-
if (
|
|
67
|
-
out.push("",
|
|
65
|
+
const { components, uncovered } = result.update;
|
|
66
|
+
if (components.length > 0) {
|
|
67
|
+
out.push("", " Outdated files that can be updated with no loss — the components that carry them:", ` ream nebula:add --force ${components.join(" ")}`);
|
|
68
|
+
}
|
|
69
|
+
if (uncovered.length > 0) {
|
|
70
|
+
out.push("", " Outdated, but no installed component can re-copy them without overwriting", " a file you changed (or none carries them any more). Compare by hand:", ...uncovered.map((file) => ` ${file}`));
|
|
68
71
|
}
|
|
69
72
|
out.push("");
|
|
70
73
|
process.stdout.write(out.join("\n"));
|
|
71
74
|
}
|
|
72
75
|
}
|
|
73
|
-
/** `molecules/InputGroup.js` → `input-group`, as the registry names it. */
|
|
74
|
-
function componentOf(entry) {
|
|
75
|
-
const base = entry.file.split("/").pop() ?? entry.file;
|
|
76
|
-
return base
|
|
77
|
-
.replace(/\.(ts|js)$/, "")
|
|
78
|
-
.replace(/([a-z0-9])([A-Z])/g, "$1-$2")
|
|
79
|
-
.toLowerCase();
|
|
80
|
-
}
|
|
81
76
|
// Fails the build if the class drifts from what the kernel dispatches against.
|
|
82
77
|
const _contract = NebulaDiffCommand;
|
|
83
78
|
void _contract;
|
|
@@ -109,8 +109,7 @@ export const AccordionContent = component((props) => {
|
|
|
109
109
|
data-state="${() => (item.open() ? "open" : "closed")}"
|
|
110
110
|
aria-labelledby="${item.triggerId}"
|
|
111
111
|
?inert="${() => !item.open()}"
|
|
112
|
-
class="grid text-sm transition-[grid-template-rows] duration-200 ease-out motion-reduce:transition-none"
|
|
113
|
-
style="${() => `grid-template-rows: ${item.open() ? "1fr" : "0fr"}`}"
|
|
112
|
+
class="grid grid-rows-[0fr] text-sm transition-[grid-template-rows] duration-200 ease-out motion-reduce:transition-none data-[state=open]:grid-rows-[1fr]"
|
|
114
113
|
><div class="overflow-hidden"><div
|
|
115
114
|
class="${() => cn("pt-0 pb-4", read(props.class))}"
|
|
116
115
|
>${slot(props.children)}</div></div></div>`;
|
|
@@ -73,7 +73,6 @@ export const CollapsibleContent = component((props) => {
|
|
|
73
73
|
data-state="${() => (collapsible.open() ? "open" : "closed")}"
|
|
74
74
|
aria-labelledby="${collapsible.triggerId}"
|
|
75
75
|
?inert="${() => !collapsible.open()}"
|
|
76
|
-
class="grid transition-[grid-template-rows] duration-200 ease-out motion-reduce:transition-none"
|
|
77
|
-
style="${() => `grid-template-rows: ${collapsible.open() ? "1fr" : "0fr"}`}"
|
|
76
|
+
class="grid grid-rows-[0fr] transition-[grid-template-rows] duration-200 ease-out motion-reduce:transition-none data-[state=open]:grid-rows-[1fr]"
|
|
78
77
|
><div class="${() => cn("overflow-hidden", read(props.class))}">${slot(props.children)}</div></div>`;
|
|
79
78
|
});
|
|
@@ -45,6 +45,12 @@ export interface ResizablePanelProps {
|
|
|
45
45
|
* share and the second takes the rest. The parts are upstream's so a layout
|
|
46
46
|
* written against them reads the same; a third panel would simply have no
|
|
47
47
|
* share of its own.
|
|
48
|
+
*
|
|
49
|
+
* The share is written through the CSSOM (`.style`), never as a `style`
|
|
50
|
+
* attribute: a Content-Security-Policy without `'unsafe-inline'` blocks the
|
|
51
|
+
* attribute, and the CSSOM is not subject to it. A property is not written by
|
|
52
|
+
* the server, so until hydration both panes carry `flex-1` and split the room
|
|
53
|
+
* evenly — the right layout for the default share, and never a collapsed one.
|
|
48
54
|
*/
|
|
49
55
|
export declare const ResizablePanel: (props?: ResizablePanelProps | undefined) => import("@c9up/aurora").TemplateResult;
|
|
50
56
|
export interface ResizableHandleProps {
|
|
@@ -67,14 +67,20 @@ export const ResizablePanelGroup = component((props) => {
|
|
|
67
67
|
* share and the second takes the rest. The parts are upstream's so a layout
|
|
68
68
|
* written against them reads the same; a third panel would simply have no
|
|
69
69
|
* share of its own.
|
|
70
|
+
*
|
|
71
|
+
* The share is written through the CSSOM (`.style`), never as a `style`
|
|
72
|
+
* attribute: a Content-Security-Policy without `'unsafe-inline'` blocks the
|
|
73
|
+
* attribute, and the CSSOM is not subject to it. A property is not written by
|
|
74
|
+
* the server, so until hydration both panes carry `flex-1` and split the room
|
|
75
|
+
* evenly — the right layout for the default share, and never a collapsed one.
|
|
70
76
|
*/
|
|
71
77
|
export const ResizablePanel = component((props) => {
|
|
72
78
|
const group = inject(ResizableContext);
|
|
73
79
|
const first = group.claimPanel() === 1;
|
|
74
80
|
return html `<div
|
|
75
81
|
data-slot="resizable-panel"
|
|
76
|
-
class="${() => cn("overflow-hidden",
|
|
77
|
-
style="${() => (first ? `flex: 0 0 ${group.size()}%` : "")}"
|
|
82
|
+
class="${() => cn("flex-1 overflow-hidden", read(props.class))}"
|
|
83
|
+
.style="${() => (first ? `flex: 0 0 ${group.size()}%` : "")}"
|
|
78
84
|
>${slot(props.children)}</div>`;
|
|
79
85
|
});
|
|
80
86
|
/**
|