@typed-grid-areas/svelte 0.0.0 → 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 +21 -0
- package/README.md +1374 -0
- package/dist/Grid.svelte +67 -0
- package/dist/Grid.svelte.d.ts +15 -0
- package/dist/Slot.svelte +21 -0
- package/dist/Slot.svelte.d.ts +12 -0
- package/dist/createGridComponent.d.ts +28 -0
- package/dist/createGridComponent.js +71 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/slotCheck.d.ts +9 -0
- package/dist/slotCheck.js +33 -0
- package/dist/styleOwners.d.ts +14 -0
- package/dist/styleOwners.js +51 -0
- package/dist/types.d.ts +46 -0
- package/dist/types.js +1 -0
- package/package.json +59 -1
package/dist/Grid.svelte
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
@component
|
|
3
|
+
A grid instance: its size container (when the definition has breakpoints),
|
|
4
|
+
the grid element (a `div`, or the element your `child` snippet renders),
|
|
5
|
+
and the definition's CSS in `<svelte:head>`. Rendered through the component
|
|
6
|
+
`createGridComponent` returns, which supplies `definition` and `outerArea`.
|
|
7
|
+
-->
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
import { BROWSER, DEV } from "esm-env";
|
|
10
|
+
import { onDestroy, untrack } from "svelte";
|
|
11
|
+
import { createAttachmentKey } from "svelte/attachments";
|
|
12
|
+
import type { GridConfig } from "typed-grid-areas";
|
|
13
|
+
import { gridMarkup, gridStyleTags } from "typed-grid-areas/adapter";
|
|
14
|
+
import { slotCheckAttachment } from "./slotCheck.js";
|
|
15
|
+
import { claimServerStyle, joinStyleOwners } from "./styleOwners.js";
|
|
16
|
+
import type { GridRootProps } from "./types.js";
|
|
17
|
+
|
|
18
|
+
type Props = GridRootProps & {
|
|
19
|
+
definition: GridConfig<string>;
|
|
20
|
+
outerArea?: string;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
let { definition, outerArea, child, children, ...rest }: Props = $props();
|
|
24
|
+
|
|
25
|
+
// `createGridComponent` fixes the definition for good.
|
|
26
|
+
const config = untrack(() => definition);
|
|
27
|
+
const markup = gridMarkup(config);
|
|
28
|
+
const styleTag = gridStyleTags([config]);
|
|
29
|
+
|
|
30
|
+
// Whether this instance renders the definition's CSS: one per definition does.
|
|
31
|
+
let ownsStyle = $state(false);
|
|
32
|
+
if (BROWSER) {
|
|
33
|
+
const membership = joinStyleOwners(markup.id, () => (ownsStyle = true));
|
|
34
|
+
ownsStyle = membership.owns;
|
|
35
|
+
onDestroy(membership.leave);
|
|
36
|
+
} else {
|
|
37
|
+
ownsStyle = claimServerStyle(markup.id);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// In development, the grid element (yours too, through `child`) checks its slots.
|
|
41
|
+
const checkSlots = DEV ? { [createAttachmentKey()]: slotCheckAttachment(config) } : {};
|
|
42
|
+
|
|
43
|
+
const elements = $derived(markup.elements(outerArea));
|
|
44
|
+
const gridProps = $derived({ ...rest, ...elements.grid.attributes, ...checkSlots });
|
|
45
|
+
</script>
|
|
46
|
+
|
|
47
|
+
<svelte:head>
|
|
48
|
+
{#if ownsStyle}
|
|
49
|
+
{@html styleTag}
|
|
50
|
+
{/if}
|
|
51
|
+
</svelte:head>
|
|
52
|
+
|
|
53
|
+
{#snippet grid()}
|
|
54
|
+
{#if child}
|
|
55
|
+
{@render child({ props: gridProps })}
|
|
56
|
+
{:else}
|
|
57
|
+
<div {...gridProps}>{@render children?.()}</div>
|
|
58
|
+
{/if}
|
|
59
|
+
{/snippet}
|
|
60
|
+
|
|
61
|
+
{#if elements.sizeContainer}
|
|
62
|
+
<div {...elements.sizeContainer.attributes} style={elements.sizeContainer.styleText}>
|
|
63
|
+
{@render grid()}
|
|
64
|
+
</div>
|
|
65
|
+
{:else}
|
|
66
|
+
{@render grid()}
|
|
67
|
+
{/if}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { GridConfig } from "typed-grid-areas";
|
|
2
|
+
import type { GridRootProps } from "./types.ts";
|
|
3
|
+
type Props = GridRootProps & {
|
|
4
|
+
definition: GridConfig<string>;
|
|
5
|
+
outerArea?: string;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* A grid instance: its size container (when the definition has breakpoints),
|
|
9
|
+
* the grid element (a `div`, or the element your `child` snippet renders),
|
|
10
|
+
* and the definition's CSS in `<svelte:head>`. Rendered through the component
|
|
11
|
+
* `createGridComponent` returns, which supplies `definition` and `outerArea`.
|
|
12
|
+
*/
|
|
13
|
+
declare const Grid: import("svelte").Component<Props, {}, "">;
|
|
14
|
+
type Grid = ReturnType<typeof Grid>;
|
|
15
|
+
export default Grid;
|
package/dist/Slot.svelte
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
@component
|
|
3
|
+
The slot filling one area: a `div`, or the element your `child` snippet
|
|
4
|
+
renders, marked with the area's `data-area`. Rendered through the
|
|
5
|
+
component `createGridComponent` returns, which supplies `area`.
|
|
6
|
+
-->
|
|
7
|
+
<script lang="ts">
|
|
8
|
+
import type { SlotProps } from "./types.js";
|
|
9
|
+
|
|
10
|
+
type Props = SlotProps & { area: string };
|
|
11
|
+
|
|
12
|
+
let { area, child, children, ...rest }: Props = $props();
|
|
13
|
+
|
|
14
|
+
const slotProps = $derived({ ...rest, "data-area": area });
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
{#if child}
|
|
18
|
+
{@render child({ props: slotProps })}
|
|
19
|
+
{:else}
|
|
20
|
+
<div {...slotProps}>{@render children?.()}</div>
|
|
21
|
+
{/if}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { SlotProps } from "./types.ts";
|
|
2
|
+
type Props = SlotProps & {
|
|
3
|
+
area: string;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* The slot filling one area: a `div`, or the element your `child` snippet
|
|
7
|
+
* renders, marked with the area's `data-area`. Rendered through the
|
|
8
|
+
* component `createGridComponent` returns, which supplies `area`.
|
|
9
|
+
*/
|
|
10
|
+
declare const Slot: import("svelte").Component<Props, {}, "">;
|
|
11
|
+
type Slot = ReturnType<typeof Slot>;
|
|
12
|
+
export default Slot;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { GridConfig } from "typed-grid-areas";
|
|
2
|
+
import type { GridComponent, GridComponentOptions } from "./types.ts";
|
|
3
|
+
/**
|
|
4
|
+
* Turns a definition into the component it renders as.
|
|
5
|
+
*
|
|
6
|
+
* `<Card>` renders the grid (inside its own size container when the
|
|
7
|
+
* definition has breakpoints) and puts the definition's CSS in `<head>`;
|
|
8
|
+
* `<Card.icon>` renders the slot that fills the `icon` area. Both take any
|
|
9
|
+
* attribute a `div` takes, children, and a `child` snippet to render your
|
|
10
|
+
* own element instead of the `div`.
|
|
11
|
+
*
|
|
12
|
+
* Create grid components once per definition, in a module (`.ts`, or a
|
|
13
|
+
* component's `<script module>`).
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* const Content = createGridComponent(
|
|
18
|
+
* defineLayout({ areas: ["icon?", "title"], layouts: [{ template: "icon title" }] }),
|
|
19
|
+
* );
|
|
20
|
+
* export const Card = createGridComponent(
|
|
21
|
+
* defineLayout({ areas: ["input?", "content"], layouts: [{ template: "input content" }] }),
|
|
22
|
+
* { nest: { content: Content } },
|
|
23
|
+
* );
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare function createGridComponent<TAreaName extends string, const TNest extends GridComponentOptions<TAreaName>["nest"] = {}>(definition: GridConfig<TAreaName>, options?: {
|
|
27
|
+
nest?: TNest;
|
|
28
|
+
}): GridComponent<TAreaName, TNest>;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import Grid from "./Grid.svelte";
|
|
2
|
+
import Slot from "./Slot.svelte";
|
|
3
|
+
/**
|
|
4
|
+
* `component` with some props fixed: Svelte 5's public component signature,
|
|
5
|
+
* `(internals, props)`, forwarding `internals` untouched and `props` through
|
|
6
|
+
* a proxy that answers the fixed props itself and reads every other prop
|
|
7
|
+
* from the caller's props live, so they stay reactive.
|
|
8
|
+
*/
|
|
9
|
+
function withFixedProps(
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11
|
+
component, fixed) {
|
|
12
|
+
const isFixed = (key) => typeof key === "string" && Object.hasOwn(fixed, key);
|
|
13
|
+
return (internals, props) => component(internals, new Proxy(props, {
|
|
14
|
+
get: (target, key, receiver) => isFixed(key) ? fixed[key] : Reflect.get(target, key, receiver),
|
|
15
|
+
has: (target, key) => isFixed(key) || Reflect.has(target, key),
|
|
16
|
+
ownKeys: target => [
|
|
17
|
+
...Reflect.ownKeys(target).filter(key => !isFixed(key)),
|
|
18
|
+
...Object.keys(fixed),
|
|
19
|
+
],
|
|
20
|
+
getOwnPropertyDescriptor: (target, key) => isFixed(key)
|
|
21
|
+
? { value: fixed[key], enumerable: true, configurable: true, writable: false }
|
|
22
|
+
: Reflect.getOwnPropertyDescriptor(target, key),
|
|
23
|
+
}));
|
|
24
|
+
}
|
|
25
|
+
/** The members (one per area) a grid component carries, for nesting it. */
|
|
26
|
+
const MEMBERS = Symbol("typed-grid-areas members");
|
|
27
|
+
/**
|
|
28
|
+
* Defines `members` on a component. `defineProperty`, because an area may be
|
|
29
|
+
* named like a function's own read-only properties (`name`, `length`).
|
|
30
|
+
*/
|
|
31
|
+
function withMembers(component, members) {
|
|
32
|
+
for (const [key, value] of Object.entries(members)) {
|
|
33
|
+
Object.defineProperty(component, key, { value, enumerable: true, configurable: true });
|
|
34
|
+
}
|
|
35
|
+
Object.defineProperty(component, MEMBERS, { value: members });
|
|
36
|
+
return component;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Turns a definition into the component it renders as.
|
|
40
|
+
*
|
|
41
|
+
* `<Card>` renders the grid (inside its own size container when the
|
|
42
|
+
* definition has breakpoints) and puts the definition's CSS in `<head>`;
|
|
43
|
+
* `<Card.icon>` renders the slot that fills the `icon` area. Both take any
|
|
44
|
+
* attribute a `div` takes, children, and a `child` snippet to render your
|
|
45
|
+
* own element instead of the `div`.
|
|
46
|
+
*
|
|
47
|
+
* Create grid components once per definition, in a module (`.ts`, or a
|
|
48
|
+
* component's `<script module>`).
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```ts
|
|
52
|
+
* const Content = createGridComponent(
|
|
53
|
+
* defineLayout({ areas: ["icon?", "title"], layouts: [{ template: "icon title" }] }),
|
|
54
|
+
* );
|
|
55
|
+
* export const Card = createGridComponent(
|
|
56
|
+
* defineLayout({ areas: ["input?", "content"], layouts: [{ template: "input content" }] }),
|
|
57
|
+
* { nest: { content: Content } },
|
|
58
|
+
* );
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
export function createGridComponent(definition, options = {}) {
|
|
62
|
+
const members = {};
|
|
63
|
+
for (const area of definition.areas) {
|
|
64
|
+
const nested = options.nest?.[area];
|
|
65
|
+
members[area] =
|
|
66
|
+
nested === undefined
|
|
67
|
+
? withFixedProps(Slot, { area })
|
|
68
|
+
: withMembers(withFixedProps(nested, { outerArea: area }), nested[MEMBERS] ?? {});
|
|
69
|
+
}
|
|
70
|
+
return withMembers(withFixedProps(Grid, { definition }), members);
|
|
71
|
+
}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createGridComponent } from "./createGridComponent.js";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Attachment } from "svelte/attachments";
|
|
2
|
+
import type { GridConfig } from "typed-grid-areas";
|
|
3
|
+
/**
|
|
4
|
+
* The development slot check, as an attachment for the grid element: it
|
|
5
|
+
* checks the grid's slots once mounted, then again whenever its direct
|
|
6
|
+
* children or their `data-area` change (runes mode has no after-update
|
|
7
|
+
* hook), logging each distinct set of problems once.
|
|
8
|
+
*/
|
|
9
|
+
export declare function slotCheckAttachment(definition: GridConfig<string>): Attachment<Element>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { createSlotCheck } from "typed-grid-areas/adapter";
|
|
2
|
+
/**
|
|
3
|
+
* The development slot check, as an attachment for the grid element: it
|
|
4
|
+
* checks the grid's slots once mounted, then again whenever its direct
|
|
5
|
+
* children or their `data-area` change (runes mode has no after-update
|
|
6
|
+
* hook), logging each distinct set of problems once.
|
|
7
|
+
*/
|
|
8
|
+
export function slotCheckAttachment(definition) {
|
|
9
|
+
return grid => {
|
|
10
|
+
const check = createSlotCheck(definition, {
|
|
11
|
+
strayChildRemedy: "make it a slot with a `child` snippet",
|
|
12
|
+
});
|
|
13
|
+
const run = () => {
|
|
14
|
+
for (const warning of check(grid)) {
|
|
15
|
+
// eslint-disable-next-line no-console
|
|
16
|
+
console.warn(warning);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
run();
|
|
20
|
+
const observer = new MutationObserver(records => {
|
|
21
|
+
if (records.some(record => record.target === grid || record.target.parentNode === grid)) {
|
|
22
|
+
run();
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
observer.observe(grid, {
|
|
26
|
+
childList: true,
|
|
27
|
+
subtree: true,
|
|
28
|
+
attributes: true,
|
|
29
|
+
attributeFilter: ["data-area"],
|
|
30
|
+
});
|
|
31
|
+
return () => observer.disconnect();
|
|
32
|
+
};
|
|
33
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* On the server, during a component's render: whether this instance is the
|
|
3
|
+
* first of its definition in the current `render()`, and so renders its CSS.
|
|
4
|
+
*/
|
|
5
|
+
export declare function claimServerStyle(id: string): boolean;
|
|
6
|
+
/**
|
|
7
|
+
* In the browser, while a component initialises: joins the definition's
|
|
8
|
+
* instances. The first owns the style tag; when it leaves, the next one
|
|
9
|
+
* takes over (`takeOver` is called), and the tag goes away with the last.
|
|
10
|
+
*/
|
|
11
|
+
export declare function joinStyleOwners(id: string, takeOver: () => void): {
|
|
12
|
+
owns: boolean;
|
|
13
|
+
leave: () => void;
|
|
14
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which instance of a definition renders its CSS (ADR 0005). Svelte's
|
|
3
|
+
* `<svelte:head>` doesn't deduplicate, so exactly one instance per
|
|
4
|
+
* definition renders the style tag there: the first to render.
|
|
5
|
+
*/
|
|
6
|
+
import { getAbortSignal } from "svelte";
|
|
7
|
+
/** Per server render (one abort signal each), the grid ids whose CSS is already rendered. */
|
|
8
|
+
const rendered = new WeakMap();
|
|
9
|
+
/**
|
|
10
|
+
* On the server, during a component's render: whether this instance is the
|
|
11
|
+
* first of its definition in the current `render()`, and so renders its CSS.
|
|
12
|
+
*/
|
|
13
|
+
export function claimServerStyle(id) {
|
|
14
|
+
const signal = getAbortSignal();
|
|
15
|
+
let ids = rendered.get(signal);
|
|
16
|
+
if (ids === undefined) {
|
|
17
|
+
ids = new Set();
|
|
18
|
+
rendered.set(signal, ids);
|
|
19
|
+
}
|
|
20
|
+
if (ids.has(id)) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
ids.add(id);
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
/** In the browser, the mounted instances of each definition, oldest first. */
|
|
27
|
+
const owners = new Map();
|
|
28
|
+
/**
|
|
29
|
+
* In the browser, while a component initialises: joins the definition's
|
|
30
|
+
* instances. The first owns the style tag; when it leaves, the next one
|
|
31
|
+
* takes over (`takeOver` is called), and the tag goes away with the last.
|
|
32
|
+
*/
|
|
33
|
+
export function joinStyleOwners(id, takeOver) {
|
|
34
|
+
const instances = owners.get(id) ?? [];
|
|
35
|
+
owners.set(id, instances);
|
|
36
|
+
const owner = { takeOver };
|
|
37
|
+
instances.push(owner);
|
|
38
|
+
return {
|
|
39
|
+
owns: instances[0] === owner,
|
|
40
|
+
leave() {
|
|
41
|
+
const index = instances.indexOf(owner);
|
|
42
|
+
instances.splice(index, 1);
|
|
43
|
+
if (index === 0) {
|
|
44
|
+
instances[0]?.takeOver();
|
|
45
|
+
}
|
|
46
|
+
if (instances.length === 0) {
|
|
47
|
+
owners.delete(id);
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { Component, Snippet } from "svelte";
|
|
2
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
+
/**
|
|
4
|
+
* What a `child` snippet receives: the attributes to spread onto your own
|
|
5
|
+
* element, `{#snippet child({ props })}<label {...props}>…</label>{/snippet}`.
|
|
6
|
+
*/
|
|
7
|
+
export type ChildSnippetProps = {
|
|
8
|
+
props: Record<string, unknown>;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Props of a slot component (`<Card.icon>`): anything a `div` takes, plus a
|
|
12
|
+
* `child` snippet to render your own element instead of the `div`.
|
|
13
|
+
*/
|
|
14
|
+
export type SlotProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
|
|
15
|
+
/**
|
|
16
|
+
* Renders your own element as the slot (or grid) instead of a `div`:
|
|
17
|
+
* spread `props` onto it. Bits UI's convention.
|
|
18
|
+
*/
|
|
19
|
+
child?: Snippet<[ChildSnippetProps]>;
|
|
20
|
+
children?: Snippet;
|
|
21
|
+
};
|
|
22
|
+
/** Props of a grid's component (`<Card>`): the same as a slot's. */
|
|
23
|
+
export type GridRootProps = SlotProps;
|
|
24
|
+
/** A slot component (`<Card.icon>`): renders the element that fills one area. */
|
|
25
|
+
export type SlotComponent = Component<SlotProps>;
|
|
26
|
+
/**
|
|
27
|
+
* The component a definition renders as: the grid itself, with a slot
|
|
28
|
+
* component per area, named exactly like the area. An area nested through
|
|
29
|
+
* `nest` is the nested grid's component instead, with that grid's slots as
|
|
30
|
+
* its members (`<Card.content.icon>`).
|
|
31
|
+
*/
|
|
32
|
+
export type GridComponent<TAreaName extends string, TNest = {}> = Component<GridRootProps> & {
|
|
33
|
+
readonly [K in TAreaName]: K extends keyof TNest ? TNest[K] : SlotComponent;
|
|
34
|
+
};
|
|
35
|
+
/** Any grid component, whatever its areas. */
|
|
36
|
+
export type AnyGridComponent = GridComponent<any, any>;
|
|
37
|
+
/** Options of `createGridComponent`. */
|
|
38
|
+
export type GridComponentOptions<TAreaName extends string> = {
|
|
39
|
+
/**
|
|
40
|
+
* Grids nested into areas of this one: `nest: { content: Content }` makes
|
|
41
|
+
* `<Card.content>` both the `content` slot and the grid `Content`.
|
|
42
|
+
*/
|
|
43
|
+
nest?: {
|
|
44
|
+
readonly [K in TAreaName]?: AnyGridComponent;
|
|
45
|
+
};
|
|
46
|
+
};
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1 +1,59 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"name": "@typed-grid-areas/svelte",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Svelte adapter for typed-grid-areas: render a grid definition as typed slot components.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/MichaelBuss/typed-grid-areas.git",
|
|
10
|
+
"directory": "packages/svelte"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://github.com/MichaelBuss/typed-grid-areas#readme",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/MichaelBuss/typed-grid-areas/issues"
|
|
15
|
+
},
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"svelte": "./dist/index.js"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"dist"
|
|
24
|
+
],
|
|
25
|
+
"buildSources": {
|
|
26
|
+
"dist": [
|
|
27
|
+
"src/lib"
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "svelte-package -i src/lib -o dist",
|
|
32
|
+
"prepack": "npm run build 1>&2 && cp ../../README.md ../../LICENSE .",
|
|
33
|
+
"postpack": "rm README.md LICENSE",
|
|
34
|
+
"test": "vitest run --project unit --project node",
|
|
35
|
+
"test:browser": "vitest run --project browser --project browser-development",
|
|
36
|
+
"typecheck": "svelte-check --tsconfig ./tsconfig.json --fail-on-warnings"
|
|
37
|
+
},
|
|
38
|
+
"peerDependencies": {
|
|
39
|
+
"svelte": "^5.57.0"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"esm-env": "^1.2.2",
|
|
43
|
+
"typed-grid-areas": "^0.2.0"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@sveltejs/package": "^3.0.1",
|
|
47
|
+
"@sveltejs/vite-plugin-svelte": "^7.3.1",
|
|
48
|
+
"@typed-grid-areas/acceptance": "*",
|
|
49
|
+
"@types/node": "^22.10.5",
|
|
50
|
+
"@vitest/browser-playwright": "^5.0.1",
|
|
51
|
+
"playwright": "^1.64.1",
|
|
52
|
+
"svelte": "^5.57.3",
|
|
53
|
+
"svelte-check": "^4.7.7",
|
|
54
|
+
"typescript": "~6.0.3",
|
|
55
|
+
"vite": "^8.3.5",
|
|
56
|
+
"vitest": "^5.0.1",
|
|
57
|
+
"vitest-browser-svelte": "^3.1.0"
|
|
58
|
+
}
|
|
59
|
+
}
|