@yatoday/astro-ui 0.0.2

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.
Files changed (56) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +2 -0
  3. package/astro.d.ts +31 -0
  4. package/astro.js +19 -0
  5. package/components/Analytics/Analytics.astro +15 -0
  6. package/components/Analytics/AnalyticsGoogle.astro +17 -0
  7. package/components/Analytics/types.ts +6 -0
  8. package/components/Background/Background.astro +9 -0
  9. package/components/Background/Background.svelte +13 -0
  10. package/components/Background/types.ts +9 -0
  11. package/components/Card0/Card0.astro +23 -0
  12. package/components/Card0/card0.ts +6 -0
  13. package/components/Card0/types.ts +6 -0
  14. package/components/ConditionalWrapper/ConditionalWrapper.astro +15 -0
  15. package/components/ConditionalWrapper/ConditionalWrapper.svelte +18 -0
  16. package/components/ConditionalWrapper/types.ts +10 -0
  17. package/components/DarkMode/DarkMode.astro +77 -0
  18. package/components/DarkMode/types.ts +7 -0
  19. package/components/Layout/Layout.astro +35 -0
  20. package/components/Layout/types.ts +13 -0
  21. package/components/Metadata/AstroSeo.astro +40 -0
  22. package/components/Metadata/Metadata.astro +60 -0
  23. package/components/Metadata/types.ts +186 -0
  24. package/components/Metadata/utils/buildTags.ts +380 -0
  25. package/components/SeoAnalytics/SeoAnalytics.astro +15 -0
  26. package/components/SeoAnalytics/types.ts +3 -0
  27. package/components/SeoAnalyticsGoogleProvider/SeoAnalyticsGoogleProvider.astro +17 -0
  28. package/components/SeoAnalyticsGoogleProvider/types.ts +4 -0
  29. package/components/SeoAstroSeo/SeoAstroSeo.astro +40 -0
  30. package/components/SeoAstroSeo/SeoAstroSeo.svelte +3 -0
  31. package/components/SeoAstroSeo/types.ts +146 -0
  32. package/components/SeoMetadata/SeoMetadata.astro +8 -0
  33. package/components/SeoMetadata/types.ts +38 -0
  34. package/components/SeoSiteVerification/SeoSiteVerification.astro +6 -0
  35. package/components/SeoSiteVerification/types.ts +3 -0
  36. package/components/SiteVerification/SiteVerification.astro +6 -0
  37. package/components/SiteVerification/types.ts +1 -0
  38. package/components/WidgetWrapper/WidgetWrapper.astro +31 -0
  39. package/components/WidgetWrapper/WidgetWrapper.ts +6 -0
  40. package/components/WidgetWrapper/types.ts +10 -0
  41. package/index.d.ts +180 -0
  42. package/index.js +6 -0
  43. package/package.json +99 -0
  44. package/svelte.d.ts +32 -0
  45. package/svelte.js +19 -0
  46. package/utils/buildTags.ts +380 -0
  47. package/utils/css.ts +39 -0
  48. package/utils/images-optimization.ts +356 -0
  49. package/utils/images.ts +138 -0
  50. package/utils/index.ts +5 -0
  51. package/utils/permalinks.ts +38 -0
  52. package/utils/utils.ts +58 -0
  53. package/vendor-config/index.ts +115 -0
  54. package/vendor-config/types.d.ts +10 -0
  55. package/vendor-config/utils/configBuilder.ts +206 -0
  56. package/vendor-config/utils/loadConfig.ts +16 -0
