motionwind-core 2.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/README.md +44 -0
- package/dist/adapter.cjs +31 -0
- package/dist/adapter.cjs.map +1 -0
- package/dist/adapter.d.cts +14 -0
- package/dist/adapter.d.ts +14 -0
- package/dist/adapter.js +3 -0
- package/dist/adapter.js.map +1 -0
- package/dist/chunk-A7EAMXLY.js +1098 -0
- package/dist/chunk-A7EAMXLY.js.map +1 -0
- package/dist/chunk-IJZCYKTO.js +352 -0
- package/dist/chunk-IJZCYKTO.js.map +1 -0
- package/dist/chunk-P6FC2RDE.js +25 -0
- package/dist/chunk-P6FC2RDE.js.map +1 -0
- package/dist/chunk-ULRTFOGX.js +28 -0
- package/dist/chunk-ULRTFOGX.js.map +1 -0
- package/dist/chunk-Z5I36REG.js +411 -0
- package/dist/chunk-Z5I36REG.js.map +1 -0
- package/dist/config.cjs +30 -0
- package/dist/config.cjs.map +1 -0
- package/dist/config.d.cts +1 -0
- package/dist/config.d.ts +1 -0
- package/dist/config.js +3 -0
- package/dist/config.js.map +1 -0
- package/dist/index.cjs +1970 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +18 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +60 -0
- package/dist/index.js.map +1 -0
- package/dist/parser.cjs +1690 -0
- package/dist/parser.cjs.map +1 -0
- package/dist/parser.d.cts +21 -0
- package/dist/parser.d.ts +21 -0
- package/dist/parser.js +6 -0
- package/dist/parser.js.map +1 -0
- package/dist/recipes.cjs +359 -0
- package/dist/recipes.cjs.map +1 -0
- package/dist/recipes.d.cts +19 -0
- package/dist/recipes.d.ts +19 -0
- package/dist/recipes.js +4 -0
- package/dist/recipes.js.map +1 -0
- package/dist/registry.cjs +421 -0
- package/dist/registry.cjs.map +1 -0
- package/dist/registry.d.cts +1 -0
- package/dist/registry.d.ts +1 -0
- package/dist/registry.js +3 -0
- package/dist/registry.js.map +1 -0
- package/dist/types-BYtWWSgh.d.cts +185 -0
- package/dist/types-BYtWWSgh.d.ts +185 -0
- package/llms.txt +77 -0
- package/package.json +96 -0
package/README.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# motionwind-core v2
|
|
2
|
+
|
|
3
|
+
The framework-independent parser, public types, syntax registry, configuration,
|
|
4
|
+
presets, plugin API, and adapter contract for Motionwind.
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
npm install motionwind-core@2
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
import {
|
|
12
|
+
defineConfig,
|
|
13
|
+
parseMotionClasses,
|
|
14
|
+
MOTIONWIND_SYNTAX_REGISTRY,
|
|
15
|
+
} from "motionwind-core";
|
|
16
|
+
|
|
17
|
+
const config = defineConfig({
|
|
18
|
+
adapter: "react",
|
|
19
|
+
strict: true,
|
|
20
|
+
reducedMotion: "user",
|
|
21
|
+
tokens: { durations: { fast: 160 } },
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const result = parseMotionClasses(
|
|
25
|
+
"p-4 animate-hover:scale-105 animate-duration-fast",
|
|
26
|
+
config,
|
|
27
|
+
);
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
`ParsedResult` is the stable Motion-first v2 intermediate representation. It
|
|
31
|
+
contains passthrough classes, gestures, transition, viewport, drag, layout,
|
|
32
|
+
scroll, variants, diagnostics, and `hasMotion`.
|
|
33
|
+
|
|
34
|
+
Extension entry points:
|
|
35
|
+
|
|
36
|
+
- `defineMotionwindPlugin()` adds presets, definitions, token transforms, and
|
|
37
|
+
diagnostics.
|
|
38
|
+
- `defineMotionwindAdapter()` maps `ParsedResult` to a runtime.
|
|
39
|
+
- `AdapterCapabilities` declares gestures, scroll, layout, drag, variants, SVG,
|
|
40
|
+
and reduced-motion support.
|
|
41
|
+
- `getSyntaxDefinitions()` and `MOTIONWIND_SYNTAX_REGISTRY` provide tooling data.
|
|
42
|
+
- `analyzeClassName()` and `sortMotionClasses()` power diagnostics and formatting.
|
|
43
|
+
|
|
44
|
+
MIT
|
package/dist/adapter.cjs
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// src/adapter.ts
|
|
4
|
+
function defineMotionwindAdapter(adapter) {
|
|
5
|
+
return adapter;
|
|
6
|
+
}
|
|
7
|
+
function unsupportedCapabilities(parsed, capabilities) {
|
|
8
|
+
const unsupported = [];
|
|
9
|
+
if (Object.keys(parsed.gestures).length > 0 && !capabilities.gestures)
|
|
10
|
+
unsupported.push("gestures");
|
|
11
|
+
if (Object.keys(parsed.scroll.values).length > 0 && !capabilities.scroll)
|
|
12
|
+
unsupported.push("scroll");
|
|
13
|
+
if (Object.keys(parsed.layoutConfig).length > 0 && !capabilities.layout)
|
|
14
|
+
unsupported.push("layout");
|
|
15
|
+
if (Object.keys(parsed.dragConfig).length > 0 && !capabilities.drag)
|
|
16
|
+
unsupported.push("drag");
|
|
17
|
+
if ((Object.keys(parsed.variants).length > 0 || Object.keys(parsed.variantState).length > 0) && !capabilities.variants)
|
|
18
|
+
unsupported.push("variants");
|
|
19
|
+
const svgProperties = /* @__PURE__ */ new Set(["pathLength", "pathOffset", "pathSpacing"]);
|
|
20
|
+
if (!capabilities.svg && Object.values(parsed.gestures).some(
|
|
21
|
+
(values) => Object.keys(values ?? {}).some((property) => svgProperties.has(property))
|
|
22
|
+
)) {
|
|
23
|
+
unsupported.push("svg");
|
|
24
|
+
}
|
|
25
|
+
return unsupported;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
exports.defineMotionwindAdapter = defineMotionwindAdapter;
|
|
29
|
+
exports.unsupportedCapabilities = unsupportedCapabilities;
|
|
30
|
+
//# sourceMappingURL=adapter.cjs.map
|
|
31
|
+
//# sourceMappingURL=adapter.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/adapter.ts"],"names":[],"mappings":";;;AAsBO,SAA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AAK,UAAU,EAAE,CAAA,CAAE,IAAA,CAAK,CAAC,QAAA,KAAa,aAAA,CAAc,GAAA,CAAI,QAAQ,CAAC;AAAA,GAC1E,EACA;AACA,IAAA,WAAA,CAAY,KAAK,KAAK,CAAA;AAAA,EACxB;AACA,EAAA,OAAO,WAAA;AACT","file":"adapter.cjs","sourcesContent":["import type { ParsedResult } from \"./types.js\";\n\nexport type MotionwindCapability =\n | \"gestures\"\n | \"scroll\"\n | \"layout\"\n | \"drag\"\n | \"variants\"\n | \"svg\"\n | \"reduced-motion\";\n\nexport type AdapterCapabilities = Readonly<\n Record<MotionwindCapability, boolean>\n>;\n\nexport interface MotionwindAdapter<TContext = unknown, TOutput = unknown> {\n name: string;\n version: string;\n capabilities: AdapterCapabilities;\n compile: (parsed: ParsedResult, context: TContext) => TOutput;\n}\n\nexport function defineMotionwindAdapter<\n TContext,\n TOutput,\n const T extends MotionwindAdapter<TContext, TOutput>,\n>(adapter: T): T {\n return adapter;\n}\n\nexport function unsupportedCapabilities(\n parsed: ParsedResult,\n capabilities: AdapterCapabilities,\n): MotionwindCapability[] {\n const unsupported: MotionwindCapability[] = [];\n if (Object.keys(parsed.gestures).length > 0 && !capabilities.gestures)\n unsupported.push(\"gestures\");\n if (Object.keys(parsed.scroll.values).length > 0 && !capabilities.scroll)\n unsupported.push(\"scroll\");\n if (Object.keys(parsed.layoutConfig).length > 0 && !capabilities.layout)\n unsupported.push(\"layout\");\n if (Object.keys(parsed.dragConfig).length > 0 && !capabilities.drag)\n unsupported.push(\"drag\");\n if (\n (Object.keys(parsed.variants).length > 0 ||\n Object.keys(parsed.variantState).length > 0) &&\n !capabilities.variants\n )\n unsupported.push(\"variants\");\n const svgProperties = new Set([\"pathLength\", \"pathOffset\", \"pathSpacing\"]);\n if (\n !capabilities.svg &&\n Object.values(parsed.gestures).some((values) =>\n Object.keys(values ?? {}).some((property) => svgProperties.has(property)),\n )\n ) {\n unsupported.push(\"svg\");\n }\n return unsupported;\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { j as ParsedResult } from './types-BYtWWSgh.cjs';
|
|
2
|
+
|
|
3
|
+
type MotionwindCapability = "gestures" | "scroll" | "layout" | "drag" | "variants" | "svg" | "reduced-motion";
|
|
4
|
+
type AdapterCapabilities = Readonly<Record<MotionwindCapability, boolean>>;
|
|
5
|
+
interface MotionwindAdapter<TContext = unknown, TOutput = unknown> {
|
|
6
|
+
name: string;
|
|
7
|
+
version: string;
|
|
8
|
+
capabilities: AdapterCapabilities;
|
|
9
|
+
compile: (parsed: ParsedResult, context: TContext) => TOutput;
|
|
10
|
+
}
|
|
11
|
+
declare function defineMotionwindAdapter<TContext, TOutput, const T extends MotionwindAdapter<TContext, TOutput>>(adapter: T): T;
|
|
12
|
+
declare function unsupportedCapabilities(parsed: ParsedResult, capabilities: AdapterCapabilities): MotionwindCapability[];
|
|
13
|
+
|
|
14
|
+
export { type AdapterCapabilities, type MotionwindAdapter, type MotionwindCapability, defineMotionwindAdapter, unsupportedCapabilities };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { j as ParsedResult } from './types-BYtWWSgh.js';
|
|
2
|
+
|
|
3
|
+
type MotionwindCapability = "gestures" | "scroll" | "layout" | "drag" | "variants" | "svg" | "reduced-motion";
|
|
4
|
+
type AdapterCapabilities = Readonly<Record<MotionwindCapability, boolean>>;
|
|
5
|
+
interface MotionwindAdapter<TContext = unknown, TOutput = unknown> {
|
|
6
|
+
name: string;
|
|
7
|
+
version: string;
|
|
8
|
+
capabilities: AdapterCapabilities;
|
|
9
|
+
compile: (parsed: ParsedResult, context: TContext) => TOutput;
|
|
10
|
+
}
|
|
11
|
+
declare function defineMotionwindAdapter<TContext, TOutput, const T extends MotionwindAdapter<TContext, TOutput>>(adapter: T): T;
|
|
12
|
+
declare function unsupportedCapabilities(parsed: ParsedResult, capabilities: AdapterCapabilities): MotionwindCapability[];
|
|
13
|
+
|
|
14
|
+
export { type AdapterCapabilities, type MotionwindAdapter, type MotionwindCapability, defineMotionwindAdapter, unsupportedCapabilities };
|
package/dist/adapter.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"adapter.js"}
|