@021.is/brand-studio 0.3.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/AGENTS.md +63 -0
- package/LICENSE +21 -0
- package/README.md +117 -0
- package/dist/BrandStudio-D2DcT8Fu.d.ts +26 -0
- package/dist/app/index.d.ts +25 -0
- package/dist/app/index.js +4 -0
- package/dist/chunk-55AYEWNQ.js +84 -0
- package/dist/chunk-7325RQRP.js +275 -0
- package/dist/chunk-JQV3ASME.js +3327 -0
- package/dist/chunk-LJ4HZCAP.js +69 -0
- package/dist/chunk-QT5N4K7D.js +8 -0
- package/dist/chunk-Z2DJJJDC.js +1196 -0
- package/dist/chunk-ZE5UZAY6.js +113 -0
- package/dist/color/index.d.ts +19 -0
- package/dist/color/index.js +1 -0
- package/dist/contrast-TVW3pzdd.d.ts +19 -0
- package/dist/define/index.d.ts +25 -0
- package/dist/define/index.js +2 -0
- package/dist/generateScheme-BDDcIzA3.d.ts +97 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +8 -0
- package/dist/loading/index.d.ts +86 -0
- package/dist/loading/index.js +3 -0
- package/dist/motion/index.d.ts +197 -0
- package/dist/motion/index.js +2 -0
- package/dist/shapes/index.d.ts +62 -0
- package/dist/shapes/index.js +1 -0
- package/dist/types-PWNYyaBF.d.ts +66 -0
- package/package.json +93 -0
package/AGENTS.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# AGENTS.md — @021.is/brand-studio
|
|
2
|
+
|
|
3
|
+
> Read this BEFORE you touch anything. Update it when scope or contracts change.
|
|
4
|
+
|
|
5
|
+
## What this is
|
|
6
|
+
|
|
7
|
+
A **generic, publishable** brand-kit toolkit (npm/GitHub Packages, `@021.is/brand-studio`, used by delvix, zeropost.de, startinaachen.de, and anyone in the org incl. Nikita). It provides:
|
|
8
|
+
|
|
9
|
+
1. **A Material Design 3 color engine** (`src/color/`) — `generateScheme({ seed, secondary?, tertiary?, neutral?, contrastLevel?, variant?, overrides? })` returns a complete `{ light, dark }` MD3 role set (primary/onPrimary/primaryContainer/.../surface/onSurface/outline/...). Built on Google's `@material/material-color-utilities` (HCT). `schemeToCssText` emits `--md-*` vars for light + `.dark`.
|
|
10
|
+
2. **`<BrandStudio>`** — a mountable `/brand` page (overview/logo/colors/type/icons/motion/download). It injects `--md-*` vars and themes itself from them, so it renders contrast-correct in both modes.
|
|
11
|
+
3. **Composable primitives** — shapes (`Squircle`, `Ring`, `Disc`), generic loading marks (`Spinner`/`Ring`/`Pulse`), motion helpers (`Sweep`, `Drift`, `PulseLoop`, `RingDraw`, `Wobble`, `AppearGrow`, `Sequence`, `Strikethrough`).
|
|
12
|
+
4. **`defineBrand()`** — config helper; resolves `config.scheme` from `config.color`.
|
|
13
|
+
|
|
14
|
+
## THE CARDINAL RULE — nothing brand-specific lives here
|
|
15
|
+
|
|
16
|
+
**No logos. No icon catalog. No hardcoded palette. No brand copy.** The lib is the toolkit; brand IP lives in each host app (`<app>/src/brand/`). If you find a brand glyph, mark, or color creeping into `src/`, it's a bug — pull it out into the consuming app and pass it via props (`staticLogo`, `animatedLogo`, `icons`). This is enforceable by `grep`: a brand name / postal glyph / forest-green hex in `src/` is a regression. (History: v0.2.x had zeropost's mailbox baked in; v0.3.0 ripped it out.)
|
|
17
|
+
|
|
18
|
+
## Doctrine
|
|
19
|
+
|
|
20
|
+
- **Color comes from a seed, not hand-picked hex.** Brands give a seed (+ optional key colors / overrides); the engine derives everything, contrast-guaranteed.
|
|
21
|
+
- **Each project owns its logo + icons.** Pass them as `ReactNode` props.
|
|
22
|
+
- **Zero commercial runtime dep.** Framer Motion (MIT, peer) for animation; material-color-utilities (Apache-2.0) bundled. No SaaS, no editor lock-in.
|
|
23
|
+
- **SSR-safe SVG render path. Tailwind-agnostic** (inline styles / CSS vars, never framework class names).
|
|
24
|
+
|
|
25
|
+
## Stack
|
|
26
|
+
|
|
27
|
+
TypeScript strict + `noUncheckedIndexedAccess` · React 19 + Framer Motion 12 (peers) · `@material/material-color-utilities` (bundled) · tsup ESM-only · Biome · Vitest.
|
|
28
|
+
|
|
29
|
+
## Layout
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
src/
|
|
33
|
+
├── index.ts Top-level re-exports
|
|
34
|
+
├── color/ MD3 engine: roles, generateScheme, cssVars, contrast
|
|
35
|
+
├── shapes/ Ring, Squircle, Disc (generic geometric primitives)
|
|
36
|
+
├── motion/ Generic animation helpers
|
|
37
|
+
├── loading/ Spinner/Ring/Pulse loading marks + LoadingMark dispatch
|
|
38
|
+
├── app/ <BrandStudio> + sections (themed via --md-* vars)
|
|
39
|
+
├── define/ defineBrand() + BrandConfig
|
|
40
|
+
└── types.ts Shared const-as-object enums + BrandConfig
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Hard rules
|
|
44
|
+
|
|
45
|
+
- **No `any`** (use `unknown` + narrowing). **Const-as-object enums**, never string-literal unions in signatures.
|
|
46
|
+
- **Named exports only.** **No CSS framework lock-in** — inline `style` / `var(--md-*)`, accept `className`.
|
|
47
|
+
- Sections theme from `var(--md-<role>)`, never from a hand-authored palette.
|
|
48
|
+
|
|
49
|
+
## Build + publish
|
|
50
|
+
|
|
51
|
+
- `bun run build` (tsup + `scripts/add-use-client.mjs`) → `dist/`. `bun run typecheck` + `bun run lint` green before commit.
|
|
52
|
+
- `npm pack` → tgz (consumers currently vendor the tgz under `<app>/vendor/`). To publish: `npm publish` to GitHub Packages needs `NODE_AUTH_TOKEN` with `write:packages` (same as `@021is/spine-*`). **Only publish on Edvard's explicit OK.**
|
|
53
|
+
- Bump `version` on any change; consumers re-vendor the new tgz + `bun install`.
|
|
54
|
+
|
|
55
|
+
## Active threads
|
|
56
|
+
|
|
57
|
+
- **v0.3.0 (current) — generic + MD3.** ✅ Ripped out all zeropost/postal content (icons, mailbox marks, FlagDroop/Stamp motions, forest/cream defaults). Added the MD3 color engine + seed-based `defineBrand`. Sections render consumer content (Icons/Motion) + the full MD3 role set (Colors). `private:false`, publishable.
|
|
58
|
+
- **v0.4.0 — export CLI.** `npx brand-studio export ./brand.config.ts` → icon.svg / apple-icon.png / og.png (satori/resvg).
|
|
59
|
+
- **v1.0.0 — visual editor + plugin API.**
|
|
60
|
+
|
|
61
|
+
## See
|
|
62
|
+
|
|
63
|
+
- `../axon/knowledge/spine-rules.md` · `../axon/knowledge/code.md`
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 edvone (Edvard Grei)
|
|
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
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
<h1 align="center">@021.is/brand-studio</h1>
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<strong>Generic MD3 brand toolkit for React.</strong><br/>
|
|
5
|
+
Seed colour to a full light + dark Material Design 3 role set, composable SVG primitives, a mountable <code>/brand</code> page. Ships no brand content.
|
|
6
|
+
</p>
|
|
7
|
+
|
|
8
|
+
<p align="center">
|
|
9
|
+
<a href="https://www.npmjs.com/package/@021.is/brand-studio"><img src="https://img.shields.io/npm/v/@021.is/brand-studio.svg?color=2d2d2d" alt="npm" /></a>
|
|
10
|
+
<a href="https://www.npmjs.com/package/@021.is/brand-studio"><img src="https://img.shields.io/npm/dm/@021.is/brand-studio.svg?color=666" alt="downloads" /></a>
|
|
11
|
+
<a href="https://github.com/021is/brand-studio/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-black.svg" alt="MIT" /></a>
|
|
12
|
+
<a href="https://bundlephobia.com/package/@021.is/brand-studio"><img src="https://img.shields.io/bundlephobia/minzip/@021.is/brand-studio?label=min%2Bgzip&color=black" alt="bundle size" /></a>
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Why
|
|
18
|
+
|
|
19
|
+
Brand work in a React app usually splits between hand-authored hex palettes that drift across light + dark, hand-drawn marks that get pasted into every product, and a `/brand` page that nobody maintains. brand-studio replaces all three with one toolkit:
|
|
20
|
+
|
|
21
|
+
- **Seed in, full scheme out.** One hex seed produces a contrast-correct MD3 role set for both light and dark via Google's `@material/material-color-utilities` (HCT).
|
|
22
|
+
- **Composable SVG primitives.** `Squircle`, `Ring`, `Disc`, plus generic loading marks and motion helpers. Everything paints from `currentColor` or the MD3 vars the toolkit installs, so consumer-side theming is one line.
|
|
23
|
+
- **A mountable `/brand` page.** Drop `<BrandStudio>` on a catch-all route and you get a live brand kit (overview · logo · colors · type · icons · motion · download) themed from your seed.
|
|
24
|
+
- **Brand-content free.** No logos, no icon catalog, no hardcoded palette. Pass your own marks via `staticLogo` / `animatedLogo` / `icons`.
|
|
25
|
+
|
|
26
|
+
## Install
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
bun add @021.is/brand-studio
|
|
30
|
+
# or
|
|
31
|
+
npm install @021.is/brand-studio
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Peers: `react ^19`, `react-dom ^19`, `framer-motion ^11 || ^12`.
|
|
35
|
+
|
|
36
|
+
## Declare your brand
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
// brand.config.ts
|
|
40
|
+
import { defineBrand } from "@021.is/brand-studio/define";
|
|
41
|
+
|
|
42
|
+
export default defineBrand({
|
|
43
|
+
name: "Acme",
|
|
44
|
+
tagline: "We make things.",
|
|
45
|
+
color: {
|
|
46
|
+
seed: "#3B82F6", // required — the MD3 scheme derives from this
|
|
47
|
+
tertiary: "#22D3EE", // optional accent
|
|
48
|
+
// secondary, neutral, contrastLevel (-1..1), variant, overrides also supported
|
|
49
|
+
},
|
|
50
|
+
type: { sans: "Inter", mono: "JetBrains Mono" },
|
|
51
|
+
voice: ["Plain. Not corporate.", "Flat price. No surprises."],
|
|
52
|
+
});
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
`defineBrand` eagerly resolves `config.scheme` (the full `{ light, dark }` role set) so downstream consumers never wait on a derivation.
|
|
56
|
+
|
|
57
|
+
## Mount the brand page
|
|
58
|
+
|
|
59
|
+
```tsx
|
|
60
|
+
// app/brand/[[...path]]/page.tsx
|
|
61
|
+
import config from "@/../brand.config";
|
|
62
|
+
import { BrandStudio } from "@021.is/brand-studio";
|
|
63
|
+
import { MyLogo, MyAnimatedMark } from "@/brand/Logo";
|
|
64
|
+
|
|
65
|
+
export default async function BrandPage({ params }: { params: Promise<{ path?: string[] }> }) {
|
|
66
|
+
const { path = [] } = await params;
|
|
67
|
+
return (
|
|
68
|
+
<BrandStudio
|
|
69
|
+
config={config}
|
|
70
|
+
route={path}
|
|
71
|
+
basePath="/brand"
|
|
72
|
+
staticLogo={<MyLogo />}
|
|
73
|
+
animatedLogo={<MyAnimatedMark />}
|
|
74
|
+
icons={[{ node: <MyGlyph />, label: "glyph" }]}
|
|
75
|
+
/>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
`<BrandStudio>` injects the MD3 role set as `--md-*` CSS vars (light by default, dark under an ancestor `.dark`) and themes itself from them — contrast guaranteed in both modes without writing CSS.
|
|
81
|
+
|
|
82
|
+
## Use the colour engine directly
|
|
83
|
+
|
|
84
|
+
```ts
|
|
85
|
+
import { generateScheme, schemeToCssText } from "@021.is/brand-studio/color";
|
|
86
|
+
|
|
87
|
+
const scheme = generateScheme({ seed: "#2EE5A8", tertiary: "#94B5F7" });
|
|
88
|
+
// scheme.light.primary, scheme.dark.onSurface, ...
|
|
89
|
+
|
|
90
|
+
const css = schemeToCssText(scheme);
|
|
91
|
+
// ":root { --md-primary: ... } .dark { --md-primary: ... }"
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
The engine supports `secondary`, `tertiary`, `neutral`, `neutralVariant`, `error`, `contrastLevel` (`-1.0..1.0`), `variant` (`tonalSpot` / `vibrant` / `expressive` / `neutral` / `monochrome` / `fidelity` / `content`), and an `overrides` map for any role you want to pin literally.
|
|
95
|
+
|
|
96
|
+
## Exports
|
|
97
|
+
|
|
98
|
+
| Subpath | What's in it |
|
|
99
|
+
| --- | --- |
|
|
100
|
+
| `.` | Everything — `BrandStudio`, `defineBrand`, shapes, motion, loading marks |
|
|
101
|
+
| `/color` | `generateScheme`, `schemeToCssText`, role types, contrast helpers |
|
|
102
|
+
| `/shapes` | `Squircle`, `Ring`, `Disc` |
|
|
103
|
+
| `/motion` | `Sweep`, `Drift`, `PulseLoop`, `RingDraw`, `Wobble`, `AppearGrow`, `Sequence`, `Strikethrough` |
|
|
104
|
+
| `/loading` | `SpinnerLoadingMark`, `RingLoadingMark`, `PulseLoadingMark`, `LoadingMark` dispatcher |
|
|
105
|
+
| `/app` | `<BrandStudio>` + sections (when you want them standalone) |
|
|
106
|
+
| `/define` | `defineBrand`, `BrandConfig` type |
|
|
107
|
+
|
|
108
|
+
## Philosophy
|
|
109
|
+
|
|
110
|
+
- **Colour from a seed, not hand-picked hex.** Hex defaults invite drift. The MD3 engine derives the entire palette, and contrast is part of the contract.
|
|
111
|
+
- **Each project owns its logo and icons.** Passed as `ReactNode` props.
|
|
112
|
+
- **Zero commercial runtime deps.** Framer Motion (MIT) as peer; `@material/material-color-utilities` (Apache-2.0) bundled. No SaaS, no editor lock-in.
|
|
113
|
+
- **SSR-safe and Tailwind-agnostic.** Inline styles + CSS vars; never a framework class name.
|
|
114
|
+
|
|
115
|
+
## License
|
|
116
|
+
|
|
117
|
+
MIT © [edvone](https://edvone.dev)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { B as BrandConfig } from './types-PWNYyaBF.js';
|
|
4
|
+
|
|
5
|
+
type BrandIcon = {
|
|
6
|
+
node: ReactNode;
|
|
7
|
+
label?: string;
|
|
8
|
+
};
|
|
9
|
+
type BrandStudioProps = {
|
|
10
|
+
config: BrandConfig;
|
|
11
|
+
/** URL-segments past the mount point, e.g. `["logo"]` for `/brand/logo`. */
|
|
12
|
+
route?: string[];
|
|
13
|
+
/** Mount path (no trailing slash). Default `/brand`. */
|
|
14
|
+
basePath?: string;
|
|
15
|
+
/** Host app's static brand mark (Logo + Icons + Download sections). */
|
|
16
|
+
staticLogo?: ReactNode;
|
|
17
|
+
/** Optional dark-surface variant of the static mark (Download). */
|
|
18
|
+
staticLogoDark?: ReactNode;
|
|
19
|
+
/** Host app's animated brand mark (Logo + Motion loading demo). */
|
|
20
|
+
animatedLogo?: ReactNode;
|
|
21
|
+
/** Host app's own glyphs for the Icons section. The lib ships none. */
|
|
22
|
+
icons?: BrandIcon[];
|
|
23
|
+
};
|
|
24
|
+
declare function BrandStudio({ config, route, basePath, staticLogo, staticLogoDark, animatedLogo, icons, }: BrandStudioProps): react_jsx_runtime.JSX.Element;
|
|
25
|
+
|
|
26
|
+
export { type BrandIcon as B, BrandStudio as a, type BrandStudioProps as b };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export { B as BrandIcon, a as BrandStudio, b as BrandStudioProps } from '../BrandStudio-D2DcT8Fu.js';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
import { a as BrandStudioSection } from '../types-PWNYyaBF.js';
|
|
5
|
+
export { c as contrastBadge, a as contrastRatio, r as relativeLuminance } from '../contrast-TVW3pzdd.js';
|
|
6
|
+
import '../generateScheme-BDDcIzA3.js';
|
|
7
|
+
|
|
8
|
+
type NavItem = {
|
|
9
|
+
section: BrandStudioSection;
|
|
10
|
+
label: string;
|
|
11
|
+
href: string;
|
|
12
|
+
};
|
|
13
|
+
declare function buildNavigation(basePath: string): NavItem[];
|
|
14
|
+
type NavigationProps = {
|
|
15
|
+
current: BrandStudioSection;
|
|
16
|
+
basePath: string;
|
|
17
|
+
renderLink: (props: {
|
|
18
|
+
href: string;
|
|
19
|
+
children: ReactNode;
|
|
20
|
+
isActive: boolean;
|
|
21
|
+
}) => ReactNode;
|
|
22
|
+
};
|
|
23
|
+
declare function Navigation({ current, basePath, renderLink }: NavigationProps): react_jsx_runtime.JSX.Element;
|
|
24
|
+
|
|
25
|
+
export { type NavItem, Navigation, type NavigationProps, buildNavigation };
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { motion } from 'framer-motion';
|
|
3
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
// src/types.ts
|
|
6
|
+
var LoadingVariant = {
|
|
7
|
+
Spinner: "spinner",
|
|
8
|
+
Ring: "ring",
|
|
9
|
+
Pulse: "pulse"
|
|
10
|
+
};
|
|
11
|
+
var BrandStudioSection = {
|
|
12
|
+
Overview: "overview",
|
|
13
|
+
Logo: "logo",
|
|
14
|
+
Colors: "colors",
|
|
15
|
+
Typography: "typography",
|
|
16
|
+
Icons: "icons",
|
|
17
|
+
Motion: "motion",
|
|
18
|
+
Download: "download"
|
|
19
|
+
};
|
|
20
|
+
var MotionState = {
|
|
21
|
+
Idle: "idle",
|
|
22
|
+
Loading: "loading",
|
|
23
|
+
Success: "success",
|
|
24
|
+
Empty: "empty"
|
|
25
|
+
};
|
|
26
|
+
function SpinnerLoadingMark({
|
|
27
|
+
size = 200,
|
|
28
|
+
background = "transparent",
|
|
29
|
+
defs,
|
|
30
|
+
foreground = "currentColor",
|
|
31
|
+
weight = 18,
|
|
32
|
+
cycleMs = 900,
|
|
33
|
+
className,
|
|
34
|
+
style,
|
|
35
|
+
ariaLabel = "Loading"
|
|
36
|
+
}) {
|
|
37
|
+
return /* @__PURE__ */ jsxs(
|
|
38
|
+
"svg",
|
|
39
|
+
{
|
|
40
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
41
|
+
viewBox: "0 0 256 256",
|
|
42
|
+
width: size,
|
|
43
|
+
height: size,
|
|
44
|
+
role: "img",
|
|
45
|
+
"aria-label": ariaLabel,
|
|
46
|
+
className,
|
|
47
|
+
style,
|
|
48
|
+
children: [
|
|
49
|
+
defs ? /* @__PURE__ */ jsx("defs", { children: defs }) : null,
|
|
50
|
+
background !== "transparent" ? /* @__PURE__ */ jsx("rect", { width: "256", height: "256", rx: "56", fill: background }) : null,
|
|
51
|
+
/* @__PURE__ */ jsx(
|
|
52
|
+
"circle",
|
|
53
|
+
{
|
|
54
|
+
cx: 128,
|
|
55
|
+
cy: 128,
|
|
56
|
+
r: 74,
|
|
57
|
+
fill: "none",
|
|
58
|
+
stroke: foreground,
|
|
59
|
+
strokeWidth: weight,
|
|
60
|
+
opacity: 0.2
|
|
61
|
+
}
|
|
62
|
+
),
|
|
63
|
+
/* @__PURE__ */ jsx(
|
|
64
|
+
motion.circle,
|
|
65
|
+
{
|
|
66
|
+
cx: 128,
|
|
67
|
+
cy: 128,
|
|
68
|
+
r: 74,
|
|
69
|
+
fill: "none",
|
|
70
|
+
stroke: foreground,
|
|
71
|
+
strokeWidth: weight,
|
|
72
|
+
strokeLinecap: "round",
|
|
73
|
+
strokeDasharray: `${(74 * 2 * Math.PI * 0.25).toFixed(1)} ${(74 * 2 * Math.PI).toFixed(1)}`,
|
|
74
|
+
style: { transformOrigin: "128px 128px", transformBox: "view-box" },
|
|
75
|
+
animate: { rotate: 360 },
|
|
76
|
+
transition: { duration: cycleMs / 1e3, ease: "linear", repeat: Number.POSITIVE_INFINITY }
|
|
77
|
+
}
|
|
78
|
+
)
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export { BrandStudioSection, LoadingVariant, MotionState, SpinnerLoadingMark };
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { motion } from 'framer-motion';
|
|
3
|
+
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
4
|
+
import { Children, isValidElement, useId } from 'react';
|
|
5
|
+
|
|
6
|
+
function AppearGrow({
|
|
7
|
+
children,
|
|
8
|
+
delay = 0,
|
|
9
|
+
duration = 600,
|
|
10
|
+
from = 0,
|
|
11
|
+
to = 1,
|
|
12
|
+
origin = "50% 50%",
|
|
13
|
+
loop = false
|
|
14
|
+
}) {
|
|
15
|
+
return /* @__PURE__ */ jsx(
|
|
16
|
+
motion.g,
|
|
17
|
+
{
|
|
18
|
+
style: { transformOrigin: origin, transformBox: "fill-box" },
|
|
19
|
+
initial: { opacity: 0, scale: from },
|
|
20
|
+
animate: { opacity: 1, scale: to },
|
|
21
|
+
transition: {
|
|
22
|
+
delay: delay / 1e3,
|
|
23
|
+
duration: duration / 1e3,
|
|
24
|
+
ease: [0.16, 1, 0.3, 1],
|
|
25
|
+
repeat: loop ? Number.POSITIVE_INFINITY : 0,
|
|
26
|
+
repeatType: "loop",
|
|
27
|
+
repeatDelay: 0.6
|
|
28
|
+
},
|
|
29
|
+
children
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
function RingDraw({
|
|
34
|
+
cx = 128,
|
|
35
|
+
cy = 128,
|
|
36
|
+
r = 74,
|
|
37
|
+
strokeWidth = 40,
|
|
38
|
+
color = "currentColor",
|
|
39
|
+
duration = 700,
|
|
40
|
+
delay = 0,
|
|
41
|
+
loop = false,
|
|
42
|
+
className,
|
|
43
|
+
style
|
|
44
|
+
}) {
|
|
45
|
+
return /* @__PURE__ */ jsx(
|
|
46
|
+
motion.circle,
|
|
47
|
+
{
|
|
48
|
+
cx,
|
|
49
|
+
cy,
|
|
50
|
+
r,
|
|
51
|
+
fill: "none",
|
|
52
|
+
stroke: color,
|
|
53
|
+
strokeWidth,
|
|
54
|
+
strokeLinecap: "round",
|
|
55
|
+
className,
|
|
56
|
+
style,
|
|
57
|
+
initial: { pathLength: 0, opacity: 0 },
|
|
58
|
+
animate: { pathLength: 1, opacity: 1 },
|
|
59
|
+
transition: {
|
|
60
|
+
delay: delay / 1e3,
|
|
61
|
+
duration: duration / 1e3,
|
|
62
|
+
ease: "easeInOut",
|
|
63
|
+
opacity: { duration: 0.15, delay: delay / 1e3 },
|
|
64
|
+
repeat: loop ? Number.POSITIVE_INFINITY : 0,
|
|
65
|
+
repeatType: "loop",
|
|
66
|
+
repeatDelay: 1.5
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
function PulseLoop({
|
|
72
|
+
children,
|
|
73
|
+
from = 0.92,
|
|
74
|
+
to = 1.06,
|
|
75
|
+
duration = 1600,
|
|
76
|
+
origin = "50% 50%",
|
|
77
|
+
fadeWithScale = false
|
|
78
|
+
}) {
|
|
79
|
+
return /* @__PURE__ */ jsx(
|
|
80
|
+
motion.g,
|
|
81
|
+
{
|
|
82
|
+
style: { transformOrigin: origin, transformBox: "fill-box" },
|
|
83
|
+
animate: fadeWithScale ? { scale: [from, to, from], opacity: [0.85, 1, 0.85] } : { scale: [from, to, from] },
|
|
84
|
+
transition: {
|
|
85
|
+
duration: duration / 1e3,
|
|
86
|
+
ease: "easeInOut",
|
|
87
|
+
repeat: Number.POSITIVE_INFINITY,
|
|
88
|
+
repeatType: "loop"
|
|
89
|
+
},
|
|
90
|
+
children
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
function SequenceStep(_) {
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
function Sequence({ children, loop = false, delay = 0, loopGap = 600 }) {
|
|
98
|
+
const steps = [];
|
|
99
|
+
let cursor = delay;
|
|
100
|
+
Children.forEach(children, (child) => {
|
|
101
|
+
if (!isValidElement(child)) return;
|
|
102
|
+
const stepProps = child.props;
|
|
103
|
+
const duration = stepProps.duration ?? 600;
|
|
104
|
+
const gap = stepProps.gap ?? 0;
|
|
105
|
+
const startMs = cursor + gap;
|
|
106
|
+
const endMs = startMs + duration;
|
|
107
|
+
steps.push({
|
|
108
|
+
startMs,
|
|
109
|
+
endMs,
|
|
110
|
+
ease: stepProps.ease ?? [0.16, 1, 0.3, 1],
|
|
111
|
+
persist: stepProps.persist ?? false,
|
|
112
|
+
child: stepProps.children
|
|
113
|
+
});
|
|
114
|
+
cursor = endMs;
|
|
115
|
+
});
|
|
116
|
+
const totalMs = cursor + loopGap;
|
|
117
|
+
const totalSec = totalMs / 1e3;
|
|
118
|
+
return /* @__PURE__ */ jsx(Fragment, { children: steps.map((step, i) => {
|
|
119
|
+
const t0 = step.startMs / totalMs;
|
|
120
|
+
const t1 = Math.min(1, (step.startMs + 120) / totalMs);
|
|
121
|
+
const t2 = step.persist ? 1 : step.endMs / totalMs;
|
|
122
|
+
const t3 = step.persist ? 1 : Math.min(1, (step.endMs + 200) / totalMs);
|
|
123
|
+
const values = step.persist ? [0, 0, 1, 1] : [0, 0, 1, 1, 0];
|
|
124
|
+
const times = step.persist ? [0, t0, t1, 1] : [0, t0, t1, t2, t3];
|
|
125
|
+
return /* @__PURE__ */ jsx(
|
|
126
|
+
motion.g,
|
|
127
|
+
{
|
|
128
|
+
initial: { opacity: 0 },
|
|
129
|
+
animate: { opacity: values },
|
|
130
|
+
transition: {
|
|
131
|
+
duration: totalSec,
|
|
132
|
+
times,
|
|
133
|
+
ease: "linear",
|
|
134
|
+
repeat: loop ? Number.POSITIVE_INFINITY : 0,
|
|
135
|
+
repeatType: "loop"
|
|
136
|
+
},
|
|
137
|
+
children: step.child
|
|
138
|
+
},
|
|
139
|
+
i
|
|
140
|
+
);
|
|
141
|
+
}) });
|
|
142
|
+
}
|
|
143
|
+
Sequence.Step = SequenceStep;
|
|
144
|
+
function Strikethrough({
|
|
145
|
+
x1,
|
|
146
|
+
y1,
|
|
147
|
+
x2,
|
|
148
|
+
y2,
|
|
149
|
+
color = "currentColor",
|
|
150
|
+
strokeWidth = 6,
|
|
151
|
+
duration = 360,
|
|
152
|
+
delay = 0,
|
|
153
|
+
loop = false,
|
|
154
|
+
className,
|
|
155
|
+
style
|
|
156
|
+
}) {
|
|
157
|
+
return /* @__PURE__ */ jsx(
|
|
158
|
+
motion.line,
|
|
159
|
+
{
|
|
160
|
+
x1,
|
|
161
|
+
y1,
|
|
162
|
+
x2,
|
|
163
|
+
y2,
|
|
164
|
+
stroke: color,
|
|
165
|
+
strokeWidth,
|
|
166
|
+
strokeLinecap: "round",
|
|
167
|
+
className,
|
|
168
|
+
style,
|
|
169
|
+
initial: { pathLength: 0, opacity: 0 },
|
|
170
|
+
animate: { pathLength: 1, opacity: 1 },
|
|
171
|
+
transition: {
|
|
172
|
+
duration: duration / 1e3,
|
|
173
|
+
delay: delay / 1e3,
|
|
174
|
+
ease: [0.65, 0, 0.35, 1],
|
|
175
|
+
opacity: { duration: 0.1, delay: delay / 1e3 },
|
|
176
|
+
repeat: loop ? Number.POSITIVE_INFINITY : 0,
|
|
177
|
+
repeatType: "loop",
|
|
178
|
+
repeatDelay: 1.2
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
function Sweep({
|
|
184
|
+
children,
|
|
185
|
+
width = 256,
|
|
186
|
+
height = 256,
|
|
187
|
+
direction = "left-to-right",
|
|
188
|
+
delay = 0,
|
|
189
|
+
duration = 700,
|
|
190
|
+
loop = false
|
|
191
|
+
}) {
|
|
192
|
+
const id = useId().replace(/:/g, "");
|
|
193
|
+
const clipId = `bs-sweep-${id}`;
|
|
194
|
+
const isHorizontal = direction === "left-to-right" || direction === "right-to-left";
|
|
195
|
+
const from = direction === "left-to-right" || direction === "top-to-bottom" ? 0 : isHorizontal ? width : height;
|
|
196
|
+
const to = direction === "left-to-right" || direction === "top-to-bottom" ? isHorizontal ? width : height : 0;
|
|
197
|
+
return /* @__PURE__ */ jsxs("g", { children: [
|
|
198
|
+
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", { id: clipId, children: isHorizontal ? /* @__PURE__ */ jsx(
|
|
199
|
+
motion.rect,
|
|
200
|
+
{
|
|
201
|
+
x: direction === "left-to-right" ? 0 : void 0,
|
|
202
|
+
y: 0,
|
|
203
|
+
height,
|
|
204
|
+
initial: { width: from },
|
|
205
|
+
animate: { width: to },
|
|
206
|
+
transition: {
|
|
207
|
+
duration: duration / 1e3,
|
|
208
|
+
delay: delay / 1e3,
|
|
209
|
+
ease: [0.16, 1, 0.3, 1],
|
|
210
|
+
repeat: loop ? Number.POSITIVE_INFINITY : 0,
|
|
211
|
+
repeatType: "loop",
|
|
212
|
+
repeatDelay: 1.2
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
) : /* @__PURE__ */ jsx(
|
|
216
|
+
motion.rect,
|
|
217
|
+
{
|
|
218
|
+
x: 0,
|
|
219
|
+
y: direction === "top-to-bottom" ? 0 : void 0,
|
|
220
|
+
width,
|
|
221
|
+
initial: { height: from },
|
|
222
|
+
animate: { height: to },
|
|
223
|
+
transition: {
|
|
224
|
+
duration: duration / 1e3,
|
|
225
|
+
delay: delay / 1e3,
|
|
226
|
+
ease: [0.16, 1, 0.3, 1],
|
|
227
|
+
repeat: loop ? Number.POSITIVE_INFINITY : 0,
|
|
228
|
+
repeatType: "loop",
|
|
229
|
+
repeatDelay: 1.2
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
) }) }),
|
|
233
|
+
/* @__PURE__ */ jsx("g", { clipPath: `url(#${clipId})`, children })
|
|
234
|
+
] });
|
|
235
|
+
}
|
|
236
|
+
function Wobble({
|
|
237
|
+
children,
|
|
238
|
+
amplitude = 6,
|
|
239
|
+
duration = 1400,
|
|
240
|
+
origin = "50% 100%",
|
|
241
|
+
delay = 0
|
|
242
|
+
}) {
|
|
243
|
+
return /* @__PURE__ */ jsx(
|
|
244
|
+
motion.g,
|
|
245
|
+
{
|
|
246
|
+
style: { transformOrigin: origin, transformBox: "fill-box" },
|
|
247
|
+
animate: { rotate: [-amplitude, amplitude, -amplitude] },
|
|
248
|
+
transition: {
|
|
249
|
+
duration: duration / 1e3,
|
|
250
|
+
delay: delay / 1e3,
|
|
251
|
+
ease: "easeInOut",
|
|
252
|
+
repeat: Number.POSITIVE_INFINITY,
|
|
253
|
+
repeatType: "loop"
|
|
254
|
+
},
|
|
255
|
+
children
|
|
256
|
+
}
|
|
257
|
+
);
|
|
258
|
+
}
|
|
259
|
+
function Drift({ children, dx = 0, dy = 4, duration = 3e3 }) {
|
|
260
|
+
return /* @__PURE__ */ jsx(
|
|
261
|
+
motion.g,
|
|
262
|
+
{
|
|
263
|
+
animate: { x: [0, dx, 0], y: [0, dy, 0] },
|
|
264
|
+
transition: {
|
|
265
|
+
duration: duration / 1e3,
|
|
266
|
+
ease: "easeInOut",
|
|
267
|
+
repeat: Number.POSITIVE_INFINITY,
|
|
268
|
+
repeatType: "loop"
|
|
269
|
+
},
|
|
270
|
+
children
|
|
271
|
+
}
|
|
272
|
+
);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
export { AppearGrow, Drift, PulseLoop, RingDraw, Sequence, SequenceStep, Strikethrough, Sweep, Wobble };
|