@@ -0,0 +1,31 @@
1
+ ---
2
+ import { twMerge } from 'tailwind-merge';
3
+ import type { WidgetWrapperProps as Props } from './types';
4
+ import Background from '../Background/Background.astro';
5
+
6
+ const { id, isDark = false, containerClass = '', bg, as = 'section' } = Astro.props;
7
+
8
+ const WrapperTag = as;
9
+ ---
10
+
11
+ <WrapperTag class="relative" {...id ? { id } : {}}>
12
+ <!-- WrapperTag: bg -z-[1] -->
13
+ <div class="absolute inset-0 pointer-events-none" aria-hidden="true">
14
+ <slot name="bg">
15
+ {bg ? <Fragment set:html={bg} /> : <Background isDark={isDark} />}
16
+ </slot>
17
+ </div>
18
+
19
+ <!-- WrapperTag: content -->
20
+ <div
21
+ class:list={[
22
+ twMerge(
23
+ 'relative mx-auto max-w-7xl 2xl:max-w-[96rem] px-4 md:px-6 py-12 md:py-16 lg:py-20 text-default',
24
+ containerClass
25
+ ),
26
+ { dark: isDark },
27
+ ]}
28
+ >
29
+ <slot />
30
+ </div>
31
+ </WrapperTag>
@@ -0,0 +1,6 @@
1
+ import type { HTMLTag } from 'astro/types';
2
+
3
+ export type Card0Props = {
4
+ as?: HTMLTag;
5
+ classes?: Record<string, string>;
6
+ };
@@ -0,0 +1,10 @@
1
+ import type { HTMLTag } from 'astro/types';
2
+
3
+ export type WidgetWrapperProps = {
4
+ containerClass?: string;
5
+ ['as']?: HTMLTag;
6
+ id?: string;
7
+ isDark?: boolean;
8
+ bg?: string;
9
+ classes?: Record<string, string | Record<string, string>>;
10
+ };
package/index.d.ts ADDED
@@ -0,0 +1,180 @@
1
+
2
+ export type Gap = 'none'
3
+ | 'xxs'
4
+ | 'xs'
5
+ | 'sm'
6
+ | 'md'
7
+ | 'default'
8
+ | 'lg'
9
+ | 'xl'
10
+ | 'xl2'
11
+ | 'xl3'
12
+ | 'xl4'
13
+ | 'xl5'
14
+ | ''
15
+
16
+ export type VerticalAlignment = 'center'
17
+ | 'start'
18
+ | 'end'
19
+ | 'baseline'
20
+ | 'stretch'
21
+ | ''
22
+
23
+ export type HorizontalAlignment = 'center'
24
+ | 'start'
25
+ | 'end'
26
+ | 'between'
27
+ | 'around'
28
+ | 'evenly'
29
+ | 'stretch'
30
+ | ''
31
+
32
+ export type Direction = 'row'
33
+ | 'column'
34
+ | 'row-reverse'
35
+ | 'column-reverse'
36
+ | ''
37
+
38
+ export type Wrap = 'wrap'
39
+ | 'nowrap'
40
+ | 'wrap-reverse'
41
+ | ''
42
+
43
+ export type Column = (2 | 3) | {
44
+ default?: 2 | 3
45
+ xs?: 2 | 3 | 4
46
+ sm?: 2 | 3 | 4
47
+ md?: 2 | 3 | 4 | 5 | 6
48
+ lg?: 2 | 3 | 4 | 5 | 6 | 7 | 8
49
+ } | null
50
+
51
+ export type Responsive<T> = T | {
52
+ default?: T
53
+ xs?: T
54
+ sm?: T
55
+ md?: T
56
+ lg?: T
57
+ }
58
+
59
+ export type Alignment = {
60
+ horizontal?: HorizontalAlignment
61
+ vertical?: VerticalAlignment
62
+ }
63
+
64
+ export type getLayoutClassesConfig = {
65
+ gap?: Responsive<Gap>
66
+ alignment?: Responsive<Alignment>
67
+ direction?: Responsive<Direction>
68
+ wrap?: Responsive<Wrap>
69
+ }
70
+
71
+ export type ModalCallback = {
72
+ trigger: Element | null
73
+ modal: HTMLElement
74
+ }
75
+
76
+ export type Modal = {
77
+ trigger: string
78
+ modal: string
79
+ onOpen?: (args: ModalCallback) => unknown
80
+ onClose?: (args: ModalCallback) => unknown
81
+ }
82
+
83
+ export type PopoverPosition = 'top'
84
+ | 'top-start'
85
+ | 'top-end'
86
+ | 'left'
87
+ | 'left-start'
88
+ | 'left-end'
89
+ | 'right'
90
+ | 'right-start'
91
+ | 'right-end'
92
+ | 'bottom'
93
+ | 'bottom-start'
94
+ | 'bottom-end'
95
+
96
+ export type PopoverCallback = {
97
+ trigger: HTMLElement
98
+ popover: HTMLElement
99
+ position: PopoverPosition | undefined
100
+ }
101
+
102
+ export type Popover = {
103
+ trigger: string
104
+ popover: string
105
+ position?: PopoverPosition
106
+ offset?: number
107
+ closeOnBlur?: boolean
108
+ closeOnEsc?: boolean
109
+ onOpen?: (args: PopoverCallback) => unknown
110
+ onClose?: (args: PopoverCallback) => unknown
111
+ }
112
+
113
+ export type Toast = {
114
+ element: string
115
+ timeout?: number
116
+ title?: string
117
+ content?: string
118
+ position?: 'bottom-left'
119
+ | 'top-left'
120
+ | 'top-right'
121
+ | 'bottom-full'
122
+ | 'top-full'
123
+ | null
124
+ }
125
+
126
+ declare module 'yt-astro-ui' {
127
+ export const bodyFreeze: (freeze: boolean) => void
128
+ export const classNames: (classes: any[]) => string
129
+
130
+ export const setCookie: (name: string, value: string, days: number) => void
131
+ export const getCookie: (name: string) => string | null
132
+ export const removeCookie: (name: string) => void
133
+
134
+ export const debounce: <T extends (...args: any[]) => any>(
135
+ fn: T,
136
+ waitFor?: number
137
+ ) => {
138
+ (...args: Parameters<T>): void
139
+ cancel: () => void
140
+ }
141
+
142
+ export const get: (selector: string, all?: boolean) => Element | NodeListOf<Element> | null
143
+ export const on: (
144
+ selector: string | HTMLElement | Document,
145
+ event: string,
146
+ callback: any,
147
+ all?: boolean
148
+ ) => void
149
+
150
+ export const dispatch: (event: string, detail: unknown) => void
151
+ export const listen: (event: string, callback: (e: any) => unknown) => {
152
+ remove: () => void
153
+ }
154
+
155
+ export const getLayoutClasses: (config: getLayoutClassesConfig) => string
156
+
157
+ export const clamp: (num: number, min: number, max: number) => number
158
+ export const lerp: (start: number, end: number, value: number) => number
159
+ export const invlerp: (start: number, end: number, value: number) => number
160
+ export const interpolate: (
161
+ value: number,
162
+ input: [start: number, end: number],
163
+ output: [start: number, end: number]
164
+ ) => number
165
+
166
+ export const modal: (config: Modal | string) => {
167
+ open: () => void
168
+ remove: () => void
169
+ } | void
170
+ export const closeModal: (modal: string) => void
171
+
172
+ export const popover: (config: Popover) => {
173
+ remove: () => void
174
+ } | void
175
+ export const closePopover: (selector: string) => void
176
+
177
+ export const setDefaultTimeout: (time: number) => number
178
+ export const toast: (config: Toast | string) => void
179
+ export const hideToast: (element: string) => void
180
+ }
package/index.js ADDED
@@ -0,0 +1,6 @@
1
+ export * from './utils/css.ts'
2
+ export * from './utils/images-optimization.ts'
3
+ export * from './utils/images.ts'
4
+ export * from './utils/index.ts'
5
+ export * from './utils/permalinks.ts'
6
+ export * from './utils/utils.ts'
package/package.json ADDED
@@ -0,0 +1,99 @@
1
+ {
2
+ "name": "@yatoday/astro-ui",
3
+ "type": "module",
4
+ "version": "0.0.2",
5
+ "scripts": {
6
+ "prepare": "husky",
7
+ "pre-commit": "lint-staged",
8
+ "dev": "astro dev",
9
+ "build": "astro check && astro build",
10
+ "build:package": "node scripts/build.js",
11
+ "build:local": "node scripts/build.js --local",
12
+ "pub": "npm run build:package && cd dist && npm publish --access public",
13
+ "check": "npm run check:astro && npm run check:eslint && npm run check:prettier",
14
+ "check:astro": "astro check",
15
+ "check:eslint": "eslint .",
16
+ "check:prettier": "prettier --check .",
17
+ "fix": "npm run fix:eslint && npm run fix:prettier",
18
+ "fix:eslint": "eslint --fix .",
19
+ "fix:prettier": "prettier -w .",
20
+ "create-component": "node scripts/createComponent.js"
21
+ },
22
+ "dependencies": {
23
+ "lodash.merge": "^4.6.2",
24
+ "limax": "4.1.0",
25
+ "unpic": "^3.22.0",
26
+ "photoswipe": "^5.4.4",
27
+ "swiper": "^11.2.5"
28
+ },
29
+ "devDependencies": {
30
+ "@astrojs/check": "0.9.4",
31
+ "@astrojs/mdx": "^4.1.0",
32
+ "@astrojs/node": "^9.1.2",
33
+ "@astrojs/partytown": "^2.1.4",
34
+ "@astrojs/svelte": "^7.0.5",
35
+ "@eslint/js": "9.18.0",
36
+ "@tailwindcss/vite": "^4.0.12",
37
+ "@types/js-yaml": "^4.0.9",
38
+ "@typescript-eslint/parser": "8.21.0",
39
+ "astro": "^5.4.2",
40
+ "astro-compress": "2.3.6",
41
+ "astro-eslint-parser": "1.1.0",
42
+ "astro-icon": "^1.1.5",
43
+ "clsx": "^2.1.1",
44
+ "eslint": "9.18.0",
45
+ "eslint-plugin-astro": "1.3.1",
46
+ "eslint-plugin-simple-import-sort": "12.1.1",
47
+ "eslint-plugin-svelte": "2.46.1",
48
+ "husky": "9.1.7",
49
+ "js-yaml": "^4.1.0",
50
+ "jsdom": "26.0.0",
51
+ "lint-staged": "15.4.2",
52
+ "prettier": "^3.4.2",
53
+ "prettier-plugin-astro": "^0.14.1",
54
+ "svelte": "5.20.1",
55
+ "svelte-eslint-parser": "0.43.0",
56
+ "tailwindcss": "^4.0.12",
57
+ "tailwind-merge": "^3.0.0",
58
+ "@tailwindcss/typography": "^0.5.16",
59
+ "typescript": "5.7.3",
60
+ "typescript-eslint": "8.21.0",
61
+ "vite-tsconfig-paths": "5.1.4",
62
+ "@types/html-escaper": "^3.0.4",
63
+ "@types/lodash.merge": "^4.6.9",
64
+ "@iconify-json/tabler": "^1.2.10"
65
+ },
66
+ "exports": {
67
+ ".": "./index.js",
68
+ "./astro": "./astro.js",
69
+ "./svelte": "./svelte.js",
70
+ "./vendor-config": "./vendor-config/index.ts"
71
+ },
72
+ "files": [
73
+ "components",
74
+ "vendor-config",
75
+ "utils",
76
+ "astro.d.ts",
77
+ "astro.js",
78
+ "svelte.d.ts",
79
+ "svelte.js",
80
+ "index.js",
81
+ "index.d.ts",
82
+ "README.md",
83
+ "LICENSE"
84
+ ],
85
+ "license": "MIT",
86
+ "description": "A component library built for Astro and Svelte",
87
+ "keywords": [],
88
+ "homepage": "https://astro-ui.dev.yatoday.es",
89
+ "repository": {
90
+ "type": "git",
91
+ "url": "git+https://github.com/qwert2001qwert-alex/yt-astro-ui.git"
92
+ },
93
+ "bugs": {
94
+ "url": "https://github.com/qwert2001qwert-alex/yt-astro-ui/issues"
95
+ },
96
+ "lint-staged": {
97
+ "*.{js,ts,jsx,tsx,svelte,astro}": "eslint src/**/*"
98
+ }
99
+ }
package/svelte.d.ts ADDED
@@ -0,0 +1,32 @@
1
+ import type { Component } from 'svelte'
2
+ import type { SvelteAnalyticsProps as YtSvelteAnalyticsProps } from './components/Analytics/types'
3
+ import type { SvelteBackgroundProps as YtSvelteBackgroundProps } from './components/Background/types'
4
+ import type { SvelteCard0Props as YtSvelteCard0Props } from './components/Card0/types'
5
+ import type { SvelteConditionalWrapperProps as YtSvelteConditionalWrapperProps } from './components/ConditionalWrapper/types'
6
+ import type { SvelteDarkModeProps as YtSvelteDarkModeProps } from './components/DarkMode/types'
7
+ import type { SvelteLayoutProps as YtSvelteLayoutProps } from './components/Layout/types'
8
+ import type { SvelteMetadataProps as YtSvelteMetadataProps } from './components/Metadata/types'
9
+ import type { SvelteSiteVerificationProps as YtSvelteSiteVerificationProps } from './components/SiteVerification/types'
10
+ import type { SvelteWidgetWrapperProps as YtSvelteWidgetWrapperProps } from './components/WidgetWrapper/types'
11
+
12
+ declare module '@yatoday/astro-ui/svelte' {
13
+ export const Analytics: Component<YtSvelteAnalyticsProps>
14
+ export const Background: Component<YtSvelteBackgroundProps>
15
+ export const Card0: Component<YtSvelteCard0Props>
16
+ export const ConditionalWrapper: Component<YtSvelteConditionalWrapperProps>
17
+ export const DarkMode: Component<YtSvelteDarkModeProps>
18
+ export const Layout: Component<YtSvelteLayoutProps>
19
+ export const Metadata: Component<YtSvelteMetadataProps>
20
+ export const SiteVerification: Component<YtSvelteSiteVerificationProps>
21
+ export const WidgetWrapper: Component<YtSvelteWidgetWrapperProps>
22
+
23
+ export type AnalyticsProps = YtSvelteAnalyticsProps
24
+ export type BackgroundProps = YtSvelteBackgroundProps
25
+ export type Card0Props = YtSvelteCard0Props
26
+ export type ConditionalWrapperProps = YtSvelteConditionalWrapperProps
27
+ export type DarkModeProps = YtSvelteDarkModeProps
28
+ export type LayoutProps = YtSvelteLayoutProps
29
+ export type MetadataProps = YtSvelteMetadataProps
30
+ export type SiteVerificationProps = YtSvelteSiteVerificationProps
31
+ export type WidgetWrapperProps = YtSvelteWidgetWrapperProps
32
+ }
package/svelte.js ADDED
@@ -0,0 +1,19 @@
1
+ import AnalyticsComponent from './components/Analytics/Analytics.svelte'
2
+ import BackgroundComponent from './components/Background/Background.svelte'
3
+ import Card0Component from './components/Card0/Card0.svelte'
4
+ import ConditionalWrapperComponent from './components/ConditionalWrapper/ConditionalWrapper.svelte'
5
+ import DarkModeComponent from './components/DarkMode/DarkMode.svelte'
6
+ import LayoutComponent from './components/Layout/Layout.svelte'
7
+ import MetadataComponent from './components/Metadata/Metadata.svelte'
8
+ import SiteVerificationComponent from './components/SiteVerification/SiteVerification.svelte'
9
+ import WidgetWrapperComponent from './components/WidgetWrapper/WidgetWrapper.svelte'
10
+
11
+ export const Analytics = AnalyticsComponent
12
+ export const Background = BackgroundComponent
13
+ export const Card0 = Card0Component
14
+ export const ConditionalWrapper = ConditionalWrapperComponent
15
+ export const DarkMode = DarkModeComponent
16
+ export const Layout = LayoutComponent
17
+ export const Metadata = MetadataComponent
18
+ export const SiteVerification = SiteVerificationComponent
19
+ export const WidgetWrapper = WidgetWrapperComponent