@dotquilt/react 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 +21 -0
- package/README.md +72 -2
- package/dist/chart.css +4 -0
- package/dist/chart.d.ts +12 -0
- package/dist/chart.js +26 -0
- package/dist/circle.css +6 -0
- package/dist/host.d.ts +8 -0
- package/dist/host.js +68 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +8 -0
- package/dist/line.css +6 -0
- package/dist/region-styles.d.ts +1 -0
- package/dist/region-styles.js +6 -0
- package/dist/region.css +2 -0
- package/dist/region.d.ts +21 -0
- package/dist/region.js +31 -0
- package/dist/server.d.ts +20 -0
- package/dist/server.js +44 -0
- package/dist/skeleton-family.css +16 -0
- package/dist/skeleton-shapes.d.ts +22 -0
- package/dist/skeleton-shapes.js +48 -0
- package/dist/skeleton-text.css +6 -0
- package/dist/skeleton.css +4 -0
- package/dist/skeleton.d.ts +13 -0
- package/dist/skeleton.js +25 -0
- package/dist/static.d.ts +23 -0
- package/dist/static.js +123 -0
- package/dist/table.css +3 -0
- package/dist/table.d.ts +14 -0
- package/dist/table.js +36 -0
- package/dist/text.css +3 -0
- package/dist/text.d.ts +19 -0
- package/dist/text.js +41 -0
- package/dist/types.d.ts +23 -0
- package/dist/types.js +1 -0
- package/dist/typing.css +6 -0
- package/dist/typing.d.ts +8 -0
- package/dist/typing.js +26 -0
- package/package.json +80 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Derenik Khachatryan
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,73 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Dotquilt for React
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
React 19 components for [Dotquilt](https://dotquilt.dev): loading placeholders that hold the shape of your content, then hand over to it. They are thin wrappers over the native Web Components in `dotquilt`. Server rendering is included: placeholders are in the first HTML at your content's size, and hydration keeps your content and focus.
|
|
4
|
+
|
|
5
|
+
<a href="https://dotquilt.dev"><img src="https://raw.githubusercontent.com/b4rb13/dot-loaders/main/.github/assets/hero-light.gif" alt="A revenue screen loading: its figures take shape in square marks, a chart line draws from a field of dots, and the table rows settle, then everything hands over to the real content." width="100%"></a>
|
|
6
|
+
|
|
7
|
+
> **Status:** alpha (0.x). The API may still change before 1.0.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @dotquilt/react dotquilt
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
`react` and `react-dom` 19 are peer dependencies.
|
|
16
|
+
|
|
17
|
+
## Quick start
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
'use client';
|
|
21
|
+
import { LoadingRegion, SkeletonText } from '@dotquilt/react';
|
|
22
|
+
|
|
23
|
+
export function Summary({ data }: { data: Revenue | null }) {
|
|
24
|
+
return (
|
|
25
|
+
<LoadingRegion
|
|
26
|
+
aria-label="Revenue"
|
|
27
|
+
state={data ? 'ready' : 'pending'}
|
|
28
|
+
placeholder={<SkeletonText lines={3} />}
|
|
29
|
+
>
|
|
30
|
+
{data && <RevenueCard data={data} />}
|
|
31
|
+
</LoadingRegion>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Your app owns the request; the region only needs to know whether the data is `pending`, `refreshing` (content stays visible and usable) or `ready`. Give each load a `cycle` so a stale answer can't settle a newer one. Use `delay` and `minDisplay` to keep fast loads from flickering.
|
|
37
|
+
|
|
38
|
+
## Components
|
|
39
|
+
|
|
40
|
+
| Component | Use it for |
|
|
41
|
+
| --- | --- |
|
|
42
|
+
| `LoadingRegion` | Wraps content: a placeholder while pending, a refresh cue while refreshing, a handoff when ready |
|
|
43
|
+
| `SkeletonBlock`, `SkeletonLine`, `SkeletonCircle`, `SkeletonText` | Images, lines, avatars and paragraphs |
|
|
44
|
+
| `TextLoader` | Numbers and short labels that take shape in marks, then hand over |
|
|
45
|
+
| `ChartLoader` | Line, bar and scatter charts; give it a `targetProvider` so marks glide onto your data |
|
|
46
|
+
| `TableLoader` | Tables: each cell's marks gather into its real text |
|
|
47
|
+
| `TypingDots` | A reply that is being written |
|
|
48
|
+
|
|
49
|
+
Each component is also available from its own entry (for example `@dotquilt/react/region`), so a page loads only what it uses. Animations come from `dotquilt/animations/<family>` and are passed as `animations={{ idle: scan() }}`.
|
|
50
|
+
|
|
51
|
+
## Server rendering and hydration
|
|
52
|
+
|
|
53
|
+
- Render the same `state` on the server and in the first client render, so hydration matches.
|
|
54
|
+
- Without JavaScript, or if it fails, a pending region keeps its still placeholder and your content stays visible and usable. To hide pending content instead, render it with `hidden` and `inert` yourself.
|
|
55
|
+
- **Next.js App Router:** import your client component from a server component as usual; don't turn off SSR. Keep custom animations, refs, callbacks and reveal targets in client code, because they can't cross the server boundary.
|
|
56
|
+
|
|
57
|
+
## Strict CSP
|
|
58
|
+
|
|
59
|
+
Choose a `stylePolicy` before the first render and pass it to every component:
|
|
60
|
+
|
|
61
|
+
- **`{ mode: 'inline' }`** (default) writes deterministic `<style>` elements. Allow them with CSP hashes of the exported strings in `@dotquilt/react/server` and `dotquilt/server`.
|
|
62
|
+
- **`{ mode: 'inline', nonce }`** applies your request's nonce. Keep the document's nonce for the whole visit, including client navigations.
|
|
63
|
+
- **`{ mode: 'external', href }`** points at a stylesheet you serve. Copy it from `@dotquilt/react/styles/*.css`.
|
|
64
|
+
|
|
65
|
+
Dotquilt never writes inline `style` attributes. With `style-src-attr 'none'`, theme it with classes and the `--dotquilt-*` custom properties in your own CSS.
|
|
66
|
+
|
|
67
|
+
## Docs
|
|
68
|
+
|
|
69
|
+
Guides, every option and live examples are at [dotquilt.dev](https://dotquilt.dev). You can also try every loader in the [playground](https://dotquilt.dev/playground/).
|
|
70
|
+
|
|
71
|
+
## License
|
|
72
|
+
|
|
73
|
+
MIT
|
package/dist/chart.css
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
:host{display:block;position:relative;width:100%;height:12rem;overflow:hidden}:host([hidden]){display:none}:host .surface{position:absolute;inset:0;gap:var(--dotquilt-dot-gap,4.6px);--s:var(--dotquilt-dot-size,4.4px);--g:calc(var(--s) + var(--dotquilt-dot-gap,4.6px));background:radial-gradient(circle,var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) calc(var(--s)/2 - .5px),#0000 calc(var(--s)/2 + .5px)) 0 0/var(--g) var(--g);opacity:0.15}:host([mark=square]) .surface{background:var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) 0 0/8.5px 8.5px repeat;mask:linear-gradient(#0000 1.75px,#000 2.75px,#000 5.75px,#0000 6.75px),linear-gradient(90deg,#0000 1.75px,#000 2.75px,#000 5.75px,#0000 6.75px);mask-size:8.5px 8.5px;mask-position:0 0;mask-repeat:repeat;mask-composite:intersect}:host([mark=dash]) .surface{background:var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) 0 0/13px 9.5px repeat;mask:radial-gradient(circle at 3.5px 4.75px,#000 1.2px,#0000 2.2px),radial-gradient(circle at 9.5px 4.75px,#000 1.2px,#0000 2.2px),linear-gradient(#0000 2.55px,#000 3.55px,#000 5.95px,#0000 6.95px),linear-gradient(90deg,#0000 3px,#000 4px,#000 9px,#0000 10px);mask-size:13px 9.5px;mask-position:0 0;mask-repeat:repeat;mask-composite:add,add,intersect}:host > svg{position:relative;display:block;width:100%;height:100%;pointer-events:none}:host([data-custom]) .surface{visibility:hidden}:host [data-dotquilt-react-static]{display:none}@media(forced-colors:active){:host .surface{visibility:visible;border:1px dotted CanvasText}:host > svg{display:none}}:host canvas[data-dotquilt-bitmap]{display:block;width:100%;height:100%;pointer-events:none}
|
|
2
|
+
:host(:state(unstyled)) > :not(slot){display:none!important}
|
|
3
|
+
:where(dotquilt-chart-loader:is(:not(:defined),:state(unstyled))){display:block;position:relative;width:100%;height:12rem;overflow:hidden}dotquilt-chart-loader:is(:not(:defined),:state(unstyled))[hidden]{display:none}dotquilt-chart-loader:is(:not(:defined),:state(unstyled)) [data-dotquilt-static]{position:absolute;inset:0;gap:var(--dotquilt-dot-gap,4.6px);--s:var(--dotquilt-dot-size,4.4px);--g:calc(var(--s) + var(--dotquilt-dot-gap,4.6px));background:radial-gradient(circle,var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) calc(var(--s)/2 - .5px),#0000 calc(var(--s)/2 + .5px)) 0 0/var(--g) var(--g);opacity:0.15}@media(forced-colors:active){dotquilt-chart-loader:is(:not(:defined),:state(unstyled)) [data-dotquilt-static]{border:1px dotted CanvasText}}
|
|
4
|
+
dotquilt-chart-loader:is(:not(:defined),:state(unstyled))[mark=square] [data-dotquilt-static]{background:var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) 0 0/8.5px 8.5px repeat;mask:linear-gradient(#0000 1.75px,#000 2.75px,#000 5.75px,#0000 6.75px),linear-gradient(90deg,#0000 1.75px,#000 2.75px,#000 5.75px,#0000 6.75px);mask-size:8.5px 8.5px;mask-position:0 0;mask-repeat:repeat;mask-composite:intersect}dotquilt-chart-loader:is(:not(:defined),:state(unstyled))[mark=dash] [data-dotquilt-static]{background:var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) 0 0/13px 9.5px repeat;mask:radial-gradient(circle at 3.5px 4.75px,#000 1.2px,#0000 2.2px),radial-gradient(circle at 9.5px 4.75px,#000 1.2px,#0000 2.2px),linear-gradient(#0000 2.55px,#000 3.55px,#000 5.95px,#0000 6.95px),linear-gradient(90deg,#0000 3px,#000 4px,#000 9px,#0000 10px);mask-size:13px 9.5px;mask-position:0 0;mask-repeat:repeat;mask-composite:add,add,intersect}
|
package/dist/chart.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Animations } from 'dotquilt';
|
|
2
|
+
import { type ChartPreset, type ChartVariant, type ChartLoader as NativeChartLoader, type TargetProvider } from 'dotquilt/chart';
|
|
3
|
+
import type { HostProps } from './types.js';
|
|
4
|
+
export interface ChartLoaderProps extends HostProps<NativeChartLoader> {
|
|
5
|
+
variant?: ChartVariant | undefined;
|
|
6
|
+
speed?: number | undefined;
|
|
7
|
+
pointerResponse?: 'none' | 'lift' | undefined;
|
|
8
|
+
animations?: Animations<'chart'> | undefined;
|
|
9
|
+
preset?: ChartPreset | undefined;
|
|
10
|
+
targetProvider?: TargetProvider | undefined;
|
|
11
|
+
}
|
|
12
|
+
export declare const ChartLoader: import("react").ForwardRefExoticComponent<ChartLoaderProps & import("react").RefAttributes<NativeChartLoader>>;
|
package/dist/chart.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { registerChartLoader, } from 'dotquilt/chart';
|
|
4
|
+
import { forwardRef, useState } from 'react';
|
|
5
|
+
import { useHost } from './host.js';
|
|
6
|
+
import { reactChartMarkStyles, reactChartStyles } from './server.js';
|
|
7
|
+
import { initialPolicy, markSheet, policyAttributes, sheet, useCustomAttribute, useStyleNonce, } from './static.js';
|
|
8
|
+
export const ChartLoader = /* @__PURE__ */ forwardRef(function ChartLoader({ variant, speed, pointerResponse, animations, preset, targetProvider, stylePolicy, motion, onHandoffStart, onHandoffEnd, onHandoffCancel, onLoaderError, ...attributes }, ref) {
|
|
9
|
+
const [initial] = useState(() => ({
|
|
10
|
+
policy: initialPolicy(stylePolicy),
|
|
11
|
+
variant: variant ?? preset?.variant ?? 'line',
|
|
12
|
+
}));
|
|
13
|
+
const nonce = useStyleNonce(initial.policy, 'chart');
|
|
14
|
+
const upgraded = useCustomAttribute();
|
|
15
|
+
const host = useHost(ref, registerChartLoader, {
|
|
16
|
+
variant,
|
|
17
|
+
speed,
|
|
18
|
+
pointerResponse,
|
|
19
|
+
animations,
|
|
20
|
+
preset,
|
|
21
|
+
targetProvider,
|
|
22
|
+
stylePolicy: stylePolicy ?? initial.policy,
|
|
23
|
+
motion,
|
|
24
|
+
}, { onHandoffStart, onHandoffEnd, onHandoffCancel, onLoaderError });
|
|
25
|
+
return (_jsxs(_Fragment, { children: [sheet(reactChartStyles, initial.policy, 'chart', nonce), markSheet(reactChartMarkStyles, initial.policy, 'chart', nonce, attributes.mark), _jsx("dotquilt-chart-loader", { ...attributes, ...upgraded, ...policyAttributes(initial.policy, nonce), "aria-hidden": true, "data-dotquilt-surface": "", motion: "paused", variant: initial.variant, ref: host, children: _jsx("span", { "data-dotquilt-react-static": "", "aria-hidden": true, children: _jsx("span", { "data-dotquilt-static": "" }) }) })] }));
|
|
26
|
+
});
|
package/dist/circle.css
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
:host{display:block;width:100%;height:1em;position:relative;border-radius:var(--dotquilt-radius,.375rem);overflow:hidden}:host .surface{position:absolute;inset:0;--s:var(--dotquilt-dot-size,4.4px);--g:calc(var(--s) + var(--dotquilt-dot-gap,4.6px));background:radial-gradient(circle,var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) calc(var(--s)/2 - .5px),#0000 calc(var(--s)/2 + .5px)) center/var(--g) var(--g) space;opacity:0.37}:host .pulse{position:absolute;inset:0;--dotquilt-color:var(--dotquilt-accent-color,light-dark(#4f8f93,#8dc4c5));opacity:0;mask:linear-gradient(104deg,#0000 12.5%,#00000005 18.75%,#0000001b 26.56%,#0000005e 34.38%,#000000c7 42.19%,#000 50%,#000000c7 57.81%,#0000005e 65.63%,#0000001b 73.44%,#00000005 81.25%,#0000 87.5%) 0 0/128% 100% no-repeat}:host .pulse>.surface,:host .lift>.surface{opacity:1}:host .lift{position:absolute;inset:0;--dotquilt-color:var(--dotquilt-accent-color,light-dark(#4f8f93,#8dc4c5));opacity:0;mask:radial-gradient(circle 56px at var(--dotquilt-pointer-x,-999px) var(--dotquilt-pointer-y,-999px),#000,#0000);transition:opacity .32s cubic-bezier(.22,1,.36,1)}:host([mark=square]) .surface{background:var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) center/8.5px 8.5px space;mask:linear-gradient(#0000 1.75px,#000 2.75px,#000 5.75px,#0000 6.75px),linear-gradient(90deg,#0000 1.75px,#000 2.75px,#000 5.75px,#0000 6.75px);mask-size:8.5px 8.5px;mask-position:center;mask-repeat:space;mask-composite:intersect}:host([mark=dash]) .surface{background:var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) center/13px 9.5px space;mask:radial-gradient(circle at 3.5px 4.75px,#000 1.2px,#0000 2.2px),radial-gradient(circle at 9.5px 4.75px,#000 1.2px,#0000 2.2px),linear-gradient(#0000 2.55px,#000 3.55px,#000 5.95px,#0000 6.95px),linear-gradient(90deg,#0000 3px,#000 4px,#000 9px,#0000 10px);mask-size:13px 9.5px;mask-position:center;mask-repeat:space;mask-composite:add,add,intersect}:host [data-dotquilt-dissolve] circle{r:calc(var(--dotquilt-dot-size,4.4px)/2)}:host [data-dotquilt-dissolve] pattern>rect{transform-box:fill-box;transform-origin:center}:host(dotquilt-skeleton-text) [data-dotquilt-dissolve] > svg{border-radius:999px}:host([hidden]){display:none}:host > svg{position:absolute;inset:0;width:100%;height:100%;fill:var(--dotquilt-color,light-dark(#6e7889,#a3afc2))}@media(forced-colors:none){:host([data-custom]) .surface{visibility:hidden}}@media(hover:hover) and (pointer:fine){:host([pointer-response=lift][data-pointer]) .lift{opacity:0.9}}@media(forced-colors:active){:host .surface{border:1px dotted CanvasText}:host .pulse,:host .lift,:host > svg{display:none}}
|
|
2
|
+
:host(:state(unstyled)) > :not(slot){display:none!important}
|
|
3
|
+
:host{width:2.5rem;height:auto;aspect-ratio:1;border-radius:50%;mask:radial-gradient(closest-side,#000 calc(100% - var(--dotquilt-dot-size,4.4px)*.7),#0000)}@media(forced-colors:active){:host{mask:none}}
|
|
4
|
+
dotquilt-skeleton-circle:is(:not(:defined),:state(unstyled)){display:block;width:2.5rem;aspect-ratio:1;position:relative;border-radius:50%;overflow:hidden;mask:radial-gradient(closest-side,#000 calc(100% - var(--dotquilt-dot-size,4.4px)*.7),#0000)}@media(forced-colors:active){dotquilt-skeleton-circle:is(:not(:defined),:state(unstyled)){mask:none}}dotquilt-skeleton-circle:is(:not(:defined),:state(unstyled)) [data-dotquilt-static]{display:block;position:absolute;inset:0;--s:var(--dotquilt-dot-size,4.4px);--g:calc(var(--s) + var(--dotquilt-dot-gap,4.6px));background:radial-gradient(circle,var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) calc(var(--s)/2 - .5px),#0000 calc(var(--s)/2 + .5px)) center/var(--g) var(--g) space;opacity:0.37}@media(forced-colors:active){dotquilt-skeleton-circle:is(:not(:defined),:state(unstyled)) [data-dotquilt-static]{border:1px dotted CanvasText}}
|
|
5
|
+
dotquilt-skeleton-circle:is(:not(:defined),:state(unstyled))[hidden]{display:none}
|
|
6
|
+
dotquilt-skeleton-circle:is(:not(:defined),:state(unstyled))[mark=square] [data-dotquilt-static]{background:var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) center/8.5px 8.5px space;mask:linear-gradient(#0000 1.75px,#000 2.75px,#000 5.75px,#0000 6.75px),linear-gradient(90deg,#0000 1.75px,#000 2.75px,#000 5.75px,#0000 6.75px);mask-size:8.5px 8.5px;mask-position:center;mask-repeat:space;mask-composite:intersect}dotquilt-skeleton-circle:is(:not(:defined),:state(unstyled))[mark=dash] [data-dotquilt-static]{background:var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) center/13px 9.5px space;mask:radial-gradient(circle at 3.5px 4.75px,#000 1.2px,#0000 2.2px),radial-gradient(circle at 9.5px 4.75px,#000 1.2px,#0000 2.2px),linear-gradient(#0000 2.55px,#000 3.55px,#000 5.95px,#0000 6.95px),linear-gradient(90deg,#0000 3px,#000 4px,#000 9px,#0000 10px);mask-size:13px 9.5px;mask-position:center;mask-repeat:space;mask-composite:add,add,intersect}
|
package/dist/host.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type ForwardedRef } from 'react';
|
|
2
|
+
import type { LoaderEvents } from './types.js';
|
|
3
|
+
type Host = HTMLElement & {
|
|
4
|
+
update(patch: object): void;
|
|
5
|
+
};
|
|
6
|
+
/** Commit-only property delivery. React owns its children; core owns presentation. */
|
|
7
|
+
export declare function useHost<E extends Host>(ref: ForwardedRef<E>, register: () => void, patch: object, events: LoaderEvents): import("react").RefObject<E | null>;
|
|
8
|
+
export {};
|
package/dist/host.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { useImperativeHandle, useLayoutEffect, useRef, } from 'react';
|
|
2
|
+
const names = {
|
|
3
|
+
'dotquilt-handoff-start': 'onHandoffStart',
|
|
4
|
+
'dotquilt-handoff-end': 'onHandoffEnd',
|
|
5
|
+
'dotquilt-handoff-cancel': 'onHandoffCancel',
|
|
6
|
+
'dotquilt-error': 'onLoaderError',
|
|
7
|
+
};
|
|
8
|
+
/** Commit-only property delivery. React owns its children; core owns presentation. */
|
|
9
|
+
export function useHost(ref, register, patch, events) {
|
|
10
|
+
const node = useRef(null);
|
|
11
|
+
const bridge = useRef(undefined);
|
|
12
|
+
useLayoutEffect(() => {
|
|
13
|
+
const host = node.current;
|
|
14
|
+
if (!host)
|
|
15
|
+
return;
|
|
16
|
+
let current = bridge.current;
|
|
17
|
+
if (!current || current.node !== host) {
|
|
18
|
+
const value = {
|
|
19
|
+
node: host,
|
|
20
|
+
events,
|
|
21
|
+
generation: 0,
|
|
22
|
+
listen(event) {
|
|
23
|
+
if (event.target !== host)
|
|
24
|
+
return;
|
|
25
|
+
const name = names[event.type];
|
|
26
|
+
const callback = value.events[name];
|
|
27
|
+
callback?.(event);
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
current = bridge.current = value;
|
|
31
|
+
for (const name of Object.keys(names))
|
|
32
|
+
host.addEventListener(name, value.listen);
|
|
33
|
+
}
|
|
34
|
+
current.events = events;
|
|
35
|
+
const generation = ++current.generation;
|
|
36
|
+
try {
|
|
37
|
+
if (!host.ownerDocument.defaultView?.customElements.get(host.localName))
|
|
38
|
+
for (const [key, value] of Object.entries(patch))
|
|
39
|
+
Reflect.set(host, key, value);
|
|
40
|
+
register();
|
|
41
|
+
host.update(patch);
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
host.dispatchEvent(new CustomEvent('dotquilt-error', {
|
|
45
|
+
bubbles: true,
|
|
46
|
+
composed: true,
|
|
47
|
+
detail: {
|
|
48
|
+
code: error && typeof error === 'object' && 'code' in error
|
|
49
|
+
? error.code
|
|
50
|
+
: 'registration-failed',
|
|
51
|
+
field: 'registration',
|
|
52
|
+
},
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
55
|
+
// Native disconnection emits cancellation synchronously during DOM removal.
|
|
56
|
+
// Strict Mode setup invalidates this deferred detach without duplicating listeners.
|
|
57
|
+
return () => queueMicrotask(() => {
|
|
58
|
+
if (current.generation !== generation)
|
|
59
|
+
return;
|
|
60
|
+
for (const name of Object.keys(names))
|
|
61
|
+
host.removeEventListener(name, current.listen);
|
|
62
|
+
if (bridge.current === current)
|
|
63
|
+
bridge.current = undefined;
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
useImperativeHandle(ref, () => node.current, []);
|
|
67
|
+
return node;
|
|
68
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { ChartLoader, type ChartLoaderProps } from './chart.js';
|
|
2
|
+
export { LoadingRegion, type LoadingRegionProps } from './region.js';
|
|
3
|
+
export { SkeletonBlock, type SkeletonBlockProps } from './skeleton.js';
|
|
4
|
+
export type { SkeletonCircleProps, SkeletonLineProps, SkeletonTextProps, } from './skeleton-shapes.js';
|
|
5
|
+
export { SkeletonCircle, SkeletonLine, SkeletonText, } from './skeleton-shapes.js';
|
|
6
|
+
export { TableLoader, type TableLoaderProps } from './table.js';
|
|
7
|
+
export { TextLoader, type TextLoaderProps } from './text.js';
|
|
8
|
+
export type { DotquiltStyle, HandoffDetail, LoaderErrorDetail, LoaderEvents, LoadingState, Mark, Motion, StylePolicy, Timing, } from './types.js';
|
|
9
|
+
export type { TypingDotsProps } from './typing.js';
|
|
10
|
+
export { TypingDots } from './typing.js';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
export { ChartLoader } from './chart.js';
|
|
3
|
+
export { LoadingRegion } from './region.js';
|
|
4
|
+
export { SkeletonBlock } from './skeleton.js';
|
|
5
|
+
export { SkeletonCircle, SkeletonLine, SkeletonText, } from './skeleton-shapes.js';
|
|
6
|
+
export { TableLoader } from './table.js';
|
|
7
|
+
export { TextLoader } from './text.js';
|
|
8
|
+
export { TypingDots } from './typing.js';
|
package/dist/line.css
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
:host{display:block;width:100%;height:1em;position:relative;border-radius:var(--dotquilt-radius,.375rem);overflow:hidden}:host .surface{position:absolute;inset:0;--s:var(--dotquilt-dot-size,4.4px);--g:calc(var(--s) + var(--dotquilt-dot-gap,4.6px));background:radial-gradient(circle,var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) calc(var(--s)/2 - .5px),#0000 calc(var(--s)/2 + .5px)) center/var(--g) var(--g) space;opacity:0.37}:host .pulse{position:absolute;inset:0;--dotquilt-color:var(--dotquilt-accent-color,light-dark(#4f8f93,#8dc4c5));opacity:0;mask:linear-gradient(104deg,#0000 12.5%,#00000005 18.75%,#0000001b 26.56%,#0000005e 34.38%,#000000c7 42.19%,#000 50%,#000000c7 57.81%,#0000005e 65.63%,#0000001b 73.44%,#00000005 81.25%,#0000 87.5%) 0 0/128% 100% no-repeat}:host .pulse>.surface,:host .lift>.surface{opacity:1}:host .lift{position:absolute;inset:0;--dotquilt-color:var(--dotquilt-accent-color,light-dark(#4f8f93,#8dc4c5));opacity:0;mask:radial-gradient(circle 56px at var(--dotquilt-pointer-x,-999px) var(--dotquilt-pointer-y,-999px),#000,#0000);transition:opacity .32s cubic-bezier(.22,1,.36,1)}:host([mark=square]) .surface{background:var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) center/8.5px 8.5px space;mask:linear-gradient(#0000 1.75px,#000 2.75px,#000 5.75px,#0000 6.75px),linear-gradient(90deg,#0000 1.75px,#000 2.75px,#000 5.75px,#0000 6.75px);mask-size:8.5px 8.5px;mask-position:center;mask-repeat:space;mask-composite:intersect}:host([mark=dash]) .surface{background:var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) center/13px 9.5px space;mask:radial-gradient(circle at 3.5px 4.75px,#000 1.2px,#0000 2.2px),radial-gradient(circle at 9.5px 4.75px,#000 1.2px,#0000 2.2px),linear-gradient(#0000 2.55px,#000 3.55px,#000 5.95px,#0000 6.95px),linear-gradient(90deg,#0000 3px,#000 4px,#000 9px,#0000 10px);mask-size:13px 9.5px;mask-position:center;mask-repeat:space;mask-composite:add,add,intersect}:host [data-dotquilt-dissolve] circle{r:calc(var(--dotquilt-dot-size,4.4px)/2)}:host [data-dotquilt-dissolve] pattern>rect{transform-box:fill-box;transform-origin:center}:host(dotquilt-skeleton-text) [data-dotquilt-dissolve] > svg{border-radius:999px}:host([hidden]){display:none}:host > svg{position:absolute;inset:0;width:100%;height:100%;fill:var(--dotquilt-color,light-dark(#6e7889,#a3afc2))}@media(forced-colors:none){:host([data-custom]) .surface{visibility:hidden}}@media(hover:hover) and (pointer:fine){:host([pointer-response=lift][data-pointer]) .lift{opacity:0.9}}@media(forced-colors:active){:host .surface{border:1px dotted CanvasText}:host .pulse,:host .lift,:host > svg{display:none}}
|
|
2
|
+
:host(:state(unstyled)) > :not(slot){display:none!important}
|
|
3
|
+
:host{height:calc(2*(var(--dotquilt-dot-size,4.4px) + var(--dotquilt-dot-gap,4.6px)));border-radius:999px}:host .surface{--s:var(--dotquilt-dot-size,4.4px);--g:calc(var(--s) + var(--dotquilt-dot-gap,4.6px));background:radial-gradient(circle,var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) calc(var(--s)/2 - .5px),#0000 calc(var(--s)/2 + .5px)) 0 0/var(--g) var(--g)}:host([mark=square]) .surface{background:var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) 0 0/8.5px 8.5px repeat;mask:linear-gradient(#0000 1.75px,#000 2.75px,#000 5.75px,#0000 6.75px),linear-gradient(90deg,#0000 1.75px,#000 2.75px,#000 5.75px,#0000 6.75px);mask-size:8.5px 8.5px;mask-position:0 0;mask-repeat:repeat;mask-composite:intersect}:host([mark=dash]) .surface{background:var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) 0 0/13px 9.5px repeat;mask:radial-gradient(circle at 3.5px 4.75px,#000 1.2px,#0000 2.2px),radial-gradient(circle at 9.5px 4.75px,#000 1.2px,#0000 2.2px),linear-gradient(#0000 2.55px,#000 3.55px,#000 5.95px,#0000 6.95px),linear-gradient(90deg,#0000 3px,#000 4px,#000 9px,#0000 10px);mask-size:13px 9.5px;mask-position:0 0;mask-repeat:repeat;mask-composite:add,add,intersect}:host([mark=square]){height:17px}:host([mark=dash]){height:19px}@supports (width:round(down,1px,1px)){@media(forced-colors:none){:host .surface{mask:linear-gradient(#000 0 0) 0/round(down,100%,var(--g)) no-repeat}:host([mark=square]) .surface{mask-image:linear-gradient(#000 0 0),linear-gradient(#0000 1.75px,#000 2.75px,#000 5.75px,#0000 6.75px),linear-gradient(90deg,#0000 1.75px,#000 2.75px,#000 5.75px,#0000 6.75px);mask-size:round(down,100%,8.5px),8.5px 8.5px,8.5px 8.5px;mask-position:0,0 0,0 0;mask-repeat:no-repeat,repeat,repeat;mask-composite:intersect,intersect}:host([mark=dash]) .surface{mask-image:linear-gradient(#000 0 0),radial-gradient(circle at 3.5px 4.75px,#000 1.2px,#0000 2.2px),radial-gradient(circle at 9.5px 4.75px,#000 1.2px,#0000 2.2px),linear-gradient(#0000 2.55px,#000 3.55px,#000 5.95px,#0000 6.95px),linear-gradient(90deg,#0000 3px,#000 4px,#000 9px,#0000 10px);mask-size:round(down,100%,13px),13px 9.5px,13px 9.5px,13px 9.5px,13px 9.5px;mask-position:0,0 0,0 0,0 0,0 0;mask-repeat:no-repeat,repeat,repeat,repeat,repeat;mask-composite:intersect,add,add,intersect}}}
|
|
4
|
+
dotquilt-skeleton-line:is(:not(:defined),:state(unstyled)){display:block;width:100%;height:calc(2*(var(--dotquilt-dot-size,4.4px) + var(--dotquilt-dot-gap,4.6px)));position:relative;border-radius:999px;overflow:hidden}dotquilt-skeleton-line:is(:not(:defined),:state(unstyled)) [data-dotquilt-static]{display:block;position:absolute;inset:0;--s:var(--dotquilt-dot-size,4.4px);--g:calc(var(--s) + var(--dotquilt-dot-gap,4.6px));background:radial-gradient(circle,var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) calc(var(--s)/2 - .5px),#0000 calc(var(--s)/2 + .5px)) 0 0/var(--g) var(--g);opacity:0.37}@media(forced-colors:active){dotquilt-skeleton-line:is(:not(:defined),:state(unstyled)) [data-dotquilt-static]{border:1px dotted CanvasText}}@supports (width:round(down,1px,1px)){@media(forced-colors:none){dotquilt-skeleton-line:is(:not(:defined),:state(unstyled)) [data-dotquilt-static]{mask:linear-gradient(#000 0 0) 0/round(down,100%,var(--g)) no-repeat}}}
|
|
5
|
+
dotquilt-skeleton-line:is(:not(:defined),:state(unstyled))[hidden]{display:none}
|
|
6
|
+
dotquilt-skeleton-line:is(:not(:defined),:state(unstyled))[mark=square] [data-dotquilt-static]{background:var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) 0 0/8.5px 8.5px repeat;mask:linear-gradient(#0000 1.75px,#000 2.75px,#000 5.75px,#0000 6.75px),linear-gradient(90deg,#0000 1.75px,#000 2.75px,#000 5.75px,#0000 6.75px);mask-size:8.5px 8.5px;mask-position:0 0;mask-repeat:repeat;mask-composite:intersect}dotquilt-skeleton-line:is(:not(:defined),:state(unstyled))[mark=dash] [data-dotquilt-static]{background:var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) 0 0/13px 9.5px repeat;mask:radial-gradient(circle at 3.5px 4.75px,#000 1.2px,#0000 2.2px),radial-gradient(circle at 9.5px 4.75px,#000 1.2px,#0000 2.2px),linear-gradient(#0000 2.55px,#000 3.55px,#000 5.95px,#0000 6.95px),linear-gradient(90deg,#0000 3px,#000 4px,#000 9px,#0000 10px);mask-size:13px 9.5px;mask-position:0 0;mask-repeat:repeat;mask-composite:add,add,intersect}dotquilt-skeleton-line:is(:not(:defined),:state(unstyled))[mark=square]{height:17px}dotquilt-skeleton-line:is(:not(:defined),:state(unstyled))[mark=dash]{height:19px}@supports (width:round(down,1px,1px)){@media(forced-colors:none){dotquilt-skeleton-line:is(:not(:defined),:state(unstyled))[mark=square] [data-dotquilt-static]{mask-image:linear-gradient(#000 0 0),linear-gradient(#0000 1.75px,#000 2.75px,#000 5.75px,#0000 6.75px),linear-gradient(90deg,#0000 1.75px,#000 2.75px,#000 5.75px,#0000 6.75px);mask-size:round(down,100%,8.5px),8.5px 8.5px,8.5px 8.5px;mask-position:0,0 0,0 0;mask-repeat:no-repeat,repeat,repeat;mask-composite:intersect,intersect}dotquilt-skeleton-line:is(:not(:defined),:state(unstyled))[mark=dash] [data-dotquilt-static]{mask-image:linear-gradient(#000 0 0),radial-gradient(circle at 3.5px 4.75px,#000 1.2px,#0000 2.2px),radial-gradient(circle at 9.5px 4.75px,#000 1.2px,#0000 2.2px),linear-gradient(#0000 2.55px,#000 3.55px,#000 5.95px,#0000 6.95px),linear-gradient(90deg,#0000 3px,#000 4px,#000 9px,#0000 10px);mask-size:round(down,100%,13px),13px 9.5px,13px 9.5px,13px 9.5px,13px 9.5px;mask-position:0,0 0,0 0,0 0,0 0;mask-repeat:no-repeat,repeat,repeat,repeat,repeat;mask-composite:intersect,add,add,intersect}}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const reactRegionStyles: readonly string[];
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// Its own module, with nothing built at load time: the region component takes
|
|
2
|
+
// it without the skeleton and text styles that server.ts builds.
|
|
3
|
+
export const reactRegionStyles =
|
|
4
|
+
/* @__PURE__ */ Object.freeze([
|
|
5
|
+
'dotquilt-region:is(:not(:defined),:state(unstyled)){display:flow-root;position:relative}dotquilt-region:is(:not(:defined),:state(unstyled))[hidden]{display:none}dotquilt-region:is(:not(:defined),:state(unstyled))>[data-dotquilt-react-slot]{position:absolute;inset:0;pointer-events:none}dotquilt-region:is(:not(:defined),:state(unstyled)):not([state=pending])>[slot=placeholder],dotquilt-region:is(:not(:defined),:state(unstyled)):not([state=refreshing])>[slot=refresh-indicator]{display:none}dotquilt-region:is(:not(:defined),:state(unstyled))[state=pending][data-dotquilt-react-empty]::before{content:"";position:absolute;inset:0;min-height:1em;border:1px dotted currentColor}',
|
|
6
|
+
]);
|
package/dist/region.css
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
dotquilt-region:state(unstyled)::part(placeholder),dotquilt-region:state(unstyled)::part(refresh-indicator){visibility:hidden;pointer-events:none}dotquilt-region:state(unstyled)[data-presentation=pending]::part(placeholder),dotquilt-region:state(unstyled)[data-presentation=handoff]::part(placeholder),dotquilt-region:state(unstyled)[data-presentation=refreshing]::part(refresh-indicator){visibility:inherit}dotquilt-region:state(unstyled)[data-presentation=pending]::part(content){visibility:hidden}:host{display:grid;position:relative}:host(:focus){outline:none}:host(:focus-visible:not([data-dotquilt-focus=pointer])),:host([data-dotquilt-focus=""]:focus){outline:2px solid currentColor;outline-offset:3px}:host .f{display:grid;min-width:0;min-height:100%}:host [part]{display:block;grid-area:1/1;min-width:0}:host .p,:host .r{visibility:hidden;pointer-events:none}:host([data-presentation=pending]) .p,:host([data-presentation=handoff]) .p,:host([data-presentation=refreshing]) .r{visibility:inherit}:host([data-presentation=pending]) .c{visibility:hidden}:host([hidden]){display:none}:host > svg{position:absolute;inset:0;pointer-events:none}:host .fallback{display:block;min-height:1em;border:1px dotted currentColor}:host([data-dotquilt-waiting]) .p{visibility:hidden}.thread{position:absolute;inset:auto 0 calc(100% + var(--dotquilt-refresh-gap,6px));height:var(--s);--s:var(--dotquilt-dot-size,4.4px);background:radial-gradient(circle closest-side,var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) 75%,#0000) 0/calc(var(--s) + var(--dotquilt-dot-gap,4.6px)) space no-repeat;opacity:0.37}.glow{--dotquilt-color:var(--dotquilt-accent-color,light-dark(#4f8f93,#8dc4c5));opacity:0.9;mask:linear-gradient(90deg,#0000,#000,#0000) -70%/40% no-repeat}@media(forced-colors:active){.thread{background:none;border-top:1px dotted;opacity:1}.glow{display:none}}
|
|
2
|
+
dotquilt-region:is(:not(:defined),:state(unstyled)){display:flow-root;position:relative}dotquilt-region:is(:not(:defined),:state(unstyled))[hidden]{display:none}dotquilt-region:is(:not(:defined),:state(unstyled))>[data-dotquilt-react-slot]{position:absolute;inset:0;pointer-events:none}dotquilt-region:is(:not(:defined),:state(unstyled)):not([state=pending])>[slot=placeholder],dotquilt-region:is(:not(:defined),:state(unstyled)):not([state=refreshing])>[slot=refresh-indicator]{display:none}dotquilt-region:is(:not(:defined),:state(unstyled))[state=pending][data-dotquilt-react-empty]::before{content:"";position:absolute;inset:0;min-height:1em;border:1px dotted currentColor}
|
package/dist/region.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Animations, LoadingState, RevealTarget, Timing } from 'dotquilt';
|
|
2
|
+
import { type LoadingRegion as NativeLoadingRegion, type RegionPreset } from 'dotquilt/region';
|
|
3
|
+
import { type ReactNode } from 'react';
|
|
4
|
+
import type { HostProps } from './types.js';
|
|
5
|
+
export interface LoadingRegionProps extends Omit<HostProps<NativeLoadingRegion>, 'mark'> {
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
placeholder?: ReactNode;
|
|
8
|
+
refreshIndicator?: ReactNode;
|
|
9
|
+
state?: LoadingState | undefined;
|
|
10
|
+
cycle?: string | undefined;
|
|
11
|
+
/** Milliseconds to wait before showing the placeholder. */
|
|
12
|
+
delay?: number | undefined;
|
|
13
|
+
/** Milliseconds a placeholder stays once shown. */
|
|
14
|
+
minDisplay?: number | undefined;
|
|
15
|
+
timing?: Timing | undefined;
|
|
16
|
+
animations?: Pick<Animations<'region'>, 'handoff'> | undefined;
|
|
17
|
+
preset?: RegionPreset | undefined;
|
|
18
|
+
revealTargets?: readonly RevealTarget[] | undefined;
|
|
19
|
+
}
|
|
20
|
+
export declare const LoadingRegion: import("react").ForwardRefExoticComponent<LoadingRegionProps & import("react").RefAttributes<NativeLoadingRegion>>;
|
|
21
|
+
export type { DotquiltStyle, LoaderEvents, LoadingState, Motion, StylePolicy, Timing, } from './types.js';
|
package/dist/region.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { registerLoadingRegion, } from 'dotquilt/region';
|
|
4
|
+
import { Children, forwardRef, useState } from 'react';
|
|
5
|
+
import { useHost } from './host.js';
|
|
6
|
+
import { reactRegionStyles } from './region-styles.js';
|
|
7
|
+
import { initialPolicy, policyAttributes, sheet, useStyleNonce, } from './static.js';
|
|
8
|
+
export const LoadingRegion = /* @__PURE__ */ forwardRef(function LoadingRegion({ children, placeholder, refreshIndicator, state = 'ready', cycle, delay, minDisplay, timing, animations, preset, revealTargets, stylePolicy, motion, onHandoffStart, onHandoffEnd, onHandoffCancel, onLoaderError, ...attributes }, ref) {
|
|
9
|
+
const [initial] = useState(() => ({
|
|
10
|
+
policy: initialPolicy(stylePolicy),
|
|
11
|
+
state,
|
|
12
|
+
}));
|
|
13
|
+
const nonce = useStyleNonce(initial.policy, 'region');
|
|
14
|
+
const host = useHost(ref, registerLoadingRegion, {
|
|
15
|
+
state,
|
|
16
|
+
cycle,
|
|
17
|
+
delay,
|
|
18
|
+
minDisplay,
|
|
19
|
+
timing,
|
|
20
|
+
animations,
|
|
21
|
+
preset,
|
|
22
|
+
revealTargets,
|
|
23
|
+
motion,
|
|
24
|
+
stylePolicy: stylePolicy ?? initial.policy,
|
|
25
|
+
}, { onHandoffStart, onHandoffEnd, onHandoffCancel, onLoaderError });
|
|
26
|
+
const hasPlaceholder = Children.toArray(placeholder).length > 0;
|
|
27
|
+
const slot = (name, content) => (_jsx("div", { slot: name, "data-dotquilt-react-slot": "", "aria-hidden": true, inert: true, children: content }));
|
|
28
|
+
return (_jsxs(_Fragment, { children: [sheet(reactRegionStyles, initial.policy, 'region', nonce), _jsxs("dotquilt-region", { ...attributes, ...policyAttributes(initial.policy, nonce), role: attributes.role ?? 'group', state: initial.state, "data-presentation": initial.state, motion: "paused", ref: host, "data-dotquilt-react-empty": !hasPlaceholder ? '' : undefined, children: [hasPlaceholder ? slot('placeholder', placeholder) : null, refreshIndicator !== undefined
|
|
29
|
+
? slot('refresh-indicator', refreshIndicator)
|
|
30
|
+
: null, children] })] }));
|
|
31
|
+
});
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const reactTextStyles: readonly string[];
|
|
2
|
+
/**
|
|
3
|
+
* Static appearance only. These exact strings can be authorized by CSP hashes.
|
|
4
|
+
* They apply before definition and while the host's external stylesheet loads
|
|
5
|
+
* (`:state(unstyled)`); browsers without custom states ignore that part.
|
|
6
|
+
*/
|
|
7
|
+
export declare const reactSkeletonStyles: readonly string[];
|
|
8
|
+
export { reactRegionStyles } from './region-styles.js';
|
|
9
|
+
export declare const reactLineStyles: readonly string[];
|
|
10
|
+
export declare const reactCircleStyles: readonly string[];
|
|
11
|
+
export declare const reactTextSkeletonStyles: readonly string[];
|
|
12
|
+
export declare const reactTypingStyles: readonly string[];
|
|
13
|
+
export { staticChartStyles as reactChartStyles, staticTableStyles as reactTableStyles, } from 'dotquilt/server';
|
|
14
|
+
export declare const reactSkeletonMarkStyles: readonly string[];
|
|
15
|
+
export declare const reactLineMarkStyles: readonly string[];
|
|
16
|
+
export declare const reactCircleMarkStyles: readonly string[];
|
|
17
|
+
export declare const reactTextSkeletonMarkStyles: readonly string[];
|
|
18
|
+
export declare const reactTypingMarkStyles: readonly string[];
|
|
19
|
+
export declare const reactChartMarkStyles: readonly string[];
|
|
20
|
+
export declare const reactTextMarkStyles: readonly string[];
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { staticSkeletonStyles, staticTextLoaderStyles } from 'dotquilt/server';
|
|
2
|
+
export const reactTextStyles = staticTextLoaderStyles;
|
|
3
|
+
/**
|
|
4
|
+
* Static appearance only. These exact strings can be authorized by CSP hashes.
|
|
5
|
+
* They apply before definition and while the host's external stylesheet loads
|
|
6
|
+
* (`:state(unstyled)`); browsers without custom states ignore that part.
|
|
7
|
+
*/
|
|
8
|
+
export const reactSkeletonStyles =
|
|
9
|
+
/* @__PURE__ */ Object.freeze([
|
|
10
|
+
`${staticSkeletonStyles
|
|
11
|
+
.join('\n')
|
|
12
|
+
.replaceAll('dotquilt-skeleton-block', 'dotquilt-skeleton-block:is(:not(:defined),:state(unstyled))')}dotquilt-skeleton-block:is(:not(:defined),:state(unstyled))[hidden]{display:none}`,
|
|
13
|
+
]);
|
|
14
|
+
export { reactRegionStyles } from './region-styles.js';
|
|
15
|
+
import { staticCircleStyles, staticLineStyles, staticTextStyles, staticTypingStyles, } from 'dotquilt/server';
|
|
16
|
+
function beforeDefinition(css, tag) {
|
|
17
|
+
return Object.freeze(css
|
|
18
|
+
.map((text) => text.replaceAll(tag, `${tag}:is(:not(:defined),:state(unstyled))`))
|
|
19
|
+
.concat(`${tag}:is(:not(:defined),:state(unstyled))[hidden]{display:none}`));
|
|
20
|
+
}
|
|
21
|
+
export const reactLineStyles = /* @__PURE__ */ beforeDefinition(staticLineStyles, 'dotquilt-skeleton-line');
|
|
22
|
+
export const reactCircleStyles = /* @__PURE__ */ beforeDefinition(staticCircleStyles, 'dotquilt-skeleton-circle');
|
|
23
|
+
export const reactTextSkeletonStyles = /* @__PURE__ */ beforeDefinition(staticTextStyles, 'dotquilt-skeleton-text');
|
|
24
|
+
export const reactTypingStyles = /* @__PURE__ */ beforeDefinition(
|
|
25
|
+
// The inert React-owned wrapper must not introduce a second inline baseline.
|
|
26
|
+
/* @__PURE__ */ staticTypingStyles.concat('dotquilt-typing-dots [data-dotquilt-react-static]{display:contents}'), 'dotquilt-typing-dots');
|
|
27
|
+
export { staticChartStyles as reactChartStyles, staticTableStyles as reactTableStyles, } from 'dotquilt/server';
|
|
28
|
+
import { staticChartMarkStyles, staticCircleMarkStyles, staticLineMarkStyles, staticSkeletonMarkStyles, staticTextLoaderMarkStyles, staticTextMarkStyles, staticTypingMarkStyles, } from 'dotquilt/server';
|
|
29
|
+
/**
|
|
30
|
+
* Static rules for squares and dashes. A component adds them only when it
|
|
31
|
+
* draws one, so pages that keep the default dot don't carry them.
|
|
32
|
+
*/
|
|
33
|
+
function marksBeforeDefinition(css, tag) {
|
|
34
|
+
return Object.freeze(css.map((text) => text.replaceAll(tag, `${tag}:is(:not(:defined),:state(unstyled))`)));
|
|
35
|
+
}
|
|
36
|
+
export const reactSkeletonMarkStyles = /* @__PURE__ */ marksBeforeDefinition(staticSkeletonMarkStyles, 'dotquilt-skeleton-block');
|
|
37
|
+
export const reactLineMarkStyles = /* @__PURE__ */ marksBeforeDefinition(staticLineMarkStyles, 'dotquilt-skeleton-line');
|
|
38
|
+
export const reactCircleMarkStyles = /* @__PURE__ */ marksBeforeDefinition(staticCircleMarkStyles, 'dotquilt-skeleton-circle');
|
|
39
|
+
export const reactTextSkeletonMarkStyles =
|
|
40
|
+
/* @__PURE__ */ marksBeforeDefinition(staticTextMarkStyles, 'dotquilt-skeleton-text');
|
|
41
|
+
export const reactTypingMarkStyles = /* @__PURE__ */ marksBeforeDefinition(staticTypingMarkStyles, 'dotquilt-typing-dots');
|
|
42
|
+
// These already apply only before definition.
|
|
43
|
+
export const reactChartMarkStyles = staticChartMarkStyles;
|
|
44
|
+
export const reactTextMarkStyles = staticTextLoaderMarkStyles;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
:host{display:block;width:100%;height:1em;position:relative;border-radius:var(--dotquilt-radius,.375rem);overflow:hidden}:host .surface{position:absolute;inset:0;--s:var(--dotquilt-dot-size,4.4px);--g:calc(var(--s) + var(--dotquilt-dot-gap,4.6px));background:radial-gradient(circle,var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) calc(var(--s)/2 - .5px),#0000 calc(var(--s)/2 + .5px)) center/var(--g) var(--g) space;opacity:0.37}:host .pulse{position:absolute;inset:0;--dotquilt-color:var(--dotquilt-accent-color,light-dark(#4f8f93,#8dc4c5));opacity:0;mask:linear-gradient(104deg,#0000 12.5%,#00000005 18.75%,#0000001b 26.56%,#0000005e 34.38%,#000000c7 42.19%,#000 50%,#000000c7 57.81%,#0000005e 65.63%,#0000001b 73.44%,#00000005 81.25%,#0000 87.5%) 0 0/128% 100% no-repeat}:host .pulse>.surface,:host .lift>.surface{opacity:1}:host .lift{position:absolute;inset:0;--dotquilt-color:var(--dotquilt-accent-color,light-dark(#4f8f93,#8dc4c5));opacity:0;mask:radial-gradient(circle 56px at var(--dotquilt-pointer-x,-999px) var(--dotquilt-pointer-y,-999px),#000,#0000);transition:opacity .32s cubic-bezier(.22,1,.36,1)}:host([mark=square]) .surface{background:var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) center/8.5px 8.5px space;mask:linear-gradient(#0000 1.75px,#000 2.75px,#000 5.75px,#0000 6.75px),linear-gradient(90deg,#0000 1.75px,#000 2.75px,#000 5.75px,#0000 6.75px);mask-size:8.5px 8.5px;mask-position:center;mask-repeat:space;mask-composite:intersect}:host([mark=dash]) .surface{background:var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) center/13px 9.5px space;mask:radial-gradient(circle at 3.5px 4.75px,#000 1.2px,#0000 2.2px),radial-gradient(circle at 9.5px 4.75px,#000 1.2px,#0000 2.2px),linear-gradient(#0000 2.55px,#000 3.55px,#000 5.95px,#0000 6.95px),linear-gradient(90deg,#0000 3px,#000 4px,#000 9px,#0000 10px);mask-size:13px 9.5px;mask-position:center;mask-repeat:space;mask-composite:add,add,intersect}:host [data-dotquilt-dissolve] circle{r:calc(var(--dotquilt-dot-size,4.4px)/2)}:host [data-dotquilt-dissolve] pattern>rect{transform-box:fill-box;transform-origin:center}:host(dotquilt-skeleton-text) [data-dotquilt-dissolve] > svg{border-radius:999px}:host([hidden]){display:none}:host > svg{position:absolute;inset:0;width:100%;height:100%;fill:var(--dotquilt-color,light-dark(#6e7889,#a3afc2))}@media(forced-colors:none){:host([data-custom]) .surface{visibility:hidden}}@media(hover:hover) and (pointer:fine){:host([pointer-response=lift][data-pointer]) .lift{opacity:0.9}}@media(forced-colors:active){:host .surface{border:1px dotted CanvasText}:host .pulse,:host .lift,:host > svg{display:none}}
|
|
2
|
+
:host(:state(unstyled)) > :not(slot){display:none!important}
|
|
3
|
+
:host(dotquilt-skeleton-line){height:calc(2*(var(--dotquilt-dot-size,4.4px) + var(--dotquilt-dot-gap,4.6px)));border-radius:999px}:host(dotquilt-skeleton-line) .surface{--s:var(--dotquilt-dot-size,4.4px);--g:calc(var(--s) + var(--dotquilt-dot-gap,4.6px));background:radial-gradient(circle,var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) calc(var(--s)/2 - .5px),#0000 calc(var(--s)/2 + .5px)) 0 0/var(--g) var(--g)}:host(dotquilt-skeleton-line[mark=square]) .surface{background:var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) 0 0/8.5px 8.5px repeat;mask:linear-gradient(#0000 1.75px,#000 2.75px,#000 5.75px,#0000 6.75px),linear-gradient(90deg,#0000 1.75px,#000 2.75px,#000 5.75px,#0000 6.75px);mask-size:8.5px 8.5px;mask-position:0 0;mask-repeat:repeat;mask-composite:intersect}:host(dotquilt-skeleton-line[mark=dash]) .surface{background:var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) 0 0/13px 9.5px repeat;mask:radial-gradient(circle at 3.5px 4.75px,#000 1.2px,#0000 2.2px),radial-gradient(circle at 9.5px 4.75px,#000 1.2px,#0000 2.2px),linear-gradient(#0000 2.55px,#000 3.55px,#000 5.95px,#0000 6.95px),linear-gradient(90deg,#0000 3px,#000 4px,#000 9px,#0000 10px);mask-size:13px 9.5px;mask-position:0 0;mask-repeat:repeat;mask-composite:add,add,intersect}:host(dotquilt-skeleton-line[mark=square]){height:17px}:host(dotquilt-skeleton-line[mark=dash]){height:19px}@supports (width:round(down,1px,1px)){@media(forced-colors:none){:host(dotquilt-skeleton-line) .surface{mask:linear-gradient(#000 0 0) 0/round(down,100%,var(--g)) no-repeat}:host(dotquilt-skeleton-line[mark=square]) .surface{mask-image:linear-gradient(#000 0 0),linear-gradient(#0000 1.75px,#000 2.75px,#000 5.75px,#0000 6.75px),linear-gradient(90deg,#0000 1.75px,#000 2.75px,#000 5.75px,#0000 6.75px);mask-size:round(down,100%,8.5px),8.5px 8.5px,8.5px 8.5px;mask-position:0,0 0,0 0;mask-repeat:no-repeat,repeat,repeat;mask-composite:intersect,intersect}:host(dotquilt-skeleton-line[mark=dash]) .surface{mask-image:linear-gradient(#000 0 0),radial-gradient(circle at 3.5px 4.75px,#000 1.2px,#0000 2.2px),radial-gradient(circle at 9.5px 4.75px,#000 1.2px,#0000 2.2px),linear-gradient(#0000 2.55px,#000 3.55px,#000 5.95px,#0000 6.95px),linear-gradient(90deg,#0000 3px,#000 4px,#000 9px,#0000 10px);mask-size:round(down,100%,13px),13px 9.5px,13px 9.5px,13px 9.5px,13px 9.5px;mask-position:0,0 0,0 0,0 0,0 0;mask-repeat:no-repeat,repeat,repeat,repeat,repeat;mask-composite:intersect,add,add,intersect}}}
|
|
4
|
+
:host(dotquilt-skeleton-circle){width:2.5rem;height:auto;aspect-ratio:1;border-radius:50%;mask:radial-gradient(closest-side,#000 calc(100% - var(--dotquilt-dot-size,4.4px)*.7),#0000)}@media(forced-colors:active){:host(dotquilt-skeleton-circle){mask:none}}
|
|
5
|
+
:host(dotquilt-skeleton-text){height:auto;overflow:visible;display:grid;gap:.5em;border-radius:0}:host(dotquilt-skeleton-text) .lines{display:grid;gap:inherit}:host(dotquilt-skeleton-text) .lines:is(.pulse,.lift){position:absolute;inset:0}:host(dotquilt-skeleton-text) .line{box-sizing:border-box;height:calc(2*(var(--dotquilt-dot-size,4.4px) + var(--dotquilt-dot-gap,4.6px)));position:relative;border-radius:999px;overflow:hidden;--s:var(--dotquilt-dot-size,4.4px);--g:calc(var(--s) + var(--dotquilt-dot-gap,4.6px));background:radial-gradient(circle,var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) calc(var(--s)/2 - .5px),#0000 calc(var(--s)/2 + .5px)) 0 0/var(--g) var(--g)}:host(dotquilt-skeleton-text[mark=square]) .line{background:var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) 0 0/8.5px 8.5px repeat;mask:linear-gradient(#0000 1.75px,#000 2.75px,#000 5.75px,#0000 6.75px),linear-gradient(90deg,#0000 1.75px,#000 2.75px,#000 5.75px,#0000 6.75px);mask-size:8.5px 8.5px;mask-position:0 0;mask-repeat:repeat;mask-composite:intersect}:host(dotquilt-skeleton-text[mark=dash]) .line{background:var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) 0 0/13px 9.5px repeat;mask:radial-gradient(circle at 3.5px 4.75px,#000 1.2px,#0000 2.2px),radial-gradient(circle at 9.5px 4.75px,#000 1.2px,#0000 2.2px),linear-gradient(#0000 2.55px,#000 3.55px,#000 5.95px,#0000 6.95px),linear-gradient(90deg,#0000 3px,#000 4px,#000 9px,#0000 10px);mask-size:13px 9.5px;mask-position:0 0;mask-repeat:repeat;mask-composite:add,add,intersect}:host(dotquilt-skeleton-text[mark=square]) .line{height:17px}:host(dotquilt-skeleton-text[mark=dash]) .line{height:19px}@supports (width:round(down,1px,1px)){@media(forced-colors:none){:host(dotquilt-skeleton-text) .line{mask:linear-gradient(#000 0 0) 0/round(down,100%,var(--g)) no-repeat}:host(dotquilt-skeleton-text[mark=square]) .line{mask-image:linear-gradient(#000 0 0),linear-gradient(#0000 1.75px,#000 2.75px,#000 5.75px,#0000 6.75px),linear-gradient(90deg,#0000 1.75px,#000 2.75px,#000 5.75px,#0000 6.75px);mask-size:round(down,100%,8.5px),8.5px 8.5px,8.5px 8.5px;mask-position:0,0 0,0 0;mask-repeat:no-repeat,repeat,repeat;mask-composite:intersect,intersect}:host(dotquilt-skeleton-text[mark=dash]) .line{mask-image:linear-gradient(#000 0 0),radial-gradient(circle at 3.5px 4.75px,#000 1.2px,#0000 2.2px),radial-gradient(circle at 9.5px 4.75px,#000 1.2px,#0000 2.2px),linear-gradient(#0000 2.55px,#000 3.55px,#000 5.95px,#0000 6.95px),linear-gradient(90deg,#0000 3px,#000 4px,#000 9px,#0000 10px);mask-size:round(down,100%,13px),13px 9.5px,13px 9.5px,13px 9.5px,13px 9.5px;mask-position:0,0 0,0 0,0 0,0 0;mask-repeat:no-repeat,repeat,repeat,repeat,repeat;mask-composite:intersect,add,add,intersect}}}
|
|
6
|
+
dotquilt-skeleton-block:is(:not(:defined),:state(unstyled)){display:block;width:100%;height:1em;position:relative;border-radius:var(--dotquilt-radius,.375rem);overflow:hidden}dotquilt-skeleton-block:is(:not(:defined),:state(unstyled)) [data-dotquilt-static]{position:absolute;inset:0;--s:var(--dotquilt-dot-size,4.4px);--g:calc(var(--s) + var(--dotquilt-dot-gap,4.6px));background:radial-gradient(circle,var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) calc(var(--s)/2 - .5px),#0000 calc(var(--s)/2 + .5px)) center/var(--g) var(--g) space;opacity:0.37}@media(forced-colors:active){dotquilt-skeleton-block:is(:not(:defined),:state(unstyled)) [data-dotquilt-static]{border:1px dotted CanvasText}}dotquilt-skeleton-block:is(:not(:defined),:state(unstyled))[hidden]{display:none}
|
|
7
|
+
dotquilt-skeleton-block:is(:not(:defined),:state(unstyled))[mark=square] [data-dotquilt-static]{background:var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) center/8.5px 8.5px space;mask:linear-gradient(#0000 1.75px,#000 2.75px,#000 5.75px,#0000 6.75px),linear-gradient(90deg,#0000 1.75px,#000 2.75px,#000 5.75px,#0000 6.75px);mask-size:8.5px 8.5px;mask-position:center;mask-repeat:space;mask-composite:intersect}dotquilt-skeleton-block:is(:not(:defined),:state(unstyled))[mark=dash] [data-dotquilt-static]{background:var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) center/13px 9.5px space;mask:radial-gradient(circle at 3.5px 4.75px,#000 1.2px,#0000 2.2px),radial-gradient(circle at 9.5px 4.75px,#000 1.2px,#0000 2.2px),linear-gradient(#0000 2.55px,#000 3.55px,#000 5.95px,#0000 6.95px),linear-gradient(90deg,#0000 3px,#000 4px,#000 9px,#0000 10px);mask-size:13px 9.5px;mask-position:center;mask-repeat:space;mask-composite:add,add,intersect}
|
|
8
|
+
dotquilt-skeleton-line:is(:not(:defined),:state(unstyled)){display:block;width:100%;height:calc(2*(var(--dotquilt-dot-size,4.4px) + var(--dotquilt-dot-gap,4.6px)));position:relative;border-radius:999px;overflow:hidden}dotquilt-skeleton-line:is(:not(:defined),:state(unstyled)) [data-dotquilt-static]{display:block;position:absolute;inset:0;--s:var(--dotquilt-dot-size,4.4px);--g:calc(var(--s) + var(--dotquilt-dot-gap,4.6px));background:radial-gradient(circle,var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) calc(var(--s)/2 - .5px),#0000 calc(var(--s)/2 + .5px)) 0 0/var(--g) var(--g);opacity:0.37}@media(forced-colors:active){dotquilt-skeleton-line:is(:not(:defined),:state(unstyled)) [data-dotquilt-static]{border:1px dotted CanvasText}}@supports (width:round(down,1px,1px)){@media(forced-colors:none){dotquilt-skeleton-line:is(:not(:defined),:state(unstyled)) [data-dotquilt-static]{mask:linear-gradient(#000 0 0) 0/round(down,100%,var(--g)) no-repeat}}}
|
|
9
|
+
dotquilt-skeleton-line:is(:not(:defined),:state(unstyled))[hidden]{display:none}
|
|
10
|
+
dotquilt-skeleton-line:is(:not(:defined),:state(unstyled))[mark=square] [data-dotquilt-static]{background:var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) 0 0/8.5px 8.5px repeat;mask:linear-gradient(#0000 1.75px,#000 2.75px,#000 5.75px,#0000 6.75px),linear-gradient(90deg,#0000 1.75px,#000 2.75px,#000 5.75px,#0000 6.75px);mask-size:8.5px 8.5px;mask-position:0 0;mask-repeat:repeat;mask-composite:intersect}dotquilt-skeleton-line:is(:not(:defined),:state(unstyled))[mark=dash] [data-dotquilt-static]{background:var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) 0 0/13px 9.5px repeat;mask:radial-gradient(circle at 3.5px 4.75px,#000 1.2px,#0000 2.2px),radial-gradient(circle at 9.5px 4.75px,#000 1.2px,#0000 2.2px),linear-gradient(#0000 2.55px,#000 3.55px,#000 5.95px,#0000 6.95px),linear-gradient(90deg,#0000 3px,#000 4px,#000 9px,#0000 10px);mask-size:13px 9.5px;mask-position:0 0;mask-repeat:repeat;mask-composite:add,add,intersect}dotquilt-skeleton-line:is(:not(:defined),:state(unstyled))[mark=square]{height:17px}dotquilt-skeleton-line:is(:not(:defined),:state(unstyled))[mark=dash]{height:19px}@supports (width:round(down,1px,1px)){@media(forced-colors:none){dotquilt-skeleton-line:is(:not(:defined),:state(unstyled))[mark=square] [data-dotquilt-static]{mask-image:linear-gradient(#000 0 0),linear-gradient(#0000 1.75px,#000 2.75px,#000 5.75px,#0000 6.75px),linear-gradient(90deg,#0000 1.75px,#000 2.75px,#000 5.75px,#0000 6.75px);mask-size:round(down,100%,8.5px),8.5px 8.5px,8.5px 8.5px;mask-position:0,0 0,0 0;mask-repeat:no-repeat,repeat,repeat;mask-composite:intersect,intersect}dotquilt-skeleton-line:is(:not(:defined),:state(unstyled))[mark=dash] [data-dotquilt-static]{mask-image:linear-gradient(#000 0 0),radial-gradient(circle at 3.5px 4.75px,#000 1.2px,#0000 2.2px),radial-gradient(circle at 9.5px 4.75px,#000 1.2px,#0000 2.2px),linear-gradient(#0000 2.55px,#000 3.55px,#000 5.95px,#0000 6.95px),linear-gradient(90deg,#0000 3px,#000 4px,#000 9px,#0000 10px);mask-size:round(down,100%,13px),13px 9.5px,13px 9.5px,13px 9.5px,13px 9.5px;mask-position:0,0 0,0 0,0 0,0 0;mask-repeat:no-repeat,repeat,repeat,repeat,repeat;mask-composite:intersect,add,add,intersect}}}
|
|
11
|
+
dotquilt-skeleton-circle:is(:not(:defined),:state(unstyled)){display:block;width:2.5rem;aspect-ratio:1;position:relative;border-radius:50%;overflow:hidden;mask:radial-gradient(closest-side,#000 calc(100% - var(--dotquilt-dot-size,4.4px)*.7),#0000)}@media(forced-colors:active){dotquilt-skeleton-circle:is(:not(:defined),:state(unstyled)){mask:none}}dotquilt-skeleton-circle:is(:not(:defined),:state(unstyled)) [data-dotquilt-static]{display:block;position:absolute;inset:0;--s:var(--dotquilt-dot-size,4.4px);--g:calc(var(--s) + var(--dotquilt-dot-gap,4.6px));background:radial-gradient(circle,var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) calc(var(--s)/2 - .5px),#0000 calc(var(--s)/2 + .5px)) center/var(--g) var(--g) space;opacity:0.37}@media(forced-colors:active){dotquilt-skeleton-circle:is(:not(:defined),:state(unstyled)) [data-dotquilt-static]{border:1px dotted CanvasText}}
|
|
12
|
+
dotquilt-skeleton-circle:is(:not(:defined),:state(unstyled))[hidden]{display:none}
|
|
13
|
+
dotquilt-skeleton-circle:is(:not(:defined),:state(unstyled))[mark=square] [data-dotquilt-static]{background:var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) center/8.5px 8.5px space;mask:linear-gradient(#0000 1.75px,#000 2.75px,#000 5.75px,#0000 6.75px),linear-gradient(90deg,#0000 1.75px,#000 2.75px,#000 5.75px,#0000 6.75px);mask-size:8.5px 8.5px;mask-position:center;mask-repeat:space;mask-composite:intersect}dotquilt-skeleton-circle:is(:not(:defined),:state(unstyled))[mark=dash] [data-dotquilt-static]{background:var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) center/13px 9.5px space;mask:radial-gradient(circle at 3.5px 4.75px,#000 1.2px,#0000 2.2px),radial-gradient(circle at 9.5px 4.75px,#000 1.2px,#0000 2.2px),linear-gradient(#0000 2.55px,#000 3.55px,#000 5.95px,#0000 6.95px),linear-gradient(90deg,#0000 3px,#000 4px,#000 9px,#0000 10px);mask-size:13px 9.5px;mask-position:center;mask-repeat:space;mask-composite:add,add,intersect}
|
|
14
|
+
dotquilt-skeleton-text:is(:not(:defined),:state(unstyled)){display:grid;position:relative;gap:.5em}dotquilt-skeleton-text:is(:not(:defined),:state(unstyled)) [data-dotquilt-static],dotquilt-skeleton-text:is(:not(:defined),:state(unstyled)) [data-dotquilt-react-static]{display:grid;gap:inherit}dotquilt-skeleton-text:is(:not(:defined),:state(unstyled)):state(unstyled) [data-dotquilt-static],dotquilt-skeleton-text:is(:not(:defined),:state(unstyled)):state(unstyled) [data-dotquilt-react-static]{gap:.5em}dotquilt-skeleton-text:is(:not(:defined),:state(unstyled)) [data-dotquilt-static-line]{display:block;height:calc(2*(var(--dotquilt-dot-size,4.4px) + var(--dotquilt-dot-gap,4.6px)));border-radius:999px;--s:var(--dotquilt-dot-size,4.4px);--g:calc(var(--s) + var(--dotquilt-dot-gap,4.6px));background:radial-gradient(circle,var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) calc(var(--s)/2 - .5px),#0000 calc(var(--s)/2 + .5px)) 0 0/var(--g) var(--g);opacity:0.37}@media(forced-colors:active){dotquilt-skeleton-text:is(:not(:defined),:state(unstyled)) [data-dotquilt-static-line]{outline:1px dotted CanvasText}}@supports (width:round(down,1px,1px)){@media(forced-colors:none){dotquilt-skeleton-text:is(:not(:defined),:state(unstyled)) [data-dotquilt-static-line]{mask:linear-gradient(#000 0 0) 0/round(down,100%,var(--g)) no-repeat}}}
|
|
15
|
+
dotquilt-skeleton-text:is(:not(:defined),:state(unstyled))[hidden]{display:none}
|
|
16
|
+
dotquilt-skeleton-text:is(:not(:defined),:state(unstyled))[mark=square] [data-dotquilt-static-line]{background:var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) 0 0/8.5px 8.5px repeat;mask:linear-gradient(#0000 1.75px,#000 2.75px,#000 5.75px,#0000 6.75px),linear-gradient(90deg,#0000 1.75px,#000 2.75px,#000 5.75px,#0000 6.75px);mask-size:8.5px 8.5px;mask-position:0 0;mask-repeat:repeat;mask-composite:intersect}dotquilt-skeleton-text:is(:not(:defined),:state(unstyled))[mark=dash] [data-dotquilt-static-line]{background:var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) 0 0/13px 9.5px repeat;mask:radial-gradient(circle at 3.5px 4.75px,#000 1.2px,#0000 2.2px),radial-gradient(circle at 9.5px 4.75px,#000 1.2px,#0000 2.2px),linear-gradient(#0000 2.55px,#000 3.55px,#000 5.95px,#0000 6.95px),linear-gradient(90deg,#0000 3px,#000 4px,#000 9px,#0000 10px);mask-size:13px 9.5px;mask-position:0 0;mask-repeat:repeat;mask-composite:add,add,intersect}dotquilt-skeleton-text:is(:not(:defined),:state(unstyled))[mark=square] [data-dotquilt-static-line]{height:17px}dotquilt-skeleton-text:is(:not(:defined),:state(unstyled))[mark=dash] [data-dotquilt-static-line]{height:19px}@supports (width:round(down,1px,1px)){@media(forced-colors:none){dotquilt-skeleton-text:is(:not(:defined),:state(unstyled))[mark=square] [data-dotquilt-static-line]{mask-image:linear-gradient(#000 0 0),linear-gradient(#0000 1.75px,#000 2.75px,#000 5.75px,#0000 6.75px),linear-gradient(90deg,#0000 1.75px,#000 2.75px,#000 5.75px,#0000 6.75px);mask-size:round(down,100%,8.5px),8.5px 8.5px,8.5px 8.5px;mask-position:0,0 0,0 0;mask-repeat:no-repeat,repeat,repeat;mask-composite:intersect,intersect}dotquilt-skeleton-text:is(:not(:defined),:state(unstyled))[mark=dash] [data-dotquilt-static-line]{mask-image:linear-gradient(#000 0 0),radial-gradient(circle at 3.5px 4.75px,#000 1.2px,#0000 2.2px),radial-gradient(circle at 9.5px 4.75px,#000 1.2px,#0000 2.2px),linear-gradient(#0000 2.55px,#000 3.55px,#000 5.95px,#0000 6.95px),linear-gradient(90deg,#0000 3px,#000 4px,#000 9px,#0000 10px);mask-size:round(down,100%,13px),13px 9.5px,13px 9.5px,13px 9.5px,13px 9.5px;mask-position:0,0 0,0 0,0 0,0 0;mask-repeat:no-repeat,repeat,repeat,repeat,repeat;mask-composite:intersect,add,add,intersect}}}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Animations } from 'dotquilt';
|
|
2
|
+
import { type SkeletonCircle as NativeSkeletonCircle, type SkeletonLine as NativeSkeletonLine, type SkeletonText as NativeSkeletonText, type SkeletonPreset } from 'dotquilt/skeleton';
|
|
3
|
+
import { type ForwardRefExoticComponent, type RefAttributes } from 'react';
|
|
4
|
+
import type { HostProps } from './types.js';
|
|
5
|
+
export interface ShapeProps<E extends NativeSkeletonLine | NativeSkeletonCircle | NativeSkeletonText> extends HostProps<E> {
|
|
6
|
+
speed?: number | undefined;
|
|
7
|
+
pointerResponse?: 'none' | 'lift' | undefined;
|
|
8
|
+
animations?: Animations<'skeleton'> | undefined;
|
|
9
|
+
preset?: SkeletonPreset | undefined;
|
|
10
|
+
}
|
|
11
|
+
export type SkeletonLineProps = ShapeProps<NativeSkeletonLine>;
|
|
12
|
+
export type SkeletonCircleProps = ShapeProps<NativeSkeletonCircle>;
|
|
13
|
+
export interface SkeletonTextProps extends ShapeProps<NativeSkeletonText> {
|
|
14
|
+
lines?: number | undefined;
|
|
15
|
+
widths?: readonly number[] | undefined;
|
|
16
|
+
}
|
|
17
|
+
export declare const SkeletonLine: ForwardRefExoticComponent<SkeletonLineProps & RefAttributes<NativeSkeletonLine>>;
|
|
18
|
+
export declare const SkeletonCircle: ForwardRefExoticComponent<SkeletonCircleProps & RefAttributes<NativeSkeletonCircle>>;
|
|
19
|
+
export declare const SkeletonText: ForwardRefExoticComponent<ShapeProps<NativeSkeletonText> & {
|
|
20
|
+
lines?: number | undefined;
|
|
21
|
+
widths?: readonly number[] | undefined;
|
|
22
|
+
} & RefAttributes<NativeSkeletonText>>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { registerSkeletonCircle, registerSkeletonLine, registerSkeletonText, } from 'dotquilt/skeleton';
|
|
4
|
+
import { forwardRef, useState, } from 'react';
|
|
5
|
+
import { useHost } from './host.js';
|
|
6
|
+
import { reactCircleMarkStyles, reactCircleStyles, reactLineMarkStyles, reactLineStyles, reactTextSkeletonMarkStyles, reactTextSkeletonStyles, } from './server.js';
|
|
7
|
+
import { initialPolicy, markSheet, policyAttributes, sheet, useStyleNonce, } from './static.js';
|
|
8
|
+
function component(name, register, css, markCss, multiline = false) {
|
|
9
|
+
return forwardRef(function SkeletonShape({ stylePolicy, animations, preset, speed, pointerResponse, motion, lines = 3, widths, onHandoffStart, onHandoffEnd, onHandoffCancel, onLoaderError, ...attributes }, ref) {
|
|
10
|
+
const [initial] = useState(() => {
|
|
11
|
+
const count = Number.isInteger(lines) && lines > 0 ? Math.min(lines, 50) : 3;
|
|
12
|
+
return {
|
|
13
|
+
policy: initialPolicy(stylePolicy),
|
|
14
|
+
speed: speed ?? preset?.speed ?? 1,
|
|
15
|
+
pointerResponse: pointerResponse ?? preset?.pointerResponse ?? 'none',
|
|
16
|
+
count,
|
|
17
|
+
widths: Array.from({ length: count }, (_, index) => {
|
|
18
|
+
const width = widths?.[index];
|
|
19
|
+
return typeof width === 'number' &&
|
|
20
|
+
Number.isFinite(width) &&
|
|
21
|
+
width > 0 &&
|
|
22
|
+
width <= 1
|
|
23
|
+
? width
|
|
24
|
+
: count > 1 && index === count - 1
|
|
25
|
+
? 0.6
|
|
26
|
+
: 1;
|
|
27
|
+
}),
|
|
28
|
+
};
|
|
29
|
+
});
|
|
30
|
+
const nonce = useStyleNonce(initial.policy, name);
|
|
31
|
+
const host = useHost(ref, register, {
|
|
32
|
+
stylePolicy: stylePolicy ?? initial.policy,
|
|
33
|
+
animations,
|
|
34
|
+
preset,
|
|
35
|
+
speed,
|
|
36
|
+
pointerResponse,
|
|
37
|
+
motion,
|
|
38
|
+
...(multiline ? { lines, widths } : {}),
|
|
39
|
+
}, { onHandoffStart, onHandoffEnd, onHandoffCancel, onLoaderError });
|
|
40
|
+
const Host = `dotquilt-${name}`;
|
|
41
|
+
return (_jsxs(_Fragment, { children: [sheet(css, initial.policy, name, nonce), markSheet(markCss, initial.policy, name, nonce, attributes.mark), _jsx(Host, { ...attributes, ...policyAttributes(initial.policy, nonce), "aria-hidden": attributes['aria-hidden'] ?? true, "data-dotquilt-surface": "", motion: "paused", speed: initial.speed, "pointer-response": initial.pointerResponse, ...(multiline ? { lines: initial.count } : {}), ref: host, children: _jsx("span", { "data-dotquilt-react-static": "", "aria-hidden": true, children: _jsx("span", { "data-dotquilt-static": "", children: multiline
|
|
42
|
+
? initial.widths.map((width, index) => (_jsx("svg", { "data-dotquilt-static-line": "", width: `${width * 100}%`, height: 14 }, index)))
|
|
43
|
+
: null }) }) })] }));
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
export const SkeletonLine = /* @__PURE__ */ component('skeleton-line', registerSkeletonLine, reactLineStyles, reactLineMarkStyles);
|
|
47
|
+
export const SkeletonCircle = /* @__PURE__ */ component('skeleton-circle', registerSkeletonCircle, reactCircleStyles, reactCircleMarkStyles);
|
|
48
|
+
export const SkeletonText = /* @__PURE__ */ component('skeleton-text', registerSkeletonText, reactTextSkeletonStyles, reactTextSkeletonMarkStyles, true);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
:host{display:block;width:100%;height:1em;position:relative;border-radius:var(--dotquilt-radius,.375rem);overflow:hidden}:host .surface{position:absolute;inset:0;--s:var(--dotquilt-dot-size,4.4px);--g:calc(var(--s) + var(--dotquilt-dot-gap,4.6px));background:radial-gradient(circle,var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) calc(var(--s)/2 - .5px),#0000 calc(var(--s)/2 + .5px)) center/var(--g) var(--g) space;opacity:0.37}:host .pulse{position:absolute;inset:0;--dotquilt-color:var(--dotquilt-accent-color,light-dark(#4f8f93,#8dc4c5));opacity:0;mask:linear-gradient(104deg,#0000 12.5%,#00000005 18.75%,#0000001b 26.56%,#0000005e 34.38%,#000000c7 42.19%,#000 50%,#000000c7 57.81%,#0000005e 65.63%,#0000001b 73.44%,#00000005 81.25%,#0000 87.5%) 0 0/128% 100% no-repeat}:host .pulse>.surface,:host .lift>.surface{opacity:1}:host .lift{position:absolute;inset:0;--dotquilt-color:var(--dotquilt-accent-color,light-dark(#4f8f93,#8dc4c5));opacity:0;mask:radial-gradient(circle 56px at var(--dotquilt-pointer-x,-999px) var(--dotquilt-pointer-y,-999px),#000,#0000);transition:opacity .32s cubic-bezier(.22,1,.36,1)}:host([mark=square]) .surface{background:var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) center/8.5px 8.5px space;mask:linear-gradient(#0000 1.75px,#000 2.75px,#000 5.75px,#0000 6.75px),linear-gradient(90deg,#0000 1.75px,#000 2.75px,#000 5.75px,#0000 6.75px);mask-size:8.5px 8.5px;mask-position:center;mask-repeat:space;mask-composite:intersect}:host([mark=dash]) .surface{background:var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) center/13px 9.5px space;mask:radial-gradient(circle at 3.5px 4.75px,#000 1.2px,#0000 2.2px),radial-gradient(circle at 9.5px 4.75px,#000 1.2px,#0000 2.2px),linear-gradient(#0000 2.55px,#000 3.55px,#000 5.95px,#0000 6.95px),linear-gradient(90deg,#0000 3px,#000 4px,#000 9px,#0000 10px);mask-size:13px 9.5px;mask-position:center;mask-repeat:space;mask-composite:add,add,intersect}:host [data-dotquilt-dissolve] circle{r:calc(var(--dotquilt-dot-size,4.4px)/2)}:host [data-dotquilt-dissolve] pattern>rect{transform-box:fill-box;transform-origin:center}:host(dotquilt-skeleton-text) [data-dotquilt-dissolve] > svg{border-radius:999px}:host([hidden]){display:none}:host > svg{position:absolute;inset:0;width:100%;height:100%;fill:var(--dotquilt-color,light-dark(#6e7889,#a3afc2))}@media(forced-colors:none){:host([data-custom]) .surface{visibility:hidden}}@media(hover:hover) and (pointer:fine){:host([pointer-response=lift][data-pointer]) .lift{opacity:0.9}}@media(forced-colors:active){:host .surface{border:1px dotted CanvasText}:host .pulse,:host .lift,:host > svg{display:none}}
|
|
2
|
+
:host(:state(unstyled)) > :not(slot){display:none!important}
|
|
3
|
+
:host{height:auto;overflow:visible;display:grid;gap:.5em;border-radius:0}:host .lines{display:grid;gap:inherit}:host .lines:is(.pulse,.lift){position:absolute;inset:0}:host .line{box-sizing:border-box;height:calc(2*(var(--dotquilt-dot-size,4.4px) + var(--dotquilt-dot-gap,4.6px)));position:relative;border-radius:999px;overflow:hidden;--s:var(--dotquilt-dot-size,4.4px);--g:calc(var(--s) + var(--dotquilt-dot-gap,4.6px));background:radial-gradient(circle,var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) calc(var(--s)/2 - .5px),#0000 calc(var(--s)/2 + .5px)) 0 0/var(--g) var(--g)}:host([mark=square]) .line{background:var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) 0 0/8.5px 8.5px repeat;mask:linear-gradient(#0000 1.75px,#000 2.75px,#000 5.75px,#0000 6.75px),linear-gradient(90deg,#0000 1.75px,#000 2.75px,#000 5.75px,#0000 6.75px);mask-size:8.5px 8.5px;mask-position:0 0;mask-repeat:repeat;mask-composite:intersect}:host([mark=dash]) .line{background:var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) 0 0/13px 9.5px repeat;mask:radial-gradient(circle at 3.5px 4.75px,#000 1.2px,#0000 2.2px),radial-gradient(circle at 9.5px 4.75px,#000 1.2px,#0000 2.2px),linear-gradient(#0000 2.55px,#000 3.55px,#000 5.95px,#0000 6.95px),linear-gradient(90deg,#0000 3px,#000 4px,#000 9px,#0000 10px);mask-size:13px 9.5px;mask-position:0 0;mask-repeat:repeat;mask-composite:add,add,intersect}:host([mark=square]) .line{height:17px}:host([mark=dash]) .line{height:19px}@supports (width:round(down,1px,1px)){@media(forced-colors:none){:host .line{mask:linear-gradient(#000 0 0) 0/round(down,100%,var(--g)) no-repeat}:host([mark=square]) .line{mask-image:linear-gradient(#000 0 0),linear-gradient(#0000 1.75px,#000 2.75px,#000 5.75px,#0000 6.75px),linear-gradient(90deg,#0000 1.75px,#000 2.75px,#000 5.75px,#0000 6.75px);mask-size:round(down,100%,8.5px),8.5px 8.5px,8.5px 8.5px;mask-position:0,0 0,0 0;mask-repeat:no-repeat,repeat,repeat;mask-composite:intersect,intersect}:host([mark=dash]) .line{mask-image:linear-gradient(#000 0 0),radial-gradient(circle at 3.5px 4.75px,#000 1.2px,#0000 2.2px),radial-gradient(circle at 9.5px 4.75px,#000 1.2px,#0000 2.2px),linear-gradient(#0000 2.55px,#000 3.55px,#000 5.95px,#0000 6.95px),linear-gradient(90deg,#0000 3px,#000 4px,#000 9px,#0000 10px);mask-size:round(down,100%,13px),13px 9.5px,13px 9.5px,13px 9.5px,13px 9.5px;mask-position:0,0 0,0 0,0 0,0 0;mask-repeat:no-repeat,repeat,repeat,repeat,repeat;mask-composite:intersect,add,add,intersect}}}
|
|
4
|
+
dotquilt-skeleton-text:is(:not(:defined),:state(unstyled)){display:grid;position:relative;gap:.5em}dotquilt-skeleton-text:is(:not(:defined),:state(unstyled)) [data-dotquilt-static],dotquilt-skeleton-text:is(:not(:defined),:state(unstyled)) [data-dotquilt-react-static]{display:grid;gap:inherit}dotquilt-skeleton-text:is(:not(:defined),:state(unstyled)):state(unstyled) [data-dotquilt-static],dotquilt-skeleton-text:is(:not(:defined),:state(unstyled)):state(unstyled) [data-dotquilt-react-static]{gap:.5em}dotquilt-skeleton-text:is(:not(:defined),:state(unstyled)) [data-dotquilt-static-line]{display:block;height:calc(2*(var(--dotquilt-dot-size,4.4px) + var(--dotquilt-dot-gap,4.6px)));border-radius:999px;--s:var(--dotquilt-dot-size,4.4px);--g:calc(var(--s) + var(--dotquilt-dot-gap,4.6px));background:radial-gradient(circle,var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) calc(var(--s)/2 - .5px),#0000 calc(var(--s)/2 + .5px)) 0 0/var(--g) var(--g);opacity:0.37}@media(forced-colors:active){dotquilt-skeleton-text:is(:not(:defined),:state(unstyled)) [data-dotquilt-static-line]{outline:1px dotted CanvasText}}@supports (width:round(down,1px,1px)){@media(forced-colors:none){dotquilt-skeleton-text:is(:not(:defined),:state(unstyled)) [data-dotquilt-static-line]{mask:linear-gradient(#000 0 0) 0/round(down,100%,var(--g)) no-repeat}}}
|
|
5
|
+
dotquilt-skeleton-text:is(:not(:defined),:state(unstyled))[hidden]{display:none}
|
|
6
|
+
dotquilt-skeleton-text:is(:not(:defined),:state(unstyled))[mark=square] [data-dotquilt-static-line]{background:var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) 0 0/8.5px 8.5px repeat;mask:linear-gradient(#0000 1.75px,#000 2.75px,#000 5.75px,#0000 6.75px),linear-gradient(90deg,#0000 1.75px,#000 2.75px,#000 5.75px,#0000 6.75px);mask-size:8.5px 8.5px;mask-position:0 0;mask-repeat:repeat;mask-composite:intersect}dotquilt-skeleton-text:is(:not(:defined),:state(unstyled))[mark=dash] [data-dotquilt-static-line]{background:var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) 0 0/13px 9.5px repeat;mask:radial-gradient(circle at 3.5px 4.75px,#000 1.2px,#0000 2.2px),radial-gradient(circle at 9.5px 4.75px,#000 1.2px,#0000 2.2px),linear-gradient(#0000 2.55px,#000 3.55px,#000 5.95px,#0000 6.95px),linear-gradient(90deg,#0000 3px,#000 4px,#000 9px,#0000 10px);mask-size:13px 9.5px;mask-position:0 0;mask-repeat:repeat;mask-composite:add,add,intersect}dotquilt-skeleton-text:is(:not(:defined),:state(unstyled))[mark=square] [data-dotquilt-static-line]{height:17px}dotquilt-skeleton-text:is(:not(:defined),:state(unstyled))[mark=dash] [data-dotquilt-static-line]{height:19px}@supports (width:round(down,1px,1px)){@media(forced-colors:none){dotquilt-skeleton-text:is(:not(:defined),:state(unstyled))[mark=square] [data-dotquilt-static-line]{mask-image:linear-gradient(#000 0 0),linear-gradient(#0000 1.75px,#000 2.75px,#000 5.75px,#0000 6.75px),linear-gradient(90deg,#0000 1.75px,#000 2.75px,#000 5.75px,#0000 6.75px);mask-size:round(down,100%,8.5px),8.5px 8.5px,8.5px 8.5px;mask-position:0,0 0,0 0;mask-repeat:no-repeat,repeat,repeat;mask-composite:intersect,intersect}dotquilt-skeleton-text:is(:not(:defined),:state(unstyled))[mark=dash] [data-dotquilt-static-line]{mask-image:linear-gradient(#000 0 0),radial-gradient(circle at 3.5px 4.75px,#000 1.2px,#0000 2.2px),radial-gradient(circle at 9.5px 4.75px,#000 1.2px,#0000 2.2px),linear-gradient(#0000 2.55px,#000 3.55px,#000 5.95px,#0000 6.95px),linear-gradient(90deg,#0000 3px,#000 4px,#000 9px,#0000 10px);mask-size:round(down,100%,13px),13px 9.5px,13px 9.5px,13px 9.5px,13px 9.5px;mask-position:0,0 0,0 0,0 0,0 0;mask-repeat:no-repeat,repeat,repeat,repeat,repeat;mask-composite:intersect,add,add,intersect}}}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
:host{display:block;width:100%;height:1em;position:relative;border-radius:var(--dotquilt-radius,.375rem);overflow:hidden}:host .surface{position:absolute;inset:0;--s:var(--dotquilt-dot-size,4.4px);--g:calc(var(--s) + var(--dotquilt-dot-gap,4.6px));background:radial-gradient(circle,var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) calc(var(--s)/2 - .5px),#0000 calc(var(--s)/2 + .5px)) center/var(--g) var(--g) space;opacity:0.37}:host .pulse{position:absolute;inset:0;--dotquilt-color:var(--dotquilt-accent-color,light-dark(#4f8f93,#8dc4c5));opacity:0;mask:linear-gradient(104deg,#0000 12.5%,#00000005 18.75%,#0000001b 26.56%,#0000005e 34.38%,#000000c7 42.19%,#000 50%,#000000c7 57.81%,#0000005e 65.63%,#0000001b 73.44%,#00000005 81.25%,#0000 87.5%) 0 0/128% 100% no-repeat}:host .pulse>.surface,:host .lift>.surface{opacity:1}:host .lift{position:absolute;inset:0;--dotquilt-color:var(--dotquilt-accent-color,light-dark(#4f8f93,#8dc4c5));opacity:0;mask:radial-gradient(circle 56px at var(--dotquilt-pointer-x,-999px) var(--dotquilt-pointer-y,-999px),#000,#0000);transition:opacity .32s cubic-bezier(.22,1,.36,1)}:host([mark=square]) .surface{background:var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) center/8.5px 8.5px space;mask:linear-gradient(#0000 1.75px,#000 2.75px,#000 5.75px,#0000 6.75px),linear-gradient(90deg,#0000 1.75px,#000 2.75px,#000 5.75px,#0000 6.75px);mask-size:8.5px 8.5px;mask-position:center;mask-repeat:space;mask-composite:intersect}:host([mark=dash]) .surface{background:var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) center/13px 9.5px space;mask:radial-gradient(circle at 3.5px 4.75px,#000 1.2px,#0000 2.2px),radial-gradient(circle at 9.5px 4.75px,#000 1.2px,#0000 2.2px),linear-gradient(#0000 2.55px,#000 3.55px,#000 5.95px,#0000 6.95px),linear-gradient(90deg,#0000 3px,#000 4px,#000 9px,#0000 10px);mask-size:13px 9.5px;mask-position:center;mask-repeat:space;mask-composite:add,add,intersect}:host [data-dotquilt-dissolve] circle{r:calc(var(--dotquilt-dot-size,4.4px)/2)}:host [data-dotquilt-dissolve] pattern>rect{transform-box:fill-box;transform-origin:center}:host(dotquilt-skeleton-text) [data-dotquilt-dissolve] > svg{border-radius:999px}:host([hidden]){display:none}:host > svg{position:absolute;inset:0;width:100%;height:100%;fill:var(--dotquilt-color,light-dark(#6e7889,#a3afc2))}@media(forced-colors:none){:host([data-custom]) .surface{visibility:hidden}}@media(hover:hover) and (pointer:fine){:host([pointer-response=lift][data-pointer]) .lift{opacity:0.9}}@media(forced-colors:active){:host .surface{border:1px dotted CanvasText}:host .pulse,:host .lift,:host > svg{display:none}}
|
|
2
|
+
:host(:state(unstyled)) > :not(slot){display:none!important}
|
|
3
|
+
dotquilt-skeleton-block:is(:not(:defined),:state(unstyled)){display:block;width:100%;height:1em;position:relative;border-radius:var(--dotquilt-radius,.375rem);overflow:hidden}dotquilt-skeleton-block:is(:not(:defined),:state(unstyled)) [data-dotquilt-static]{position:absolute;inset:0;--s:var(--dotquilt-dot-size,4.4px);--g:calc(var(--s) + var(--dotquilt-dot-gap,4.6px));background:radial-gradient(circle,var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) calc(var(--s)/2 - .5px),#0000 calc(var(--s)/2 + .5px)) center/var(--g) var(--g) space;opacity:0.37}@media(forced-colors:active){dotquilt-skeleton-block:is(:not(:defined),:state(unstyled)) [data-dotquilt-static]{border:1px dotted CanvasText}}dotquilt-skeleton-block:is(:not(:defined),:state(unstyled))[hidden]{display:none}
|
|
4
|
+
dotquilt-skeleton-block:is(:not(:defined),:state(unstyled))[mark=square] [data-dotquilt-static]{background:var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) center/8.5px 8.5px space;mask:linear-gradient(#0000 1.75px,#000 2.75px,#000 5.75px,#0000 6.75px),linear-gradient(90deg,#0000 1.75px,#000 2.75px,#000 5.75px,#0000 6.75px);mask-size:8.5px 8.5px;mask-position:center;mask-repeat:space;mask-composite:intersect}dotquilt-skeleton-block:is(:not(:defined),:state(unstyled))[mark=dash] [data-dotquilt-static]{background:var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) center/13px 9.5px space;mask:radial-gradient(circle at 3.5px 4.75px,#000 1.2px,#0000 2.2px),radial-gradient(circle at 9.5px 4.75px,#000 1.2px,#0000 2.2px),linear-gradient(#0000 2.55px,#000 3.55px,#000 5.95px,#0000 6.95px),linear-gradient(90deg,#0000 3px,#000 4px,#000 9px,#0000 10px);mask-size:13px 9.5px;mask-position:center;mask-repeat:space;mask-composite:add,add,intersect}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Animations } from 'dotquilt';
|
|
2
|
+
import { type SkeletonBlock as NativeSkeletonBlock, type SkeletonPreset } from 'dotquilt/skeleton';
|
|
3
|
+
import type { HostProps } from './types.js';
|
|
4
|
+
export interface SkeletonBlockProps extends HostProps<NativeSkeletonBlock> {
|
|
5
|
+
speed?: number | undefined;
|
|
6
|
+
pointerResponse?: 'none' | 'lift' | undefined;
|
|
7
|
+
animations?: Animations<'skeleton'> | undefined;
|
|
8
|
+
preset?: SkeletonPreset | undefined;
|
|
9
|
+
}
|
|
10
|
+
export declare const SkeletonBlock: import("react").ForwardRefExoticComponent<SkeletonBlockProps & import("react").RefAttributes<NativeSkeletonBlock>>;
|
|
11
|
+
export type { SkeletonCircleProps, SkeletonLineProps, SkeletonTextProps, } from './skeleton-shapes.js';
|
|
12
|
+
export { SkeletonCircle, SkeletonLine, SkeletonText, } from './skeleton-shapes.js';
|
|
13
|
+
export type { DotquiltStyle, LoaderEvents, Motion, StylePolicy, } from './types.js';
|
package/dist/skeleton.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { registerSkeletonBlock, } from 'dotquilt/skeleton';
|
|
4
|
+
import { forwardRef, useState } from 'react';
|
|
5
|
+
import { useHost } from './host.js';
|
|
6
|
+
import { reactSkeletonMarkStyles, reactSkeletonStyles } from './server.js';
|
|
7
|
+
import { initialPolicy, markSheet, policyAttributes, sheet, useStyleNonce, } from './static.js';
|
|
8
|
+
export const SkeletonBlock = /* @__PURE__ */ forwardRef(function SkeletonBlock({ stylePolicy, animations, preset, speed, pointerResponse, motion, onHandoffStart, onHandoffEnd, onHandoffCancel, onLoaderError, ...attributes }, ref) {
|
|
9
|
+
const [initial] = useState(() => ({
|
|
10
|
+
policy: initialPolicy(stylePolicy),
|
|
11
|
+
speed: speed ?? preset?.speed ?? 1,
|
|
12
|
+
pointerResponse: pointerResponse ?? preset?.pointerResponse ?? 'none',
|
|
13
|
+
}));
|
|
14
|
+
const nonce = useStyleNonce(initial.policy, 'skeleton');
|
|
15
|
+
const host = useHost(ref, registerSkeletonBlock, {
|
|
16
|
+
stylePolicy: stylePolicy ?? initial.policy,
|
|
17
|
+
animations,
|
|
18
|
+
preset,
|
|
19
|
+
speed,
|
|
20
|
+
pointerResponse,
|
|
21
|
+
motion,
|
|
22
|
+
}, { onHandoffStart, onHandoffEnd, onHandoffCancel, onLoaderError });
|
|
23
|
+
return (_jsxs(_Fragment, { children: [sheet(reactSkeletonStyles, initial.policy, 'skeleton', nonce), markSheet(reactSkeletonMarkStyles, initial.policy, 'skeleton', nonce, attributes.mark), _jsx("dotquilt-skeleton-block", { ...attributes, ...policyAttributes(initial.policy, nonce), "aria-hidden": attributes['aria-hidden'] ?? true, "data-dotquilt-surface": "", motion: "paused", speed: initial.speed, "pointer-response": initial.pointerResponse, ref: host, children: _jsx("span", { "data-dotquilt-react-static": "", "aria-hidden": true, children: _jsx("span", { "data-dotquilt-static": "" }) }) })] }));
|
|
24
|
+
});
|
|
25
|
+
export { SkeletonCircle, SkeletonLine, SkeletonText, } from './skeleton-shapes.js';
|
package/dist/static.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type StylePolicy } from 'dotquilt';
|
|
2
|
+
export declare function initialPolicy(value: StylePolicy | undefined): StylePolicy;
|
|
3
|
+
export declare function policyAttributes(policy: StylePolicy, nonce: string | undefined): {
|
|
4
|
+
'data-dotquilt-style-href': string;
|
|
5
|
+
nonce?: never;
|
|
6
|
+
} | {
|
|
7
|
+
'data-dotquilt-style-href'?: never;
|
|
8
|
+
nonce: string | undefined;
|
|
9
|
+
};
|
|
10
|
+
export declare function useStyleNonce(policy: StylePolicy, family: string): string | undefined;
|
|
11
|
+
/** The light-DOM styles a loader needs before its element upgrades. */
|
|
12
|
+
export declare function sheet(css: readonly string[], policy: StylePolicy, family: string, nonce: string | undefined): import("react").JSX.Element;
|
|
13
|
+
/**
|
|
14
|
+
* The static rules for a square or dash mark, or nothing for the default dot.
|
|
15
|
+
* An external stylesheet already carries every mark.
|
|
16
|
+
*/
|
|
17
|
+
export declare function markSheet(css: readonly string[], policy: StylePolicy, family: string, nonce: string | undefined, mark: unknown): import("react").JSX.Element | null;
|
|
18
|
+
/** Match native-owned attributes after an early upgrade, then leave them native-owned.
|
|
19
|
+
* The immutable snapshot never rewrites later presentation changes on React commits.
|
|
20
|
+
*/
|
|
21
|
+
export declare function useUpgradeAttributes(fields: readonly string[], initial?: Readonly<Record<string, string | null>>): Readonly<Record<string, string | null>>;
|
|
22
|
+
/** Capture one primitive native-owned value without constructing a field map. */
|
|
23
|
+
export declare function useCustomAttribute(): Readonly<Record<string, string | null>>;
|
package/dist/static.js
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { LoaderConfigurationError } from 'dotquilt';
|
|
3
|
+
import { useId, useRef, useSyncExternalStore, version } from 'react';
|
|
4
|
+
export function initialPolicy(value) {
|
|
5
|
+
const policy = value ?? { mode: 'inline' };
|
|
6
|
+
if (!policy ||
|
|
7
|
+
(policy.mode !== 'inline' && policy.mode !== 'external') ||
|
|
8
|
+
(policy.mode === 'inline' &&
|
|
9
|
+
policy.nonce !== undefined &&
|
|
10
|
+
(typeof policy.nonce !== 'string' || policy.nonce.length > 256)) ||
|
|
11
|
+
(policy.mode === 'external' &&
|
|
12
|
+
(typeof policy.href !== 'string' ||
|
|
13
|
+
policy.href.length > 2048 ||
|
|
14
|
+
!/^(https?:\/\/|\/[^/]|\.\.?\/)/.test(policy.href))))
|
|
15
|
+
throw new LoaderConfigurationError('invalid-style-policy', 'Invalid style policy');
|
|
16
|
+
return Object.freeze({ ...policy });
|
|
17
|
+
}
|
|
18
|
+
export function policyAttributes(policy, nonce) {
|
|
19
|
+
return policy.mode === 'external'
|
|
20
|
+
? { 'data-dotquilt-style-href': policy.href }
|
|
21
|
+
: { nonce };
|
|
22
|
+
}
|
|
23
|
+
// React 19.0–19.2 compare the visible nonce attribute during hydration.
|
|
24
|
+
// CSP hides that attribute while preserving HTMLElement.nonce. Match the actual
|
|
25
|
+
// attribute for hydration, then restore the real prop through the store snapshot.
|
|
26
|
+
// No DOM is mutated here and no hydration warning is suppressed.
|
|
27
|
+
const legacyNonce = /^19\.[012]\./.test(version);
|
|
28
|
+
const subscribe = () => () => { };
|
|
29
|
+
export function useStyleNonce(policy, family) {
|
|
30
|
+
const nonce = policy.mode === 'inline' ? policy.nonce : undefined;
|
|
31
|
+
return useSyncExternalStore(subscribe, () => nonce, () => {
|
|
32
|
+
if (legacyNonce && nonce && typeof document !== 'undefined') {
|
|
33
|
+
const style = [
|
|
34
|
+
...document.querySelectorAll(`style[data-dotquilt-react-style="${family}"]`),
|
|
35
|
+
].find((element) => element.nonce === nonce);
|
|
36
|
+
return style?.getAttribute('nonce') ?? nonce;
|
|
37
|
+
}
|
|
38
|
+
return nonce;
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
const hrefs = new WeakMap();
|
|
42
|
+
/** Names one stylesheet by its CSS, so only identical CSS is shared (FNV-1a). */
|
|
43
|
+
function styleHref(family, css, text) {
|
|
44
|
+
let href = hrefs.get(css);
|
|
45
|
+
if (!href) {
|
|
46
|
+
let hash = 0x811c9dc5;
|
|
47
|
+
for (let i = 0; i < text.length; i++)
|
|
48
|
+
hash = Math.imul(hash ^ text.charCodeAt(i), 0x01000193);
|
|
49
|
+
href = `dotquilt-${family}-${(hash >>> 0).toString(36)}`;
|
|
50
|
+
hrefs.set(css, href);
|
|
51
|
+
}
|
|
52
|
+
return href;
|
|
53
|
+
}
|
|
54
|
+
/** The light-DOM styles a loader needs before its element upgrades. */
|
|
55
|
+
export function sheet(css, policy, family, nonce) {
|
|
56
|
+
// One link per loader: a `<link precedence>` would suspend rendering until
|
|
57
|
+
// the file loads, which can blank a Suspense fallback built from loaders.
|
|
58
|
+
if (policy.mode === 'external')
|
|
59
|
+
return (_jsx("link", { rel: "stylesheet", href: policy.href, "data-dotquilt-react-style": family }, family));
|
|
60
|
+
const text = css.join('\n');
|
|
61
|
+
// One style per loader: React 19.0 cannot put a nonce on a shared stylesheet.
|
|
62
|
+
if (policy.nonce !== undefined)
|
|
63
|
+
return (_jsx("style", { nonce: nonce, "data-dotquilt-react-style": family, children: text }, family));
|
|
64
|
+
// React keeps one copy per href in the document. A precedence per family
|
|
65
|
+
// keeps each copy's text exactly `text`, so CSP hashes of it still match.
|
|
66
|
+
return (_jsx("style", { href: styleHref(family, css, text), precedence: `dotquilt-${family}`, children: text }, family));
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* The static rules for a square or dash mark, or nothing for the default dot.
|
|
70
|
+
* An external stylesheet already carries every mark.
|
|
71
|
+
*/
|
|
72
|
+
export function markSheet(css, policy, family, nonce, mark) {
|
|
73
|
+
if (policy.mode === 'external' || (mark !== 'dash' && mark !== 'square'))
|
|
74
|
+
return null;
|
|
75
|
+
return sheet(css, policy, `${family}-marks`, nonce);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The server-rendered host carrying this component's `useId`, or undefined.
|
|
79
|
+
* `useId` is only unique within one React root, so when several elements match
|
|
80
|
+
* (multiple roots without `identifierPrefix`) none is trusted.
|
|
81
|
+
*/
|
|
82
|
+
function hydratingHost(id) {
|
|
83
|
+
if (typeof document === 'undefined')
|
|
84
|
+
return undefined;
|
|
85
|
+
const matches = document.querySelectorAll(`[data-dotquilt-react-host="${CSS.escape(id)}"]`);
|
|
86
|
+
return matches.length === 1 ? (matches[0] ?? undefined) : undefined;
|
|
87
|
+
}
|
|
88
|
+
/** Match native-owned attributes after an early upgrade, then leave them native-owned.
|
|
89
|
+
* The immutable snapshot never rewrites later presentation changes on React commits.
|
|
90
|
+
*/
|
|
91
|
+
export function useUpgradeAttributes(fields, initial = {}) {
|
|
92
|
+
const id = useId();
|
|
93
|
+
const captured = useRef(undefined);
|
|
94
|
+
const snapshot = () => {
|
|
95
|
+
if (!captured.current) {
|
|
96
|
+
const host = hydratingHost(id);
|
|
97
|
+
captured.current = Object.freeze(Object.fromEntries(fields.map((field) => [
|
|
98
|
+
field,
|
|
99
|
+
(host ? host.getAttribute(field) : initial[field]) ?? null,
|
|
100
|
+
])));
|
|
101
|
+
}
|
|
102
|
+
return captured.current;
|
|
103
|
+
};
|
|
104
|
+
return {
|
|
105
|
+
'data-dotquilt-react-host': id,
|
|
106
|
+
...useSyncExternalStore(subscribe, snapshot, snapshot),
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
/** Capture one primitive native-owned value without constructing a field map. */
|
|
110
|
+
export function useCustomAttribute() {
|
|
111
|
+
const id = useId();
|
|
112
|
+
const captured = useRef(undefined);
|
|
113
|
+
const snapshot = () => {
|
|
114
|
+
if (captured.current === undefined) {
|
|
115
|
+
captured.current = hydratingHost(id)?.getAttribute('data-custom') ?? null;
|
|
116
|
+
}
|
|
117
|
+
return captured.current;
|
|
118
|
+
};
|
|
119
|
+
return {
|
|
120
|
+
'data-dotquilt-react-host': id,
|
|
121
|
+
'data-custom': useSyncExternalStore(subscribe, snapshot, snapshot),
|
|
122
|
+
};
|
|
123
|
+
}
|
package/dist/table.css
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
:host{display:grid;position:relative;width:100%;overflow:hidden}:host([hidden]){display:none}:host [data-table-static]{grid-area:1/1;display:block;width:100%;min-width:0;gap:var(--dotquilt-dot-gap,4.6px);background-size:calc(var(--dotquilt-dot-size,4.4px) + var(--dotquilt-dot-gap,4.6px)) calc(var(--dotquilt-dot-size,4.4px) + var(--dotquilt-dot-gap,4.6px));stroke:var(--dotquilt-color,light-dark(#6e7889,#a3afc2));opacity:0.37}:host([mark=square]) [data-table-static]{background-size:8.5px 8.5px}:host([mark=dash]) [data-table-static]{background-size:13px 9.5px}:host .f{display:grid;min-width:0;min-height:100%}:host .f > svg[data-dotquilt-painter]{grid-area:1/1;contain:size;display:block;width:100%;height:100%;pointer-events:none}:host([data-custom]) [data-table-static]{visibility:hidden}:host [data-dotquilt-react-static]{display:none}@media(forced-colors:active){:host [data-table-static]{visibility:visible;stroke:CanvasText}:host svg[data-dotquilt-painter]{display:none}}:host canvas[data-dotquilt-bitmap]{display:block;width:100%;height:100%;pointer-events:none}
|
|
2
|
+
:host(:state(unstyled)) > :not(slot){display:none!important}
|
|
3
|
+
:where(dotquilt-table-loader:is(:not(:defined),:state(unstyled))){display:block;position:relative;width:100%;overflow:hidden}dotquilt-table-loader:is(:not(:defined),:state(unstyled))[hidden]{display:none}dotquilt-table-loader:is(:not(:defined),:state(unstyled)) [data-dotquilt-static]{display:block;width:100%;stroke:var(--dotquilt-color,light-dark(#6e7889,#a3afc2));opacity:0.37}@media(forced-colors:active){dotquilt-table-loader:is(:not(:defined),:state(unstyled)) [data-dotquilt-static]{stroke:CanvasText}}
|
package/dist/table.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Animations } from 'dotquilt';
|
|
2
|
+
import { type TableLoader as NativeTableLoader, type TableColumn, type TablePreset, type TableTargetProvider } from 'dotquilt/table';
|
|
3
|
+
import type { HostProps } from './types.js';
|
|
4
|
+
export interface TableLoaderProps extends HostProps<NativeTableLoader> {
|
|
5
|
+
rows?: number | undefined;
|
|
6
|
+
rowHeight?: number | undefined;
|
|
7
|
+
columns?: readonly TableColumn[] | undefined;
|
|
8
|
+
speed?: number | undefined;
|
|
9
|
+
pointerResponse?: 'none' | 'lift' | undefined;
|
|
10
|
+
animations?: Animations<'table'> | undefined;
|
|
11
|
+
preset?: TablePreset | undefined;
|
|
12
|
+
targetProvider?: TableTargetProvider | undefined;
|
|
13
|
+
}
|
|
14
|
+
export declare const TableLoader: import("react").ForwardRefExoticComponent<TableLoaderProps & import("react").RefAttributes<NativeTableLoader>>;
|
package/dist/table.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { registerTableLoader, staticTableLayout, } from 'dotquilt/table';
|
|
4
|
+
import { forwardRef, useState } from 'react';
|
|
5
|
+
import { useHost } from './host.js';
|
|
6
|
+
import { reactTableStyles } from './server.js';
|
|
7
|
+
import { initialPolicy, policyAttributes, sheet, useCustomAttribute, useStyleNonce, } from './static.js';
|
|
8
|
+
export const TableLoader = /* @__PURE__ */ forwardRef(function TableLoader({ rows, rowHeight, columns, speed, pointerResponse, animations, preset, targetProvider, stylePolicy, motion, onHandoffStart, onHandoffEnd, onHandoffCancel, onLoaderError, ...attributes }, ref) {
|
|
9
|
+
// Capture the inert native layout once; React continues to own its SVG nodes.
|
|
10
|
+
const [initial] = useState(() => {
|
|
11
|
+
const policy = initialPolicy(stylePolicy);
|
|
12
|
+
const { rows: count, rowHeight: height, parts, } = staticTableLayout(rows, rowHeight, columns);
|
|
13
|
+
return {
|
|
14
|
+
policy,
|
|
15
|
+
rows: count,
|
|
16
|
+
height,
|
|
17
|
+
content: (_jsx("span", { "data-dotquilt-react-static": "", "aria-hidden": true, children: _jsx("svg", { "data-dotquilt-static": "", width: "100%", height: count * height, viewBox: `0 0 100 ${count * height}`, preserveAspectRatio: "none", fill: "none", stroke: "currentColor", opacity: 0.25, children: parts.map((attrs, index) => (_jsx("path", { d: attrs.d, strokeWidth: attrs['stroke-width'], strokeDasharray: attrs['stroke-dasharray'] }, index))) }) })),
|
|
18
|
+
};
|
|
19
|
+
});
|
|
20
|
+
const { policy } = initial;
|
|
21
|
+
const nonce = useStyleNonce(policy, 'table');
|
|
22
|
+
const upgraded = useCustomAttribute();
|
|
23
|
+
const host = useHost(ref, registerTableLoader, {
|
|
24
|
+
rows,
|
|
25
|
+
rowHeight,
|
|
26
|
+
columns,
|
|
27
|
+
speed,
|
|
28
|
+
pointerResponse,
|
|
29
|
+
animations,
|
|
30
|
+
preset,
|
|
31
|
+
targetProvider,
|
|
32
|
+
stylePolicy: stylePolicy ?? policy,
|
|
33
|
+
motion,
|
|
34
|
+
}, { onHandoffStart, onHandoffEnd, onHandoffCancel, onLoaderError });
|
|
35
|
+
return (_jsxs(_Fragment, { children: [sheet(reactTableStyles, policy, 'table', nonce), _jsx("dotquilt-table-loader", { ...attributes, ...upgraded, ...policyAttributes(policy, nonce), "aria-hidden": true, "data-dotquilt-surface": "", motion: "paused", rows: initial.rows, "row-height": initial.height, ref: host, children: initial.content })] }));
|
|
36
|
+
});
|
package/dist/text.css
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
dotquilt-region:state(unstyled)::part(placeholder),dotquilt-region:state(unstyled)::part(refresh-indicator){visibility:hidden;pointer-events:none}dotquilt-region:state(unstyled)[data-presentation=pending]::part(placeholder),dotquilt-region:state(unstyled)[data-presentation=handoff]::part(placeholder),dotquilt-region:state(unstyled)[data-presentation=refreshing]::part(refresh-indicator){visibility:inherit}dotquilt-region:state(unstyled)[data-presentation=pending]::part(content){visibility:hidden}:host{display:grid;position:relative}:host(:focus){outline:none}:host(:focus-visible:not([data-dotquilt-focus=pointer])),:host([data-dotquilt-focus=""]:focus){outline:2px solid currentColor;outline-offset:3px}:host .f{display:grid;min-width:0;min-height:100%}:host [part]{display:block;grid-area:1/1;min-width:0}:host .p,:host .r{visibility:hidden;pointer-events:none}:host([data-presentation=pending]) .p,:host([data-presentation=handoff]) .p,:host([data-presentation=refreshing]) .r{visibility:inherit}:host([data-presentation=pending]) .c{visibility:hidden}:host([hidden]){display:none}:host > svg{position:absolute;inset:0;pointer-events:none}:host .fallback{display:block;min-height:1em;border:1px dotted currentColor}:host([data-dotquilt-waiting]) .p{visibility:hidden}:host{display:inline-grid;vertical-align:baseline;min-height:1em}:host .mask{display:block;min-height:1em;white-space:pre;opacity:.3;color:transparent;background:radial-gradient(circle,var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) 1px,#0000 0) 0 0/6px 6px}:host([mark=square]) .mask{background:var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) 0 0/6px 6px repeat;mask:linear-gradient(#0000 1.5px,#000 2.5px,#000 3.5px,#0000 4.5px),linear-gradient(90deg,#0000 1.5px,#000 2.5px,#000 3.5px,#0000 4.5px);mask-size:6px 6px;mask-position:0 0;mask-repeat:repeat;mask-composite:intersect}:host([mark=dash]) .mask{background:var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) 0 0/6px 6px repeat;mask:radial-gradient(circle at 1.7px 3px,#000 0.3px,#0000 1.3px),radial-gradient(circle at 4.3px 3px,#000 0.3px,#0000 1.3px),linear-gradient(#0000 1.7px,#000 2.7px,#000 3.3px,#0000 4.3px),linear-gradient(90deg,#0000 1.2px,#000 2.2px,#000 3.8px,#0000 4.8px);mask-size:6px 6px;mask-position:0 0;mask-repeat:repeat;mask-composite:add,add,intersect}:host([data-dotquilt-waiting]) .mask,:host([data-dotquilt-waiting])>svg{visibility:hidden}:host ::slotted([slot=placeholder]){display:none}:host([data-custom][data-dotquilt-glyphs]) .mask{visibility:hidden}:host > svg{width:100%;height:100%;overflow:visible}@media(forced-colors:active){:host > svg{display:none}:host .mask{visibility:visible;border:1px dotted CanvasText}}
|
|
2
|
+
dotquilt-text-loader:is(:not(:defined),:state(unstyled)){display:inline-grid;position:relative;min-height:1em}dotquilt-text-loader:is(:not(:defined),:state(unstyled))[hidden]{display:none}dotquilt-text-loader:is(:not(:defined),:state(unstyled))[state=pending]>:not([slot]){visibility:hidden}dotquilt-text-loader:is(:not(:defined),:state(unstyled))>[slot=placeholder]{grid-area:1/1;white-space:pre;color:transparent;opacity:.3;min-height:1em;background:radial-gradient(circle,var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) 1px,#0000 0) 0 0/6px 6px}dotquilt-text-loader:is(:not(:defined),:state(unstyled)):not([state=pending])>[slot=placeholder]{display:none}dotquilt-text-loader:is(:not(:defined),:state(unstyled))>:not([slot]){grid-area:1/1}@media(forced-colors:active){dotquilt-text-loader:is(:not(:defined),:state(unstyled))>[slot=placeholder]{border:1px dotted CanvasText}}
|
|
3
|
+
dotquilt-text-loader:is(:not(:defined),:state(unstyled))[mark=square] >[slot=placeholder]{background:var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) 0 0/6px 6px repeat;mask:linear-gradient(#0000 1.5px,#000 2.5px,#000 3.5px,#0000 4.5px),linear-gradient(90deg,#0000 1.5px,#000 2.5px,#000 3.5px,#0000 4.5px);mask-size:6px 6px;mask-position:0 0;mask-repeat:repeat;mask-composite:intersect}dotquilt-text-loader:is(:not(:defined),:state(unstyled))[mark=dash] >[slot=placeholder]{background:var(--dotquilt-color,light-dark(#6e7889,#a3afc2)) 0 0/6px 6px repeat;mask:radial-gradient(circle at 1.7px 3px,#000 0.3px,#0000 1.3px),radial-gradient(circle at 4.3px 3px,#000 0.3px,#0000 1.3px),linear-gradient(#0000 1.7px,#000 2.7px,#000 3.3px,#0000 4.3px),linear-gradient(90deg,#0000 1.2px,#000 2.2px,#000 3.8px,#0000 4.8px);mask-size:6px 6px;mask-position:0 0;mask-repeat:repeat;mask-composite:add,add,intersect}
|
package/dist/text.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Animations, LoadingState, Timing } from 'dotquilt';
|
|
2
|
+
import { type TextLoader as NativeTextLoader, type TextPreset } from 'dotquilt/text';
|
|
3
|
+
import type { HostProps } from './types.js';
|
|
4
|
+
export interface TextLoaderProps extends HostProps<NativeTextLoader> {
|
|
5
|
+
children?: string | number | undefined;
|
|
6
|
+
mask?: string | undefined;
|
|
7
|
+
state?: LoadingState | undefined;
|
|
8
|
+
cycle?: string | undefined;
|
|
9
|
+
/** Milliseconds to wait before showing the placeholder. */
|
|
10
|
+
delay?: number | undefined;
|
|
11
|
+
/** Milliseconds a placeholder stays once shown. */
|
|
12
|
+
minDisplay?: number | undefined;
|
|
13
|
+
timing?: Timing | undefined;
|
|
14
|
+
speed?: number | undefined;
|
|
15
|
+
pointerResponse?: 'none' | 'lift' | undefined;
|
|
16
|
+
animations?: Animations<'text'> | undefined;
|
|
17
|
+
preset?: TextPreset | undefined;
|
|
18
|
+
}
|
|
19
|
+
export declare const TextLoader: import("react").ForwardRefExoticComponent<TextLoaderProps & import("react").RefAttributes<NativeTextLoader>>;
|
package/dist/text.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { registerTextLoader, } from 'dotquilt/text';
|
|
4
|
+
import { forwardRef, useState } from 'react';
|
|
5
|
+
import { useHost } from './host.js';
|
|
6
|
+
import { reactTextMarkStyles, reactTextStyles } from './server.js';
|
|
7
|
+
import { initialPolicy, markSheet, policyAttributes, sheet, useStyleNonce, useUpgradeAttributes, } from './static.js';
|
|
8
|
+
export const TextLoader = /* @__PURE__ */ forwardRef(function TextLoader({ children, mask, state = 'ready', cycle, delay, minDisplay, timing, speed, pointerResponse, animations, preset, stylePolicy, motion, onHandoffStart, onHandoffEnd, onHandoffCancel, onLoaderError, ...attributes }, ref) {
|
|
9
|
+
const [initial] = useState(() => ({
|
|
10
|
+
policy: initialPolicy(stylePolicy),
|
|
11
|
+
state,
|
|
12
|
+
mask: (mask ?? String(children ?? '')).length <= 256
|
|
13
|
+
? (mask ?? String(children ?? ''))
|
|
14
|
+
: '',
|
|
15
|
+
}));
|
|
16
|
+
const nonce = useStyleNonce(initial.policy, 'text');
|
|
17
|
+
const upgraded = useUpgradeAttributes([
|
|
18
|
+
'data-custom',
|
|
19
|
+
'data-presentation',
|
|
20
|
+
'data-dotquilt-glyphs',
|
|
21
|
+
]);
|
|
22
|
+
const contentAttributes = useUpgradeAttributes(['aria-hidden', 'inert'], {
|
|
23
|
+
'aria-hidden': initial.state === 'pending' ? 'true' : null,
|
|
24
|
+
inert: initial.state === 'pending' ? '' : null,
|
|
25
|
+
});
|
|
26
|
+
const host = useHost(ref, registerTextLoader, {
|
|
27
|
+
state,
|
|
28
|
+
cycle,
|
|
29
|
+
delay,
|
|
30
|
+
minDisplay,
|
|
31
|
+
timing,
|
|
32
|
+
speed,
|
|
33
|
+
pointerResponse,
|
|
34
|
+
animations,
|
|
35
|
+
preset,
|
|
36
|
+
mask,
|
|
37
|
+
motion,
|
|
38
|
+
stylePolicy: stylePolicy ?? initial.policy,
|
|
39
|
+
}, { onHandoffStart, onHandoffEnd, onHandoffCancel, onLoaderError });
|
|
40
|
+
return (_jsxs(_Fragment, { children: [sheet(reactTextStyles, initial.policy, 'text', nonce), markSheet(reactTextMarkStyles, initial.policy, 'text', nonce, attributes.mark), _jsxs("dotquilt-text-loader", { ...attributes, ...upgraded, ...policyAttributes(initial.policy, nonce), role: attributes.role ?? 'group', state: initial.state, mask: initial.mask, motion: "paused", ref: host, children: [_jsx("span", { slot: "placeholder", "data-dotquilt-text-placeholder": "", "aria-hidden": true, inert: true, children: initial.mask }), _jsx("span", { "data-dotquilt-text-content": "", ...contentAttributes, inert: contentAttributes.inert === '' ? true : undefined, children: children })] })] }));
|
|
41
|
+
});
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { HandoffDetail, LoaderErrorDetail, Mark, Motion, StylePolicy } from 'dotquilt';
|
|
2
|
+
import type { CSSProperties, HTMLAttributes } from 'react';
|
|
3
|
+
export interface DotquiltStyle extends CSSProperties {
|
|
4
|
+
'--dotquilt-color'?: string | undefined;
|
|
5
|
+
'--dotquilt-accent-color'?: string | undefined;
|
|
6
|
+
'--dotquilt-dot-size'?: string | undefined;
|
|
7
|
+
'--dotquilt-dot-gap'?: string | undefined;
|
|
8
|
+
'--dotquilt-radius'?: string | undefined;
|
|
9
|
+
}
|
|
10
|
+
export interface LoaderEvents {
|
|
11
|
+
onHandoffStart?: ((event: CustomEvent<HandoffDetail>) => void) | undefined;
|
|
12
|
+
onHandoffEnd?: ((event: CustomEvent<HandoffDetail>) => void) | undefined;
|
|
13
|
+
onHandoffCancel?: ((event: CustomEvent<HandoffDetail>) => void) | undefined;
|
|
14
|
+
onLoaderError?: ((event: CustomEvent<LoaderErrorDetail>) => void) | undefined;
|
|
15
|
+
}
|
|
16
|
+
export interface HostProps<E extends HTMLElement> extends Omit<HTMLAttributes<E>, 'style' | 'children' | 'dangerouslySetInnerHTML'>, LoaderEvents {
|
|
17
|
+
style?: DotquiltStyle | undefined;
|
|
18
|
+
stylePolicy?: StylePolicy | undefined;
|
|
19
|
+
motion?: Motion | undefined;
|
|
20
|
+
/** The shape the loader draws (design/SPEC.md); passed as the `mark` attribute. */
|
|
21
|
+
mark?: Mark | undefined;
|
|
22
|
+
}
|
|
23
|
+
export type { HandoffDetail, LoaderErrorDetail, LoadingState, Mark, Motion, StylePolicy, Timing, } from 'dotquilt';
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/typing.css
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
:host,dotquilt-typing-dots{display:inline-flex;position:relative;align-items:center;height:1em}:host .dot{display:inline-block;vertical-align:middle;width:var(--dotquilt-dot-size,8px);height:var(--dotquilt-dot-size,8px);border-radius:50%;background:var(--dotquilt-color,light-dark(#6e7889,#a3afc2));opacity:.3}:host .dot+.dot{margin-inline-start:var(--dotquilt-dot-gap,6px)}:host([mark=square]) .dot{width:calc(var(--dotquilt-dot-size,8px)*.9);height:calc(var(--dotquilt-dot-size,8px)*.9);border-radius:calc(var(--dotquilt-dot-size,8px)*.25)}:host([mark=dash]) .dot{width:calc(var(--dotquilt-dot-size,8px)*2.16);height:calc(var(--dotquilt-dot-size,8px)*.8);border-radius:999px}:host([hidden]){display:none}@media(forced-colors:active){:host .dot{background:CanvasText}}
|
|
2
|
+
:host(:state(unstyled)) > :not(slot){display:none!important}
|
|
3
|
+
dotquilt-typing-dots:is(:not(:defined),:state(unstyled)){display:inline-flex;align-items:center;height:1em}dotquilt-typing-dots:is(:not(:defined),:state(unstyled)) [data-dotquilt-static]{display:inline-flex;align-items:center;gap:var(--dotquilt-dot-gap,6px)}dotquilt-typing-dots:is(:not(:defined),:state(unstyled)) .dot{display:block;width:var(--dotquilt-dot-size,8px);height:var(--dotquilt-dot-size,8px);border-radius:50%;background:var(--dotquilt-color,light-dark(#6e7889,#a3afc2));opacity:.3}@media(forced-colors:active){dotquilt-typing-dots:is(:not(:defined),:state(unstyled)) .dot{background:CanvasText}}
|
|
4
|
+
dotquilt-typing-dots:is(:not(:defined),:state(unstyled)) [data-dotquilt-react-static]{display:contents}
|
|
5
|
+
dotquilt-typing-dots:is(:not(:defined),:state(unstyled))[hidden]{display:none}
|
|
6
|
+
dotquilt-typing-dots:is(:not(:defined),:state(unstyled))[mark=square] .dot{width:calc(var(--dotquilt-dot-size,8px)*.9);height:calc(var(--dotquilt-dot-size,8px)*.9);border-radius:calc(var(--dotquilt-dot-size,8px)*.25)}dotquilt-typing-dots:is(:not(:defined),:state(unstyled))[mark=dash] .dot{width:calc(var(--dotquilt-dot-size,8px)*2.16);height:calc(var(--dotquilt-dot-size,8px)*.8);border-radius:999px}
|
package/dist/typing.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type TypingDots as NativeTypingDots, type TypingPreset } from 'dotquilt/typing';
|
|
2
|
+
import type { HostProps } from './types.js';
|
|
3
|
+
export interface TypingDotsProps extends HostProps<NativeTypingDots> {
|
|
4
|
+
count?: number | undefined;
|
|
5
|
+
preset?: TypingPreset | undefined;
|
|
6
|
+
speed?: number | undefined;
|
|
7
|
+
}
|
|
8
|
+
export declare const TypingDots: import("react").ForwardRefExoticComponent<TypingDotsProps & import("react").RefAttributes<NativeTypingDots>>;
|
package/dist/typing.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { registerTypingDots, } from 'dotquilt/typing';
|
|
4
|
+
import { forwardRef, useState } from 'react';
|
|
5
|
+
import { useHost } from './host.js';
|
|
6
|
+
import { reactTypingMarkStyles, reactTypingStyles } from './server.js';
|
|
7
|
+
import { initialPolicy, markSheet, policyAttributes, sheet, useStyleNonce, } from './static.js';
|
|
8
|
+
export const TypingDots = /* @__PURE__ */ forwardRef(function TypingDots({ count, preset, speed, motion, stylePolicy, onHandoffStart, onHandoffEnd, onHandoffCancel, onLoaderError, ...attributes }, ref) {
|
|
9
|
+
const [initial] = useState(() => ({
|
|
10
|
+
policy: initialPolicy(stylePolicy),
|
|
11
|
+
count: Number.isInteger(count ?? preset?.count ?? 3) &&
|
|
12
|
+
(count ?? preset?.count ?? 3) > 0
|
|
13
|
+
? Math.min(count ?? preset?.count ?? 3, 8)
|
|
14
|
+
: 3,
|
|
15
|
+
speed: speed ?? preset?.speed ?? 1,
|
|
16
|
+
}));
|
|
17
|
+
const nonce = useStyleNonce(initial.policy, 'typing');
|
|
18
|
+
const host = useHost(ref, registerTypingDots, {
|
|
19
|
+
count,
|
|
20
|
+
speed,
|
|
21
|
+
preset,
|
|
22
|
+
motion,
|
|
23
|
+
stylePolicy: stylePolicy ?? initial.policy,
|
|
24
|
+
}, { onHandoffStart, onHandoffEnd, onHandoffCancel, onLoaderError });
|
|
25
|
+
return (_jsxs(_Fragment, { children: [sheet(reactTypingStyles, initial.policy, 'typing', nonce), markSheet(reactTypingMarkStyles, initial.policy, 'typing', nonce, attributes.mark), _jsx("dotquilt-typing-dots", { ...attributes, ...policyAttributes(initial.policy, nonce), "aria-hidden": attributes['aria-hidden'] ?? true, "data-dotquilt-surface": "", count: initial.count, speed: initial.speed, motion: "paused", ref: host, children: _jsx("span", { "data-dotquilt-react-static": "", "aria-hidden": true, children: _jsx("span", { "data-dotquilt-static": "", children: Array.from({ length: initial.count }, (_, index) => (_jsx("i", { className: "dot" }, index))) }) }) })] }));
|
|
26
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,82 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dotquilt/react",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "React components for Dotquilt: loading placeholders that hold the shape of your content, then hand over to it.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"homepage": "https://dotquilt.dev",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"react",
|
|
10
|
+
"loading",
|
|
11
|
+
"skeleton",
|
|
12
|
+
"placeholder",
|
|
13
|
+
"loader",
|
|
14
|
+
"accessibility",
|
|
15
|
+
"ssr"
|
|
16
|
+
],
|
|
17
|
+
"sideEffects": [
|
|
18
|
+
"**/*.css"
|
|
19
|
+
],
|
|
20
|
+
"files": [
|
|
21
|
+
"dist",
|
|
22
|
+
"README.md",
|
|
23
|
+
"LICENSE"
|
|
24
|
+
],
|
|
25
|
+
"exports": {
|
|
26
|
+
".": {
|
|
27
|
+
"types": "./dist/index.d.ts",
|
|
28
|
+
"import": "./dist/index.js"
|
|
29
|
+
},
|
|
30
|
+
"./skeleton": {
|
|
31
|
+
"types": "./dist/skeleton.d.ts",
|
|
32
|
+
"import": "./dist/skeleton.js"
|
|
33
|
+
},
|
|
34
|
+
"./region": {
|
|
35
|
+
"types": "./dist/region.d.ts",
|
|
36
|
+
"import": "./dist/region.js"
|
|
37
|
+
},
|
|
38
|
+
"./server": {
|
|
39
|
+
"types": "./dist/server.d.ts",
|
|
40
|
+
"import": "./dist/server.js"
|
|
41
|
+
},
|
|
42
|
+
"./typing": {
|
|
43
|
+
"types": "./dist/typing.d.ts",
|
|
44
|
+
"import": "./dist/typing.js"
|
|
45
|
+
},
|
|
46
|
+
"./text": {
|
|
47
|
+
"types": "./dist/text.d.ts",
|
|
48
|
+
"import": "./dist/text.js"
|
|
49
|
+
},
|
|
50
|
+
"./chart": {
|
|
51
|
+
"types": "./dist/chart.d.ts",
|
|
52
|
+
"import": "./dist/chart.js"
|
|
53
|
+
},
|
|
54
|
+
"./table": {
|
|
55
|
+
"types": "./dist/table.d.ts",
|
|
56
|
+
"import": "./dist/table.js"
|
|
57
|
+
},
|
|
58
|
+
"./styles/*.css": "./dist/*.css"
|
|
59
|
+
},
|
|
60
|
+
"dependencies": {
|
|
61
|
+
"dotquilt": "0.1.0"
|
|
62
|
+
},
|
|
63
|
+
"peerDependencies": {
|
|
64
|
+
"react": "^19.0.0",
|
|
65
|
+
"react-dom": "^19.0.0"
|
|
66
|
+
},
|
|
67
|
+
"scripts": {
|
|
68
|
+
"build": "bun run ../../scripts/build-react.ts",
|
|
69
|
+
"check": "tsc --noEmit -p tsconfig.json",
|
|
70
|
+
"test": "bun test test"
|
|
71
|
+
},
|
|
72
|
+
"author": "Derenik Khachatryan",
|
|
73
|
+
"repository": {
|
|
74
|
+
"type": "git",
|
|
75
|
+
"url": "git+https://github.com/b4rb13/dot-loaders.git",
|
|
76
|
+
"directory": "packages/react"
|
|
77
|
+
},
|
|
78
|
+
"publishConfig": {
|
|
79
|
+
"registry": "https://registry.npmjs.org/",
|
|
80
|
+
"access": "public"
|
|
81
|
+
}
|
|
82
|
+
}
|