@ansh-ui/nuxt 0.2.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/dist/module.cjs +230 -0
- package/dist/module.cjs.map +1 -0
- package/dist/module.d.cts +73 -0
- package/dist/module.d.ts +73 -0
- package/dist/module.js +228 -0
- package/dist/module.js.map +1 -0
- package/package.json +55 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ansh contributors
|
|
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/dist/module.cjs
ADDED
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var kit = require('@nuxt/kit');
|
|
4
|
+
|
|
5
|
+
// src/module.ts
|
|
6
|
+
var COMPONENT_NAMES = [
|
|
7
|
+
// Backgrounds
|
|
8
|
+
"AuroraBackground",
|
|
9
|
+
"MeshGradient",
|
|
10
|
+
"AnimatedGradient",
|
|
11
|
+
"ParticleField",
|
|
12
|
+
"Constellation",
|
|
13
|
+
"MeteorShower",
|
|
14
|
+
"Rain",
|
|
15
|
+
"Snow",
|
|
16
|
+
"Fireflies",
|
|
17
|
+
"Waves",
|
|
18
|
+
"LiquidBlob",
|
|
19
|
+
"NoiseLayer",
|
|
20
|
+
"Spotlight",
|
|
21
|
+
// Behaviours
|
|
22
|
+
"MagneticButton",
|
|
23
|
+
"TiltCard",
|
|
24
|
+
"Ripple",
|
|
25
|
+
"Marquee",
|
|
26
|
+
"ScrollReveal",
|
|
27
|
+
"Parallax",
|
|
28
|
+
// Text
|
|
29
|
+
"GradientText",
|
|
30
|
+
"AnimatedText",
|
|
31
|
+
// Providers
|
|
32
|
+
"MotionConfig",
|
|
33
|
+
"ThemeProvider",
|
|
34
|
+
// Layout
|
|
35
|
+
"Stack",
|
|
36
|
+
"HStack",
|
|
37
|
+
"VStack",
|
|
38
|
+
"Grid",
|
|
39
|
+
"GridItem",
|
|
40
|
+
"Container",
|
|
41
|
+
"Divider",
|
|
42
|
+
"Spacer",
|
|
43
|
+
"Center",
|
|
44
|
+
"AspectRatio",
|
|
45
|
+
"ScrollArea",
|
|
46
|
+
"Resizable",
|
|
47
|
+
// Forms
|
|
48
|
+
"Field",
|
|
49
|
+
"Fieldset",
|
|
50
|
+
"VisuallyHidden",
|
|
51
|
+
"Input",
|
|
52
|
+
"NumberInput",
|
|
53
|
+
"Textarea",
|
|
54
|
+
"Checkbox",
|
|
55
|
+
"ChoiceCard",
|
|
56
|
+
"Radio",
|
|
57
|
+
"RadioGroup",
|
|
58
|
+
"Switch",
|
|
59
|
+
"OptionList",
|
|
60
|
+
"Select",
|
|
61
|
+
"Combobox",
|
|
62
|
+
"Slider",
|
|
63
|
+
"RangeSlider",
|
|
64
|
+
"PinInput",
|
|
65
|
+
"TagsInput",
|
|
66
|
+
"Rating",
|
|
67
|
+
"Dropzone",
|
|
68
|
+
"ColorPicker",
|
|
69
|
+
"Calendar",
|
|
70
|
+
"DatePicker",
|
|
71
|
+
"DateRangePicker",
|
|
72
|
+
// Overlays
|
|
73
|
+
"Popover",
|
|
74
|
+
"PopoverTrigger",
|
|
75
|
+
"PopoverContent",
|
|
76
|
+
"HoverCard",
|
|
77
|
+
"Tooltip",
|
|
78
|
+
"TooltipProvider",
|
|
79
|
+
"Dialog",
|
|
80
|
+
"AlertDialog",
|
|
81
|
+
"DialogFooter",
|
|
82
|
+
"Drawer",
|
|
83
|
+
"DropdownMenu",
|
|
84
|
+
"ContextMenu",
|
|
85
|
+
// Data
|
|
86
|
+
"Table",
|
|
87
|
+
"DataTable",
|
|
88
|
+
"Pagination",
|
|
89
|
+
"Badge",
|
|
90
|
+
"Avatar",
|
|
91
|
+
"AvatarGroup",
|
|
92
|
+
"Kbd",
|
|
93
|
+
"Stat",
|
|
94
|
+
"EmptyState",
|
|
95
|
+
"DescriptionList",
|
|
96
|
+
"Timeline",
|
|
97
|
+
"CodeBlock",
|
|
98
|
+
"Progress",
|
|
99
|
+
"CircularProgress",
|
|
100
|
+
"Meter",
|
|
101
|
+
// Navigation
|
|
102
|
+
"Tabs",
|
|
103
|
+
"Breadcrumbs",
|
|
104
|
+
"Stepper",
|
|
105
|
+
"Sidebar",
|
|
106
|
+
"AppShell",
|
|
107
|
+
"NavigationMenu",
|
|
108
|
+
// Feedback
|
|
109
|
+
"Alert",
|
|
110
|
+
"Banner",
|
|
111
|
+
"Callout",
|
|
112
|
+
// Disclosure
|
|
113
|
+
"Collapsible",
|
|
114
|
+
"Accordion",
|
|
115
|
+
"DisclosureList",
|
|
116
|
+
// Motion
|
|
117
|
+
"Motion",
|
|
118
|
+
"AnimatePresence",
|
|
119
|
+
"Draggable"
|
|
120
|
+
];
|
|
121
|
+
var COMPOSABLE_NAMES = [
|
|
122
|
+
"useMotionValue",
|
|
123
|
+
"useMotionRef",
|
|
124
|
+
"useMotionStyle",
|
|
125
|
+
"useSpringValue",
|
|
126
|
+
"useAnimate",
|
|
127
|
+
"useAnimatedFrom",
|
|
128
|
+
"useTicker",
|
|
129
|
+
"useInView",
|
|
130
|
+
"useElementSize",
|
|
131
|
+
"useScrollProgress",
|
|
132
|
+
"useWindowScroll",
|
|
133
|
+
"usePointer",
|
|
134
|
+
"useReducedMotion",
|
|
135
|
+
"useFrameBudget",
|
|
136
|
+
"useBehaviour",
|
|
137
|
+
"useMotionConfig",
|
|
138
|
+
"useTheme",
|
|
139
|
+
"useFieldControl",
|
|
140
|
+
"useFieldContext",
|
|
141
|
+
"useControllableState"
|
|
142
|
+
];
|
|
143
|
+
var module$1 = kit.defineNuxtModule({
|
|
144
|
+
meta: {
|
|
145
|
+
name: "@ansh-ui/nuxt",
|
|
146
|
+
configKey: "ansh",
|
|
147
|
+
compatibility: {
|
|
148
|
+
nuxt: ">=3.10.0"
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
defaults: {
|
|
152
|
+
components: true,
|
|
153
|
+
prefix: "",
|
|
154
|
+
composables: true,
|
|
155
|
+
css: true,
|
|
156
|
+
themeScript: true,
|
|
157
|
+
themeStorageKey: "ansh-theme",
|
|
158
|
+
reducedMotion: "auto",
|
|
159
|
+
timeScale: 1,
|
|
160
|
+
pauseWhenHidden: true,
|
|
161
|
+
respectBattery: true
|
|
162
|
+
},
|
|
163
|
+
setup(options, nuxt) {
|
|
164
|
+
nuxt.options.build.transpile.push("@ansh-ui/vue", "@ansh-ui/core", "@ansh-ui/tokens");
|
|
165
|
+
if (options.css) {
|
|
166
|
+
nuxt.options.css.unshift("@ansh-ui/tokens/ansh.css");
|
|
167
|
+
}
|
|
168
|
+
if (options.components) {
|
|
169
|
+
for (const name of COMPONENT_NAMES) {
|
|
170
|
+
kit.addComponent({
|
|
171
|
+
name: `${options.prefix ?? ""}${name}`,
|
|
172
|
+
export: name,
|
|
173
|
+
filePath: "@ansh-ui/vue",
|
|
174
|
+
// Every component mounts its effect in `onMounted`, so the server renders only the host
|
|
175
|
+
// element. That is intentional and correct: the canvas has no meaningful server
|
|
176
|
+
// representation, and rendering one would guarantee a hydration mismatch.
|
|
177
|
+
mode: "all"
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
if (options.composables) {
|
|
182
|
+
kit.addImports(
|
|
183
|
+
COMPOSABLE_NAMES.map((name) => ({
|
|
184
|
+
name,
|
|
185
|
+
from: "@ansh-ui/vue"
|
|
186
|
+
}))
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
if (options.themeScript) {
|
|
190
|
+
const key = options.themeStorageKey ?? "ansh-theme";
|
|
191
|
+
nuxt.options.app.head = nuxt.options.app.head ?? {};
|
|
192
|
+
nuxt.options.app.head.script = nuxt.options.app.head.script ?? [];
|
|
193
|
+
nuxt.options.app.head.script.unshift({
|
|
194
|
+
// `tagPosition: 'head'` plus being first means this executes before any stylesheet is
|
|
195
|
+
// applied, which is the only moment at which the theme can be set without a visible flash.
|
|
196
|
+
innerHTML: `(function(){try{var t=localStorage.getItem(${JSON.stringify(key)});if(t==='light'||t==='dark'){document.documentElement.setAttribute('data-theme',t)}}catch(e){}})()`,
|
|
197
|
+
tagPosition: "head"
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
kit.addPluginTemplate({
|
|
201
|
+
filename: "ansh-motion.client.mjs",
|
|
202
|
+
getContents: () => `
|
|
203
|
+
import { defineNuxtPlugin } from '#app'
|
|
204
|
+
import { setReducedMotionMode, getTicker, attachLifecycle } from '@ansh-ui/core'
|
|
205
|
+
|
|
206
|
+
export default defineNuxtPlugin(() => {
|
|
207
|
+
setReducedMotionMode(${JSON.stringify(options.reducedMotion ?? "auto")})
|
|
208
|
+
|
|
209
|
+
const ticker = getTicker()
|
|
210
|
+
ticker.timeScale = ${JSON.stringify(options.timeScale ?? 1)}
|
|
211
|
+
|
|
212
|
+
const detach = attachLifecycle(ticker, {
|
|
213
|
+
pauseWhenHidden: ${JSON.stringify(options.pauseWhenHidden ?? true)},
|
|
214
|
+
respectBattery: ${JSON.stringify(options.respectBattery ?? true)},
|
|
215
|
+
})
|
|
216
|
+
|
|
217
|
+
// Released on HMR dispose so a dev-server reload doesn't accumulate listeners across edits.
|
|
218
|
+
if (import.meta.hot) import.meta.hot.dispose(detach)
|
|
219
|
+
})
|
|
220
|
+
`,
|
|
221
|
+
// Client-only: every one of these touches a browser global.
|
|
222
|
+
mode: "client"
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
var module_default = module$1;
|
|
227
|
+
|
|
228
|
+
module.exports = module_default;
|
|
229
|
+
//# sourceMappingURL=module.cjs.map
|
|
230
|
+
//# sourceMappingURL=module.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/module.ts"],"names":["module","defineNuxtModule","addComponent","addImports","addPluginTemplate"],"mappings":";;;;;AA4EA,IAAM,eAAA,GAAkB;AAAA;AAAA,EAEtB,kBAAA;AAAA,EACA,cAAA;AAAA,EACA,kBAAA;AAAA,EACA,eAAA;AAAA,EACA,eAAA;AAAA,EACA,cAAA;AAAA,EACA,MAAA;AAAA,EACA,MAAA;AAAA,EACA,WAAA;AAAA,EACA,OAAA;AAAA,EACA,YAAA;AAAA,EACA,YAAA;AAAA,EACA,WAAA;AAAA;AAAA,EAEA,gBAAA;AAAA,EACA,UAAA;AAAA,EACA,QAAA;AAAA,EACA,SAAA;AAAA,EACA,cAAA;AAAA,EACA,UAAA;AAAA;AAAA,EAEA,cAAA;AAAA,EACA,cAAA;AAAA;AAAA,EAEA,cAAA;AAAA,EACA,eAAA;AAAA;AAAA,EAEA,OAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,MAAA;AAAA,EACA,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AAK,SAAA,CAAU,OAAA,CAAQ,aAAA,IAAiB,MAAM,CAAC,CAAA;;AAAA;AAAA,qBAAA,EAGjD,IAAA,CAAK,SAAA,CAAU,OAAA,CAAQ,SAAA,IAAa,CAAC,CAAC;;AAAA;AAAA,qBAAA,EAGtC,IAAA,CAAK,SAAA,CAAU,OAAA,CAAQ,eAAA,IAAmB,IAAI,CAAC,CAAA;AAAA,oBAAA,EAChD,IAAA,CAAK,SAAA,CAAU,OAAA,CAAQ,cAAA,IAAkB,IAAI,CAAC,CAAA;AAAA;;AAAA;AAAA;AAAA;AAAA,CAAA;AAAA;AAAA,MAQ9D,IAAA,EAAM;AAAA,KACP,CAAA;AAAA,EACH;AACF,CAAC,CAAA;AAED,IAAO,cAAA,GAAQJ","file":"module.cjs","sourcesContent":["import { addComponent, addImports, addPluginTemplate, defineNuxtModule } from '@nuxt/kit'\nimport type { NuxtModule } from '@nuxt/schema'\nimport type { ReducedMotionMode } from '@ansh-ui/core'\n\n/**\n * The Ansh Nuxt module.\n *\n * Nuxt gets its own package rather than instructions in the docs because there are four things a\n * Nuxt app needs that a bare Vue app does not, and every one of them is a footgun if left to the\n * consumer:\n *\n * 1. **Auto-imports.** Nuxt users expect `<AuroraBackground />` to work with no import statement.\n * That requires registering each component with `addComponent`, which only a module can do.\n * 2. **Transpilation.** Nuxt's server bundle externalises dependencies by default. Our packages\n * ship ESM that Nitro can consume, but the `'use client'`-free Vue build still needs to be in\n * the transpile list for older Nuxt versions to resolve it consistently.\n * 3. **The theme flash.** A themed app renders server-side with no knowledge of the user's stored\n * preference, so the first paint is the wrong theme. The only fix is a blocking inline script in\n * `<head>`, injected before any stylesheet — which is a `nuxt.options.app.head` concern.\n * 4. **Motion configuration.** `reducedMotion`, `timeScale` and lifecycle pausing need to be applied\n * once, on the client, after hydration. A generated plugin is the right place.\n */\n\nexport interface ModuleOptions {\n /**\n * Register every component for auto-import. Default `true`.\n *\n * Nuxt's component discovery is lazy per-component, so registering all of them does not increase\n * bundle size — only the ones actually used in templates are included.\n */\n components?: boolean\n\n /**\n * Prefix for auto-imported component names. Default `''` (no prefix), giving\n * `<AuroraBackground />`. Set to `'A'` for `<AAuroraBackground />` if you need to avoid a clash\n * with your own components.\n */\n prefix?: string\n\n /** Register the composables (`useMotionValue`, `useInView`, …) for auto-import. Default `true`. */\n composables?: boolean\n\n /**\n * Inject `@ansh-ui/tokens/ansh.css` into the app's global CSS. Default `true`.\n *\n * Set `false` if you import it yourself, or if you are overriding the token layer and need\n * control over cascade order.\n */\n css?: boolean\n\n /**\n * Inject the blocking theme script into `<head>`. Default `true`.\n *\n * Without this a themed app paints the wrong theme for one frame on every cold load. The script\n * is ~150 bytes and runs before the first stylesheet, which is the only point at which the flash\n * can be prevented.\n */\n themeScript?: boolean\n\n /** `localStorage` key the theme script reads. Default `'ansh-theme'`. */\n themeStorageKey?: string\n\n /** Application-level reduced-motion override. Default `'auto'` (follow the OS). */\n reducedMotion?: ReducedMotionMode\n\n /** Global playback rate. `0.5` is slow motion everywhere. Default `1`. */\n timeScale?: number\n\n /** Pause all animation while the document is hidden. Default `true`. */\n pauseWhenHidden?: boolean\n\n /** Reduce quality on low battery where the platform exposes it. Default `true`. */\n respectBattery?: boolean\n}\n\n/** Components exported by `@ansh-ui/vue`, registered individually for lazy auto-import. */\nconst COMPONENT_NAMES = [\n // Backgrounds\n 'AuroraBackground',\n 'MeshGradient',\n 'AnimatedGradient',\n 'ParticleField',\n 'Constellation',\n 'MeteorShower',\n 'Rain',\n 'Snow',\n 'Fireflies',\n 'Waves',\n 'LiquidBlob',\n 'NoiseLayer',\n 'Spotlight',\n // Behaviours\n 'MagneticButton',\n 'TiltCard',\n 'Ripple',\n 'Marquee',\n 'ScrollReveal',\n 'Parallax',\n // Text\n 'GradientText',\n 'AnimatedText',\n // Providers\n 'MotionConfig',\n 'ThemeProvider',\n // Layout\n 'Stack',\n 'HStack',\n 'VStack',\n 'Grid',\n 'GridItem',\n 'Container',\n 'Divider',\n 'Spacer',\n 'Center',\n 'AspectRatio',\n 'ScrollArea',\n 'Resizable',\n // Forms\n 'Field',\n 'Fieldset',\n 'VisuallyHidden',\n 'Input',\n 'NumberInput',\n 'Textarea',\n 'Checkbox',\n 'ChoiceCard',\n 'Radio',\n 'RadioGroup',\n 'Switch',\n 'OptionList',\n 'Select',\n 'Combobox',\n 'Slider',\n 'RangeSlider',\n 'PinInput',\n 'TagsInput',\n 'Rating',\n 'Dropzone',\n 'ColorPicker',\n 'Calendar',\n 'DatePicker',\n 'DateRangePicker',\n // Overlays\n 'Popover',\n 'PopoverTrigger',\n 'PopoverContent',\n 'HoverCard',\n 'Tooltip',\n 'TooltipProvider',\n 'Dialog',\n 'AlertDialog',\n 'DialogFooter',\n 'Drawer',\n 'DropdownMenu',\n 'ContextMenu',\n // Data\n 'Table',\n 'DataTable',\n 'Pagination',\n 'Badge',\n 'Avatar',\n 'AvatarGroup',\n 'Kbd',\n 'Stat',\n 'EmptyState',\n 'DescriptionList',\n 'Timeline',\n 'CodeBlock',\n 'Progress',\n 'CircularProgress',\n 'Meter',\n // Navigation\n 'Tabs',\n 'Breadcrumbs',\n 'Stepper',\n 'Sidebar',\n 'AppShell',\n 'NavigationMenu',\n // Feedback\n 'Alert',\n 'Banner',\n 'Callout',\n // Disclosure\n 'Collapsible',\n 'Accordion',\n 'DisclosureList',\n // Motion\n 'Motion',\n 'AnimatePresence',\n 'Draggable',\n] as const\n\n/** Composables exported by `@ansh-ui/vue`, registered for auto-import. */\nconst COMPOSABLE_NAMES = [\n 'useMotionValue',\n 'useMotionRef',\n 'useMotionStyle',\n 'useSpringValue',\n 'useAnimate',\n 'useAnimatedFrom',\n 'useTicker',\n 'useInView',\n 'useElementSize',\n 'useScrollProgress',\n 'useWindowScroll',\n 'usePointer',\n 'useReducedMotion',\n 'useFrameBudget',\n 'useBehaviour',\n 'useMotionConfig',\n 'useTheme',\n 'useFieldControl',\n 'useFieldContext',\n 'useControllableState',\n] as const\n\n/**\n * The return type is annotated explicitly rather than inferred.\n *\n * Without it TypeScript emits a declaration referencing `@nuxt/schema` by its resolved pnpm path,\n * which is not portable — the generated `.d.ts` would only typecheck on a machine with an\n * identically-hashed store directory.\n */\nconst module: NuxtModule<ModuleOptions> = defineNuxtModule<ModuleOptions>({\n meta: {\n name: '@ansh-ui/nuxt',\n configKey: 'ansh',\n compatibility: {\n nuxt: '>=3.10.0',\n },\n },\n\n defaults: {\n components: true,\n prefix: '',\n composables: true,\n css: true,\n themeScript: true,\n themeStorageKey: 'ansh-theme',\n reducedMotion: 'auto',\n timeScale: 1,\n pauseWhenHidden: true,\n respectBattery: true,\n },\n\n setup(options, nuxt) {\n // --- Transpile ---------------------------------------------------------\n // Nuxt externalises dependencies for the server build. Our packages are ESM-only and reference\n // browser globals inside functions (never at module scope), so they are SSR-safe — but Vite's\n // SSR resolver needs them in `noExternal` to consistently pick the ESM entry across the Nuxt\n // versions we support.\n nuxt.options.build.transpile.push('@ansh-ui/vue', '@ansh-ui/core', '@ansh-ui/tokens')\n\n // --- Global CSS --------------------------------------------------------\n if (options.css) {\n // Unshifted rather than pushed so the token layer lands *before* the application's own CSS.\n // Tokens are defaults meant to be overridden; if they came last they would win against the\n // consumer's overrides, which is the opposite of what a token layer should do.\n nuxt.options.css.unshift('@ansh-ui/tokens/ansh.css')\n }\n\n // --- Components --------------------------------------------------------\n if (options.components) {\n for (const name of COMPONENT_NAMES) {\n addComponent({\n name: `${options.prefix ?? ''}${name}`,\n export: name,\n filePath: '@ansh-ui/vue',\n // Every component mounts its effect in `onMounted`, so the server renders only the host\n // element. That is intentional and correct: the canvas has no meaningful server\n // representation, and rendering one would guarantee a hydration mismatch.\n mode: 'all',\n })\n }\n }\n\n // --- Composables -------------------------------------------------------\n if (options.composables) {\n addImports(\n COMPOSABLE_NAMES.map((name) => ({\n name,\n from: '@ansh-ui/vue',\n })),\n )\n }\n\n // --- Theme flash prevention -------------------------------------------\n if (options.themeScript) {\n const key = options.themeStorageKey ?? 'ansh-theme'\n nuxt.options.app.head = nuxt.options.app.head ?? {}\n nuxt.options.app.head.script = nuxt.options.app.head.script ?? []\n nuxt.options.app.head.script.unshift({\n // `tagPosition: 'head'` plus being first means this executes before any stylesheet is\n // applied, which is the only moment at which the theme can be set without a visible flash.\n innerHTML:\n `(function(){try{var t=localStorage.getItem(${JSON.stringify(key)});` +\n `if(t==='light'||t==='dark'){document.documentElement.setAttribute('data-theme',t)}}` +\n `catch(e){}})()`,\n tagPosition: 'head',\n })\n }\n\n // --- Runtime plugin ----------------------------------------------------\n // Generated rather than shipped as a file so the module's options are baked in at build time,\n // which avoids a runtime config read on every request.\n addPluginTemplate({\n filename: 'ansh-motion.client.mjs',\n getContents: () => `\nimport { defineNuxtPlugin } from '#app'\nimport { setReducedMotionMode, getTicker, attachLifecycle } from '@ansh-ui/core'\n\nexport default defineNuxtPlugin(() => {\n setReducedMotionMode(${JSON.stringify(options.reducedMotion ?? 'auto')})\n\n const ticker = getTicker()\n ticker.timeScale = ${JSON.stringify(options.timeScale ?? 1)}\n\n const detach = attachLifecycle(ticker, {\n pauseWhenHidden: ${JSON.stringify(options.pauseWhenHidden ?? true)},\n respectBattery: ${JSON.stringify(options.respectBattery ?? true)},\n })\n\n // Released on HMR dispose so a dev-server reload doesn't accumulate listeners across edits.\n if (import.meta.hot) import.meta.hot.dispose(detach)\n})\n`,\n // Client-only: every one of these touches a browser global.\n mode: 'client',\n })\n },\n})\n\nexport default module\n"]}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { NuxtModule } from '@nuxt/schema';
|
|
2
|
+
import { ReducedMotionMode } from '@ansh-ui/core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The Ansh Nuxt module.
|
|
6
|
+
*
|
|
7
|
+
* Nuxt gets its own package rather than instructions in the docs because there are four things a
|
|
8
|
+
* Nuxt app needs that a bare Vue app does not, and every one of them is a footgun if left to the
|
|
9
|
+
* consumer:
|
|
10
|
+
*
|
|
11
|
+
* 1. **Auto-imports.** Nuxt users expect `<AuroraBackground />` to work with no import statement.
|
|
12
|
+
* That requires registering each component with `addComponent`, which only a module can do.
|
|
13
|
+
* 2. **Transpilation.** Nuxt's server bundle externalises dependencies by default. Our packages
|
|
14
|
+
* ship ESM that Nitro can consume, but the `'use client'`-free Vue build still needs to be in
|
|
15
|
+
* the transpile list for older Nuxt versions to resolve it consistently.
|
|
16
|
+
* 3. **The theme flash.** A themed app renders server-side with no knowledge of the user's stored
|
|
17
|
+
* preference, so the first paint is the wrong theme. The only fix is a blocking inline script in
|
|
18
|
+
* `<head>`, injected before any stylesheet — which is a `nuxt.options.app.head` concern.
|
|
19
|
+
* 4. **Motion configuration.** `reducedMotion`, `timeScale` and lifecycle pausing need to be applied
|
|
20
|
+
* once, on the client, after hydration. A generated plugin is the right place.
|
|
21
|
+
*/
|
|
22
|
+
interface ModuleOptions {
|
|
23
|
+
/**
|
|
24
|
+
* Register every component for auto-import. Default `true`.
|
|
25
|
+
*
|
|
26
|
+
* Nuxt's component discovery is lazy per-component, so registering all of them does not increase
|
|
27
|
+
* bundle size — only the ones actually used in templates are included.
|
|
28
|
+
*/
|
|
29
|
+
components?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Prefix for auto-imported component names. Default `''` (no prefix), giving
|
|
32
|
+
* `<AuroraBackground />`. Set to `'A'` for `<AAuroraBackground />` if you need to avoid a clash
|
|
33
|
+
* with your own components.
|
|
34
|
+
*/
|
|
35
|
+
prefix?: string;
|
|
36
|
+
/** Register the composables (`useMotionValue`, `useInView`, …) for auto-import. Default `true`. */
|
|
37
|
+
composables?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Inject `@ansh-ui/tokens/ansh.css` into the app's global CSS. Default `true`.
|
|
40
|
+
*
|
|
41
|
+
* Set `false` if you import it yourself, or if you are overriding the token layer and need
|
|
42
|
+
* control over cascade order.
|
|
43
|
+
*/
|
|
44
|
+
css?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Inject the blocking theme script into `<head>`. Default `true`.
|
|
47
|
+
*
|
|
48
|
+
* Without this a themed app paints the wrong theme for one frame on every cold load. The script
|
|
49
|
+
* is ~150 bytes and runs before the first stylesheet, which is the only point at which the flash
|
|
50
|
+
* can be prevented.
|
|
51
|
+
*/
|
|
52
|
+
themeScript?: boolean;
|
|
53
|
+
/** `localStorage` key the theme script reads. Default `'ansh-theme'`. */
|
|
54
|
+
themeStorageKey?: string;
|
|
55
|
+
/** Application-level reduced-motion override. Default `'auto'` (follow the OS). */
|
|
56
|
+
reducedMotion?: ReducedMotionMode;
|
|
57
|
+
/** Global playback rate. `0.5` is slow motion everywhere. Default `1`. */
|
|
58
|
+
timeScale?: number;
|
|
59
|
+
/** Pause all animation while the document is hidden. Default `true`. */
|
|
60
|
+
pauseWhenHidden?: boolean;
|
|
61
|
+
/** Reduce quality on low battery where the platform exposes it. Default `true`. */
|
|
62
|
+
respectBattery?: boolean;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* The return type is annotated explicitly rather than inferred.
|
|
66
|
+
*
|
|
67
|
+
* Without it TypeScript emits a declaration referencing `@nuxt/schema` by its resolved pnpm path,
|
|
68
|
+
* which is not portable — the generated `.d.ts` would only typecheck on a machine with an
|
|
69
|
+
* identically-hashed store directory.
|
|
70
|
+
*/
|
|
71
|
+
declare const module$1: NuxtModule<ModuleOptions>;
|
|
72
|
+
|
|
73
|
+
export { type ModuleOptions, module$1 as default };
|
package/dist/module.d.ts
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { NuxtModule } from '@nuxt/schema';
|
|
2
|
+
import { ReducedMotionMode } from '@ansh-ui/core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The Ansh Nuxt module.
|
|
6
|
+
*
|
|
7
|
+
* Nuxt gets its own package rather than instructions in the docs because there are four things a
|
|
8
|
+
* Nuxt app needs that a bare Vue app does not, and every one of them is a footgun if left to the
|
|
9
|
+
* consumer:
|
|
10
|
+
*
|
|
11
|
+
* 1. **Auto-imports.** Nuxt users expect `<AuroraBackground />` to work with no import statement.
|
|
12
|
+
* That requires registering each component with `addComponent`, which only a module can do.
|
|
13
|
+
* 2. **Transpilation.** Nuxt's server bundle externalises dependencies by default. Our packages
|
|
14
|
+
* ship ESM that Nitro can consume, but the `'use client'`-free Vue build still needs to be in
|
|
15
|
+
* the transpile list for older Nuxt versions to resolve it consistently.
|
|
16
|
+
* 3. **The theme flash.** A themed app renders server-side with no knowledge of the user's stored
|
|
17
|
+
* preference, so the first paint is the wrong theme. The only fix is a blocking inline script in
|
|
18
|
+
* `<head>`, injected before any stylesheet — which is a `nuxt.options.app.head` concern.
|
|
19
|
+
* 4. **Motion configuration.** `reducedMotion`, `timeScale` and lifecycle pausing need to be applied
|
|
20
|
+
* once, on the client, after hydration. A generated plugin is the right place.
|
|
21
|
+
*/
|
|
22
|
+
interface ModuleOptions {
|
|
23
|
+
/**
|
|
24
|
+
* Register every component for auto-import. Default `true`.
|
|
25
|
+
*
|
|
26
|
+
* Nuxt's component discovery is lazy per-component, so registering all of them does not increase
|
|
27
|
+
* bundle size — only the ones actually used in templates are included.
|
|
28
|
+
*/
|
|
29
|
+
components?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Prefix for auto-imported component names. Default `''` (no prefix), giving
|
|
32
|
+
* `<AuroraBackground />`. Set to `'A'` for `<AAuroraBackground />` if you need to avoid a clash
|
|
33
|
+
* with your own components.
|
|
34
|
+
*/
|
|
35
|
+
prefix?: string;
|
|
36
|
+
/** Register the composables (`useMotionValue`, `useInView`, …) for auto-import. Default `true`. */
|
|
37
|
+
composables?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Inject `@ansh-ui/tokens/ansh.css` into the app's global CSS. Default `true`.
|
|
40
|
+
*
|
|
41
|
+
* Set `false` if you import it yourself, or if you are overriding the token layer and need
|
|
42
|
+
* control over cascade order.
|
|
43
|
+
*/
|
|
44
|
+
css?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Inject the blocking theme script into `<head>`. Default `true`.
|
|
47
|
+
*
|
|
48
|
+
* Without this a themed app paints the wrong theme for one frame on every cold load. The script
|
|
49
|
+
* is ~150 bytes and runs before the first stylesheet, which is the only point at which the flash
|
|
50
|
+
* can be prevented.
|
|
51
|
+
*/
|
|
52
|
+
themeScript?: boolean;
|
|
53
|
+
/** `localStorage` key the theme script reads. Default `'ansh-theme'`. */
|
|
54
|
+
themeStorageKey?: string;
|
|
55
|
+
/** Application-level reduced-motion override. Default `'auto'` (follow the OS). */
|
|
56
|
+
reducedMotion?: ReducedMotionMode;
|
|
57
|
+
/** Global playback rate. `0.5` is slow motion everywhere. Default `1`. */
|
|
58
|
+
timeScale?: number;
|
|
59
|
+
/** Pause all animation while the document is hidden. Default `true`. */
|
|
60
|
+
pauseWhenHidden?: boolean;
|
|
61
|
+
/** Reduce quality on low battery where the platform exposes it. Default `true`. */
|
|
62
|
+
respectBattery?: boolean;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* The return type is annotated explicitly rather than inferred.
|
|
66
|
+
*
|
|
67
|
+
* Without it TypeScript emits a declaration referencing `@nuxt/schema` by its resolved pnpm path,
|
|
68
|
+
* which is not portable — the generated `.d.ts` would only typecheck on a machine with an
|
|
69
|
+
* identically-hashed store directory.
|
|
70
|
+
*/
|
|
71
|
+
declare const module$1: NuxtModule<ModuleOptions>;
|
|
72
|
+
|
|
73
|
+
export { type ModuleOptions, module$1 as default };
|
package/dist/module.js
ADDED
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { defineNuxtModule, addComponent, addImports, addPluginTemplate } from '@nuxt/kit';
|
|
2
|
+
|
|
3
|
+
// src/module.ts
|
|
4
|
+
var COMPONENT_NAMES = [
|
|
5
|
+
// Backgrounds
|
|
6
|
+
"AuroraBackground",
|
|
7
|
+
"MeshGradient",
|
|
8
|
+
"AnimatedGradient",
|
|
9
|
+
"ParticleField",
|
|
10
|
+
"Constellation",
|
|
11
|
+
"MeteorShower",
|
|
12
|
+
"Rain",
|
|
13
|
+
"Snow",
|
|
14
|
+
"Fireflies",
|
|
15
|
+
"Waves",
|
|
16
|
+
"LiquidBlob",
|
|
17
|
+
"NoiseLayer",
|
|
18
|
+
"Spotlight",
|
|
19
|
+
// Behaviours
|
|
20
|
+
"MagneticButton",
|
|
21
|
+
"TiltCard",
|
|
22
|
+
"Ripple",
|
|
23
|
+
"Marquee",
|
|
24
|
+
"ScrollReveal",
|
|
25
|
+
"Parallax",
|
|
26
|
+
// Text
|
|
27
|
+
"GradientText",
|
|
28
|
+
"AnimatedText",
|
|
29
|
+
// Providers
|
|
30
|
+
"MotionConfig",
|
|
31
|
+
"ThemeProvider",
|
|
32
|
+
// Layout
|
|
33
|
+
"Stack",
|
|
34
|
+
"HStack",
|
|
35
|
+
"VStack",
|
|
36
|
+
"Grid",
|
|
37
|
+
"GridItem",
|
|
38
|
+
"Container",
|
|
39
|
+
"Divider",
|
|
40
|
+
"Spacer",
|
|
41
|
+
"Center",
|
|
42
|
+
"AspectRatio",
|
|
43
|
+
"ScrollArea",
|
|
44
|
+
"Resizable",
|
|
45
|
+
// Forms
|
|
46
|
+
"Field",
|
|
47
|
+
"Fieldset",
|
|
48
|
+
"VisuallyHidden",
|
|
49
|
+
"Input",
|
|
50
|
+
"NumberInput",
|
|
51
|
+
"Textarea",
|
|
52
|
+
"Checkbox",
|
|
53
|
+
"ChoiceCard",
|
|
54
|
+
"Radio",
|
|
55
|
+
"RadioGroup",
|
|
56
|
+
"Switch",
|
|
57
|
+
"OptionList",
|
|
58
|
+
"Select",
|
|
59
|
+
"Combobox",
|
|
60
|
+
"Slider",
|
|
61
|
+
"RangeSlider",
|
|
62
|
+
"PinInput",
|
|
63
|
+
"TagsInput",
|
|
64
|
+
"Rating",
|
|
65
|
+
"Dropzone",
|
|
66
|
+
"ColorPicker",
|
|
67
|
+
"Calendar",
|
|
68
|
+
"DatePicker",
|
|
69
|
+
"DateRangePicker",
|
|
70
|
+
// Overlays
|
|
71
|
+
"Popover",
|
|
72
|
+
"PopoverTrigger",
|
|
73
|
+
"PopoverContent",
|
|
74
|
+
"HoverCard",
|
|
75
|
+
"Tooltip",
|
|
76
|
+
"TooltipProvider",
|
|
77
|
+
"Dialog",
|
|
78
|
+
"AlertDialog",
|
|
79
|
+
"DialogFooter",
|
|
80
|
+
"Drawer",
|
|
81
|
+
"DropdownMenu",
|
|
82
|
+
"ContextMenu",
|
|
83
|
+
// Data
|
|
84
|
+
"Table",
|
|
85
|
+
"DataTable",
|
|
86
|
+
"Pagination",
|
|
87
|
+
"Badge",
|
|
88
|
+
"Avatar",
|
|
89
|
+
"AvatarGroup",
|
|
90
|
+
"Kbd",
|
|
91
|
+
"Stat",
|
|
92
|
+
"EmptyState",
|
|
93
|
+
"DescriptionList",
|
|
94
|
+
"Timeline",
|
|
95
|
+
"CodeBlock",
|
|
96
|
+
"Progress",
|
|
97
|
+
"CircularProgress",
|
|
98
|
+
"Meter",
|
|
99
|
+
// Navigation
|
|
100
|
+
"Tabs",
|
|
101
|
+
"Breadcrumbs",
|
|
102
|
+
"Stepper",
|
|
103
|
+
"Sidebar",
|
|
104
|
+
"AppShell",
|
|
105
|
+
"NavigationMenu",
|
|
106
|
+
// Feedback
|
|
107
|
+
"Alert",
|
|
108
|
+
"Banner",
|
|
109
|
+
"Callout",
|
|
110
|
+
// Disclosure
|
|
111
|
+
"Collapsible",
|
|
112
|
+
"Accordion",
|
|
113
|
+
"DisclosureList",
|
|
114
|
+
// Motion
|
|
115
|
+
"Motion",
|
|
116
|
+
"AnimatePresence",
|
|
117
|
+
"Draggable"
|
|
118
|
+
];
|
|
119
|
+
var COMPOSABLE_NAMES = [
|
|
120
|
+
"useMotionValue",
|
|
121
|
+
"useMotionRef",
|
|
122
|
+
"useMotionStyle",
|
|
123
|
+
"useSpringValue",
|
|
124
|
+
"useAnimate",
|
|
125
|
+
"useAnimatedFrom",
|
|
126
|
+
"useTicker",
|
|
127
|
+
"useInView",
|
|
128
|
+
"useElementSize",
|
|
129
|
+
"useScrollProgress",
|
|
130
|
+
"useWindowScroll",
|
|
131
|
+
"usePointer",
|
|
132
|
+
"useReducedMotion",
|
|
133
|
+
"useFrameBudget",
|
|
134
|
+
"useBehaviour",
|
|
135
|
+
"useMotionConfig",
|
|
136
|
+
"useTheme",
|
|
137
|
+
"useFieldControl",
|
|
138
|
+
"useFieldContext",
|
|
139
|
+
"useControllableState"
|
|
140
|
+
];
|
|
141
|
+
var module$1 = defineNuxtModule({
|
|
142
|
+
meta: {
|
|
143
|
+
name: "@ansh-ui/nuxt",
|
|
144
|
+
configKey: "ansh",
|
|
145
|
+
compatibility: {
|
|
146
|
+
nuxt: ">=3.10.0"
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
defaults: {
|
|
150
|
+
components: true,
|
|
151
|
+
prefix: "",
|
|
152
|
+
composables: true,
|
|
153
|
+
css: true,
|
|
154
|
+
themeScript: true,
|
|
155
|
+
themeStorageKey: "ansh-theme",
|
|
156
|
+
reducedMotion: "auto",
|
|
157
|
+
timeScale: 1,
|
|
158
|
+
pauseWhenHidden: true,
|
|
159
|
+
respectBattery: true
|
|
160
|
+
},
|
|
161
|
+
setup(options, nuxt) {
|
|
162
|
+
nuxt.options.build.transpile.push("@ansh-ui/vue", "@ansh-ui/core", "@ansh-ui/tokens");
|
|
163
|
+
if (options.css) {
|
|
164
|
+
nuxt.options.css.unshift("@ansh-ui/tokens/ansh.css");
|
|
165
|
+
}
|
|
166
|
+
if (options.components) {
|
|
167
|
+
for (const name of COMPONENT_NAMES) {
|
|
168
|
+
addComponent({
|
|
169
|
+
name: `${options.prefix ?? ""}${name}`,
|
|
170
|
+
export: name,
|
|
171
|
+
filePath: "@ansh-ui/vue",
|
|
172
|
+
// Every component mounts its effect in `onMounted`, so the server renders only the host
|
|
173
|
+
// element. That is intentional and correct: the canvas has no meaningful server
|
|
174
|
+
// representation, and rendering one would guarantee a hydration mismatch.
|
|
175
|
+
mode: "all"
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
if (options.composables) {
|
|
180
|
+
addImports(
|
|
181
|
+
COMPOSABLE_NAMES.map((name) => ({
|
|
182
|
+
name,
|
|
183
|
+
from: "@ansh-ui/vue"
|
|
184
|
+
}))
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
if (options.themeScript) {
|
|
188
|
+
const key = options.themeStorageKey ?? "ansh-theme";
|
|
189
|
+
nuxt.options.app.head = nuxt.options.app.head ?? {};
|
|
190
|
+
nuxt.options.app.head.script = nuxt.options.app.head.script ?? [];
|
|
191
|
+
nuxt.options.app.head.script.unshift({
|
|
192
|
+
// `tagPosition: 'head'` plus being first means this executes before any stylesheet is
|
|
193
|
+
// applied, which is the only moment at which the theme can be set without a visible flash.
|
|
194
|
+
innerHTML: `(function(){try{var t=localStorage.getItem(${JSON.stringify(key)});if(t==='light'||t==='dark'){document.documentElement.setAttribute('data-theme',t)}}catch(e){}})()`,
|
|
195
|
+
tagPosition: "head"
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
addPluginTemplate({
|
|
199
|
+
filename: "ansh-motion.client.mjs",
|
|
200
|
+
getContents: () => `
|
|
201
|
+
import { defineNuxtPlugin } from '#app'
|
|
202
|
+
import { setReducedMotionMode, getTicker, attachLifecycle } from '@ansh-ui/core'
|
|
203
|
+
|
|
204
|
+
export default defineNuxtPlugin(() => {
|
|
205
|
+
setReducedMotionMode(${JSON.stringify(options.reducedMotion ?? "auto")})
|
|
206
|
+
|
|
207
|
+
const ticker = getTicker()
|
|
208
|
+
ticker.timeScale = ${JSON.stringify(options.timeScale ?? 1)}
|
|
209
|
+
|
|
210
|
+
const detach = attachLifecycle(ticker, {
|
|
211
|
+
pauseWhenHidden: ${JSON.stringify(options.pauseWhenHidden ?? true)},
|
|
212
|
+
respectBattery: ${JSON.stringify(options.respectBattery ?? true)},
|
|
213
|
+
})
|
|
214
|
+
|
|
215
|
+
// Released on HMR dispose so a dev-server reload doesn't accumulate listeners across edits.
|
|
216
|
+
if (import.meta.hot) import.meta.hot.dispose(detach)
|
|
217
|
+
})
|
|
218
|
+
`,
|
|
219
|
+
// Client-only: every one of these touches a browser global.
|
|
220
|
+
mode: "client"
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
var module_default = module$1;
|
|
225
|
+
|
|
226
|
+
export { module_default as default };
|
|
227
|
+
//# sourceMappingURL=module.js.map
|
|
228
|
+
//# sourceMappingURL=module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/module.ts"],"names":["module"],"mappings":";;;AA4EA,IAAM,eAAA,GAAkB;AAAA;AAAA,EAEtB,kBAAA;AAAA,EACA,cAAA;AAAA,EACA,kBAAA;AAAA,EACA,eAAA;AAAA,EACA,eAAA;AAAA,EACA,cAAA;AAAA,EACA,MAAA;AAAA,EACA,MAAA;AAAA,EACA,WAAA;AAAA,EACA,OAAA;AAAA,EACA,YAAA;AAAA,EACA,YAAA;AAAA,EACA,WAAA;AAAA;AAAA,EAEA,gBAAA;AAAA,EACA,UAAA;AAAA,EACA,QAAA;AAAA,EACA,SAAA;AAAA,EACA,cAAA;AAAA,EACA,UAAA;AAAA;AAAA,EAEA,cAAA;AAAA,EACA,cAAA;AAAA;AAAA,EAEA,cAAA;AAAA,EACA,eAAA;AAAA;AAAA,EAEA,OAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,MAAA;AAAA,EACA,UAAA;AAAA,EACA,WAAA;AAAA,EACA,SAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,aAAA;AAAA,EACA,YAAA;AAAA,EACA,WAAA;AAAA;AAAA,EAEA,OAAA;AAAA,EACA,UAAA;AAAA,EACA,gBAAA;AAAA,EACA,OAAA;AAAA,EACA,aAAA;AAAA,EACA,UAAA;AAAA,EACA,UAAA;AAAA,EACA,YAAA;AAAA,EACA,OAAA;AAAA,EACA,YAAA;AAAA,EACA,QAAA;AAAA,EACA,YAAA;AAAA,EACA,QAAA;A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;AAAA,CAAA;AAAA;AAAA,MAQ9D,IAAA,EAAM;AAAA,KACP,CAAA;AAAA,EACH;AACF,CAAC,CAAA;AAED,IAAO,cAAA,GAAQA","file":"module.js","sourcesContent":["import { addComponent, addImports, addPluginTemplate, defineNuxtModule } from '@nuxt/kit'\nimport type { NuxtModule } from '@nuxt/schema'\nimport type { ReducedMotionMode } from '@ansh-ui/core'\n\n/**\n * The Ansh Nuxt module.\n *\n * Nuxt gets its own package rather than instructions in the docs because there are four things a\n * Nuxt app needs that a bare Vue app does not, and every one of them is a footgun if left to the\n * consumer:\n *\n * 1. **Auto-imports.** Nuxt users expect `<AuroraBackground />` to work with no import statement.\n * That requires registering each component with `addComponent`, which only a module can do.\n * 2. **Transpilation.** Nuxt's server bundle externalises dependencies by default. Our packages\n * ship ESM that Nitro can consume, but the `'use client'`-free Vue build still needs to be in\n * the transpile list for older Nuxt versions to resolve it consistently.\n * 3. **The theme flash.** A themed app renders server-side with no knowledge of the user's stored\n * preference, so the first paint is the wrong theme. The only fix is a blocking inline script in\n * `<head>`, injected before any stylesheet — which is a `nuxt.options.app.head` concern.\n * 4. **Motion configuration.** `reducedMotion`, `timeScale` and lifecycle pausing need to be applied\n * once, on the client, after hydration. A generated plugin is the right place.\n */\n\nexport interface ModuleOptions {\n /**\n * Register every component for auto-import. Default `true`.\n *\n * Nuxt's component discovery is lazy per-component, so registering all of them does not increase\n * bundle size — only the ones actually used in templates are included.\n */\n components?: boolean\n\n /**\n * Prefix for auto-imported component names. Default `''` (no prefix), giving\n * `<AuroraBackground />`. Set to `'A'` for `<AAuroraBackground />` if you need to avoid a clash\n * with your own components.\n */\n prefix?: string\n\n /** Register the composables (`useMotionValue`, `useInView`, …) for auto-import. Default `true`. */\n composables?: boolean\n\n /**\n * Inject `@ansh-ui/tokens/ansh.css` into the app's global CSS. Default `true`.\n *\n * Set `false` if you import it yourself, or if you are overriding the token layer and need\n * control over cascade order.\n */\n css?: boolean\n\n /**\n * Inject the blocking theme script into `<head>`. Default `true`.\n *\n * Without this a themed app paints the wrong theme for one frame on every cold load. The script\n * is ~150 bytes and runs before the first stylesheet, which is the only point at which the flash\n * can be prevented.\n */\n themeScript?: boolean\n\n /** `localStorage` key the theme script reads. Default `'ansh-theme'`. */\n themeStorageKey?: string\n\n /** Application-level reduced-motion override. Default `'auto'` (follow the OS). */\n reducedMotion?: ReducedMotionMode\n\n /** Global playback rate. `0.5` is slow motion everywhere. Default `1`. */\n timeScale?: number\n\n /** Pause all animation while the document is hidden. Default `true`. */\n pauseWhenHidden?: boolean\n\n /** Reduce quality on low battery where the platform exposes it. Default `true`. */\n respectBattery?: boolean\n}\n\n/** Components exported by `@ansh-ui/vue`, registered individually for lazy auto-import. */\nconst COMPONENT_NAMES = [\n // Backgrounds\n 'AuroraBackground',\n 'MeshGradient',\n 'AnimatedGradient',\n 'ParticleField',\n 'Constellation',\n 'MeteorShower',\n 'Rain',\n 'Snow',\n 'Fireflies',\n 'Waves',\n 'LiquidBlob',\n 'NoiseLayer',\n 'Spotlight',\n // Behaviours\n 'MagneticButton',\n 'TiltCard',\n 'Ripple',\n 'Marquee',\n 'ScrollReveal',\n 'Parallax',\n // Text\n 'GradientText',\n 'AnimatedText',\n // Providers\n 'MotionConfig',\n 'ThemeProvider',\n // Layout\n 'Stack',\n 'HStack',\n 'VStack',\n 'Grid',\n 'GridItem',\n 'Container',\n 'Divider',\n 'Spacer',\n 'Center',\n 'AspectRatio',\n 'ScrollArea',\n 'Resizable',\n // Forms\n 'Field',\n 'Fieldset',\n 'VisuallyHidden',\n 'Input',\n 'NumberInput',\n 'Textarea',\n 'Checkbox',\n 'ChoiceCard',\n 'Radio',\n 'RadioGroup',\n 'Switch',\n 'OptionList',\n 'Select',\n 'Combobox',\n 'Slider',\n 'RangeSlider',\n 'PinInput',\n 'TagsInput',\n 'Rating',\n 'Dropzone',\n 'ColorPicker',\n 'Calendar',\n 'DatePicker',\n 'DateRangePicker',\n // Overlays\n 'Popover',\n 'PopoverTrigger',\n 'PopoverContent',\n 'HoverCard',\n 'Tooltip',\n 'TooltipProvider',\n 'Dialog',\n 'AlertDialog',\n 'DialogFooter',\n 'Drawer',\n 'DropdownMenu',\n 'ContextMenu',\n // Data\n 'Table',\n 'DataTable',\n 'Pagination',\n 'Badge',\n 'Avatar',\n 'AvatarGroup',\n 'Kbd',\n 'Stat',\n 'EmptyState',\n 'DescriptionList',\n 'Timeline',\n 'CodeBlock',\n 'Progress',\n 'CircularProgress',\n 'Meter',\n // Navigation\n 'Tabs',\n 'Breadcrumbs',\n 'Stepper',\n 'Sidebar',\n 'AppShell',\n 'NavigationMenu',\n // Feedback\n 'Alert',\n 'Banner',\n 'Callout',\n // Disclosure\n 'Collapsible',\n 'Accordion',\n 'DisclosureList',\n // Motion\n 'Motion',\n 'AnimatePresence',\n 'Draggable',\n] as const\n\n/** Composables exported by `@ansh-ui/vue`, registered for auto-import. */\nconst COMPOSABLE_NAMES = [\n 'useMotionValue',\n 'useMotionRef',\n 'useMotionStyle',\n 'useSpringValue',\n 'useAnimate',\n 'useAnimatedFrom',\n 'useTicker',\n 'useInView',\n 'useElementSize',\n 'useScrollProgress',\n 'useWindowScroll',\n 'usePointer',\n 'useReducedMotion',\n 'useFrameBudget',\n 'useBehaviour',\n 'useMotionConfig',\n 'useTheme',\n 'useFieldControl',\n 'useFieldContext',\n 'useControllableState',\n] as const\n\n/**\n * The return type is annotated explicitly rather than inferred.\n *\n * Without it TypeScript emits a declaration referencing `@nuxt/schema` by its resolved pnpm path,\n * which is not portable — the generated `.d.ts` would only typecheck on a machine with an\n * identically-hashed store directory.\n */\nconst module: NuxtModule<ModuleOptions> = defineNuxtModule<ModuleOptions>({\n meta: {\n name: '@ansh-ui/nuxt',\n configKey: 'ansh',\n compatibility: {\n nuxt: '>=3.10.0',\n },\n },\n\n defaults: {\n components: true,\n prefix: '',\n composables: true,\n css: true,\n themeScript: true,\n themeStorageKey: 'ansh-theme',\n reducedMotion: 'auto',\n timeScale: 1,\n pauseWhenHidden: true,\n respectBattery: true,\n },\n\n setup(options, nuxt) {\n // --- Transpile ---------------------------------------------------------\n // Nuxt externalises dependencies for the server build. Our packages are ESM-only and reference\n // browser globals inside functions (never at module scope), so they are SSR-safe — but Vite's\n // SSR resolver needs them in `noExternal` to consistently pick the ESM entry across the Nuxt\n // versions we support.\n nuxt.options.build.transpile.push('@ansh-ui/vue', '@ansh-ui/core', '@ansh-ui/tokens')\n\n // --- Global CSS --------------------------------------------------------\n if (options.css) {\n // Unshifted rather than pushed so the token layer lands *before* the application's own CSS.\n // Tokens are defaults meant to be overridden; if they came last they would win against the\n // consumer's overrides, which is the opposite of what a token layer should do.\n nuxt.options.css.unshift('@ansh-ui/tokens/ansh.css')\n }\n\n // --- Components --------------------------------------------------------\n if (options.components) {\n for (const name of COMPONENT_NAMES) {\n addComponent({\n name: `${options.prefix ?? ''}${name}`,\n export: name,\n filePath: '@ansh-ui/vue',\n // Every component mounts its effect in `onMounted`, so the server renders only the host\n // element. That is intentional and correct: the canvas has no meaningful server\n // representation, and rendering one would guarantee a hydration mismatch.\n mode: 'all',\n })\n }\n }\n\n // --- Composables -------------------------------------------------------\n if (options.composables) {\n addImports(\n COMPOSABLE_NAMES.map((name) => ({\n name,\n from: '@ansh-ui/vue',\n })),\n )\n }\n\n // --- Theme flash prevention -------------------------------------------\n if (options.themeScript) {\n const key = options.themeStorageKey ?? 'ansh-theme'\n nuxt.options.app.head = nuxt.options.app.head ?? {}\n nuxt.options.app.head.script = nuxt.options.app.head.script ?? []\n nuxt.options.app.head.script.unshift({\n // `tagPosition: 'head'` plus being first means this executes before any stylesheet is\n // applied, which is the only moment at which the theme can be set without a visible flash.\n innerHTML:\n `(function(){try{var t=localStorage.getItem(${JSON.stringify(key)});` +\n `if(t==='light'||t==='dark'){document.documentElement.setAttribute('data-theme',t)}}` +\n `catch(e){}})()`,\n tagPosition: 'head',\n })\n }\n\n // --- Runtime plugin ----------------------------------------------------\n // Generated rather than shipped as a file so the module's options are baked in at build time,\n // which avoids a runtime config read on every request.\n addPluginTemplate({\n filename: 'ansh-motion.client.mjs',\n getContents: () => `\nimport { defineNuxtPlugin } from '#app'\nimport { setReducedMotionMode, getTicker, attachLifecycle } from '@ansh-ui/core'\n\nexport default defineNuxtPlugin(() => {\n setReducedMotionMode(${JSON.stringify(options.reducedMotion ?? 'auto')})\n\n const ticker = getTicker()\n ticker.timeScale = ${JSON.stringify(options.timeScale ?? 1)}\n\n const detach = attachLifecycle(ticker, {\n pauseWhenHidden: ${JSON.stringify(options.pauseWhenHidden ?? true)},\n respectBattery: ${JSON.stringify(options.respectBattery ?? true)},\n })\n\n // Released on HMR dispose so a dev-server reload doesn't accumulate listeners across edits.\n if (import.meta.hot) import.meta.hot.dispose(detach)\n})\n`,\n // Client-only: every one of these touches a browser global.\n mode: 'client',\n })\n },\n})\n\nexport default module\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ansh-ui/nuxt",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Ansh Nuxt module — auto-imports, SSR-safe components and theme setup for Nuxt 3 and 4.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"nuxt",
|
|
9
|
+
"nuxt-module",
|
|
10
|
+
"vue",
|
|
11
|
+
"animation",
|
|
12
|
+
"motion",
|
|
13
|
+
"ui"
|
|
14
|
+
],
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/jithin003/ui-library.git",
|
|
18
|
+
"directory": "packages/nuxt"
|
|
19
|
+
},
|
|
20
|
+
"homepage": "https://github.com/jithin003/ui-library",
|
|
21
|
+
"files": [
|
|
22
|
+
"dist"
|
|
23
|
+
],
|
|
24
|
+
"main": "./dist/module.cjs",
|
|
25
|
+
"module": "./dist/module.js",
|
|
26
|
+
"types": "./dist/module.d.ts",
|
|
27
|
+
"exports": {
|
|
28
|
+
".": {
|
|
29
|
+
"types": "./dist/module.d.ts",
|
|
30
|
+
"import": "./dist/module.js",
|
|
31
|
+
"require": "./dist/module.cjs"
|
|
32
|
+
},
|
|
33
|
+
"./package.json": "./package.json"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@nuxt/kit": "^3.15.0",
|
|
37
|
+
"@ansh-ui/tokens": "0.2.0",
|
|
38
|
+
"@ansh-ui/vue": "0.2.0",
|
|
39
|
+
"@ansh-ui/core": "0.2.0"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@nuxt/schema": "^3.15.0"
|
|
43
|
+
},
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"nuxt": "^3.10.0 || ^4.0.0"
|
|
46
|
+
},
|
|
47
|
+
"publishConfig": {
|
|
48
|
+
"access": "public"
|
|
49
|
+
},
|
|
50
|
+
"scripts": {
|
|
51
|
+
"build": "tsup",
|
|
52
|
+
"dev": "tsup --watch",
|
|
53
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
54
|
+
}
|
|
55
|
+
}
|