@blogmcp/mdx-schema 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/checkPin.d.ts +48 -0
  2. package/dist/checkPin.js +139 -0
  3. package/dist/checkPin.js.map +1 -0
  4. package/dist/composables/useMdxParsing.d.ts +71 -0
  5. package/dist/composables/useMdxParsing.js +239 -0
  6. package/dist/composables/useMdxParsing.js.map +1 -0
  7. package/dist/index.d.ts +21 -0
  8. package/dist/index.js +22 -0
  9. package/dist/index.js.map +1 -0
  10. package/dist/metadata/customComponents.d.ts +128 -0
  11. package/dist/metadata/customComponents.js +301 -0
  12. package/dist/metadata/customComponents.js.map +1 -0
  13. package/dist/metadata/index.d.ts +24 -0
  14. package/dist/metadata/index.js +427 -0
  15. package/dist/metadata/index.js.map +1 -0
  16. package/dist/metadata/validate.d.ts +46 -0
  17. package/dist/metadata/validate.js +95 -0
  18. package/dist/metadata/validate.js.map +1 -0
  19. package/dist/prepareProps.d.ts +42 -0
  20. package/dist/prepareProps.js +177 -0
  21. package/dist/prepareProps.js.map +1 -0
  22. package/dist/styles/index.d.ts +203 -0
  23. package/dist/styles/index.js +162 -0
  24. package/dist/styles/index.js.map +1 -0
  25. package/dist/types/index.d.ts +421 -0
  26. package/dist/types/index.js +25 -0
  27. package/dist/types/index.js.map +1 -0
  28. package/dist/version.d.ts +23 -0
  29. package/dist/version.js +23 -0
  30. package/dist/version.js.map +1 -0
  31. package/package.json +80 -0
  32. package/src/checkPin.ts +163 -0
  33. package/src/composables/useMdxParsing.ts +248 -0
  34. package/src/index.ts +22 -0
  35. package/src/metadata/customComponents.ts +360 -0
  36. package/src/metadata/index.ts +437 -0
  37. package/src/metadata/validate.ts +153 -0
  38. package/src/prepareProps.ts +219 -0
  39. package/src/styles/index.ts +196 -0
  40. package/src/types/index.ts +469 -0
  41. package/src/version.ts +24 -0
@@ -0,0 +1,219 @@
1
+ /**
2
+ * Render-time prop normalization shim.
3
+ *
4
+ * Centralized for ALL renderers (Vue, React, and the Headless SDK) — see
5
+ * the `prepareNotCalled` CI rule. Walks `metadata.deprecated[]` and
6
+ * applies each entry to a shallow-cloned copy of `rawProps`. Returns the
7
+ * normalized object; the input is never mutated.
8
+ *
9
+ * Per-kind behaviour:
10
+ * - propRename: if `rawProps[entry.prop]` is set AND
11
+ * `rawProps[entry.aliasFor]` is NOT set, copy the value across.
12
+ * When BOTH are present the new name wins (latest schema beats stored
13
+ * legacy). Old name is then dropped from the returned object so the
14
+ * downstream component never sees it.
15
+ * - enumValueRename: if `rawProps[entry.prop]` is a string AND is a key
16
+ * of `entry.valueAliases`, replace it with the mapped value.
17
+ * - propRemoved: KEEPS the prop in the returned object (review finding —
18
+ * deleting silently strips data that custom components, the headless
19
+ * SDK, or a future codemod-retry may still need). Logs once so an
20
+ * operator can investigate the tenant's `schema_version`.
21
+ * - propBecameRequired: if `rawProps[entry.prop]` is MISSING (legacy
22
+ * article authored before the prop became required, or stored
23
+ * content the backfill codemod hasn't touched), inject
24
+ * `entry.defaultValue` as the runtime fallback. Logs so an operator
25
+ * can investigate why the codemod hasn't caught up. If the prop is
26
+ * already present, no-op (the codemod did its job or the article
27
+ * was authored post-flip).
28
+ *
29
+ * Logging is process-deduped via the module-level `loggedKeys` Set
30
+ * keyed on `${componentName}.${kind}.${prop}` so each soft-break warns
31
+ * exactly once per process lifetime. Production silence is guaranteed
32
+ * by the `process.env.NODE_ENV === 'production'` short-circuit.
33
+ */
34
+
35
+ import type { ComponentMetadata } from './types/index.js'
36
+ import {
37
+ isComponentStructureChangeEntry,
38
+ isDefaultChangeAcceptedEntry,
39
+ isEnumValueRenameEntry,
40
+ isPropBecameRequiredEntry,
41
+ isPropRemovedEntry,
42
+ isPropRenameEntry,
43
+ } from './types/index.js'
44
+
45
+ /**
46
+ * Process-lifetime dedupe set. Keys: `${componentName}.${kind}.${prop}`.
47
+ * Exported only for tests (so they can clear between specs).
48
+ */
49
+ export const loggedKeys: Set<string> = new Set()
50
+
51
+ /** Test-only — never call from production code. */
52
+ export function _resetPrepareDedupeForTests(): void {
53
+ loggedKeys.clear()
54
+ }
55
+
56
+ function isProduction(): boolean {
57
+ // Node-safe: explicit guard so the shim works in browsers / Workers /
58
+ // any runtime without a `process` global. We treat "no process" as
59
+ // "not production" — surfacing dev-mode warnings is the safer default.
60
+ return typeof process !== 'undefined'
61
+ && typeof process.env !== 'undefined'
62
+ && process.env.NODE_ENV === 'production'
63
+ }
64
+
65
+ function logOnce(key: string, message: string): void {
66
+ if (isProduction()) return
67
+ if (loggedKeys.has(key)) return
68
+ loggedKeys.add(key)
69
+ // eslint-disable-next-line no-console
70
+ console.warn(`[mdx-schema] ${message}`)
71
+ }
72
+
73
+ /**
74
+ * Matches event-handler-shaped prop keys: `onclick`, `onError`, `ONMOUSEOVER`,
75
+ * `onPointerDown`, etc.
76
+ */
77
+ const EVENT_HANDLER_PROP_RE = /^on[A-Za-z]/i
78
+
79
+ /**
80
+ * Defense-in-depth filter that drops STRING-valued event-handler-shaped
81
+ * props.
82
+ *
83
+ * The threat model: a stored MDX article writes
84
+ * `<Button onclick="alert(1)" label="x" />`. The MDX regex parser yields
85
+ * `{onclick: 'alert(1)', label: 'x'}` — a STRING value. Most of our
86
+ * components don't spread incoming props onto DOM elements, but the
87
+ * wrapping HOCs in `mdx-render-vue/registry.ts` and
88
+ * `mdx-render-react/server-render-map.ts` DO pass props through verbatim
89
+ * — a future component that spreads `{...rest}` onto a DOM element would
90
+ * render the `onclick` attribute and execute attacker code.
91
+ *
92
+ * String-only: we keep function-typed `onClick: () => {}` props since they
93
+ * come from programmatic mount (host code, not stored MDX content) and
94
+ * Vue/React treat them as event bindings — never as inline HTML attributes.
95
+ * MDX content can only ever produce STRING-valued attributes, so the
96
+ * string check is a precise fit to the threat.
97
+ *
98
+ * Layer A (HTML sanitizer in @blogmcp/sanitize) catches `on*=` in raw
99
+ * HTML within article bodies; this catches `on*=` in MDX component props
100
+ * (invisible to DOMPurify, which only sees the final HTML output).
101
+ *
102
+ * No real schema component currently has an `on*`-shaped prop, so this is
103
+ * safe across the 11-component library. Documented in the
104
+ * trust-contract docs.
105
+ */
106
+ function isDangerousEventHandlerProp(key: string, value: unknown): boolean {
107
+ return EVENT_HANDLER_PROP_RE.test(key) && typeof value === 'string'
108
+ }
109
+
110
+ export function prepareProps(
111
+ rawProps: Record<string, unknown>,
112
+ metadata: ComponentMetadata,
113
+ ): Record<string, unknown> {
114
+ // Shallow clone — never mutate the caller's object.
115
+ const props: Record<string, unknown> = { ...rawProps }
116
+
117
+ // Defense in depth — strip string-valued event-handler-shaped keys
118
+ // before anything else runs. See `isDangerousEventHandlerProp` doc above.
119
+ for (const key of Object.keys(props)) {
120
+ if (isDangerousEventHandlerProp(key, props[key])) {
121
+ delete props[key]
122
+ logOnce(
123
+ `${metadata.name}.eventHandlerProp.${key}`,
124
+ `${metadata.name}: dropped string-valued event-handler-shaped prop "${key}" — MDX content cannot bind DOM event handlers (potential XSS vector).`,
125
+ )
126
+ }
127
+ }
128
+
129
+ for (const entry of metadata.deprecated) {
130
+ if (isPropRenameEntry(entry)) {
131
+ const oldPresent = Object.prototype.hasOwnProperty.call(props, entry.prop)
132
+ const newPresent = Object.prototype.hasOwnProperty.call(props, entry.aliasFor)
133
+
134
+ if (oldPresent) {
135
+ if (!newPresent) {
136
+ props[entry.aliasFor] = props[entry.prop]
137
+ }
138
+ // If both present, the explicit new name wins — drop the old
139
+ // name regardless so the rendered component sees only the
140
+ // canonical shape.
141
+ delete props[entry.prop]
142
+
143
+ logOnce(
144
+ `${metadata.name}.propRename.${entry.prop}`,
145
+ `${metadata.name}: prop "${entry.prop}" was renamed to "${entry.aliasFor}" in ${entry.since} (removed in ${entry.removeIn}). ${entry.message}`,
146
+ )
147
+ }
148
+ continue
149
+ }
150
+
151
+ if (isEnumValueRenameEntry(entry)) {
152
+ const current = props[entry.prop]
153
+ if (typeof current === 'string' && Object.prototype.hasOwnProperty.call(entry.valueAliases, current)) {
154
+ const mapped = entry.valueAliases[current]
155
+ props[entry.prop] = mapped
156
+ logOnce(
157
+ `${metadata.name}.enumValueRename.${entry.prop}`,
158
+ `${metadata.name}.${entry.prop}: value "${current}" was renamed to "${mapped}" in ${entry.since} (removed in ${entry.removeIn}). ${entry.message}`,
159
+ )
160
+ }
161
+ continue
162
+ }
163
+
164
+ if (isPropRemovedEntry(entry)) {
165
+ if (Object.prototype.hasOwnProperty.call(props, entry.prop)) {
166
+ // Review fix: KEEP the prop in the output. Silently deleting
167
+ // it strips data that custom components (registerCustomComponent
168
+ // path) and the headless SDK may still need. The presence is a
169
+ // signal to investigate (stale schema_version, codemod skipped),
170
+ // not a license to drop data. (The historical concern about
171
+ // breaking the propRequiredFlipped flow is now moot — that
172
+ // case uses the dedicated `propBecameRequired` kind below.)
173
+ logOnce(
174
+ `${metadata.name}.propRemoved.${entry.prop}`,
175
+ `${metadata.name}: prop "${entry.prop}" was removed in ${entry.removeIn} but is still present on content (run codemod ${entry.codemod}). ${entry.message}`,
176
+ )
177
+ }
178
+ continue
179
+ }
180
+
181
+ if (isPropBecameRequiredEntry(entry)) {
182
+ // Render-time safety net: when stored content omits a now-required
183
+ // prop (legacy article, codemod pending, tenant on stale
184
+ // schema_version), inject the codemod's backfill default so the
185
+ // receiving component never sees `undefined` for what its type
186
+ // contract says is mandatory. When the prop IS present we no-op —
187
+ // the codemod did its job or the article was authored post-flip.
188
+ if (!Object.prototype.hasOwnProperty.call(props, entry.prop)) {
189
+ props[entry.prop] = entry.defaultValue
190
+ logOnce(
191
+ `${metadata.name}.propBecameRequired.${entry.prop}`,
192
+ `${metadata.name}: prop "${entry.prop}" became required in ${entry.since} but is missing from stored content (run codemod ${entry.codemod}; injected default for render). ${entry.message}`,
193
+ )
194
+ }
195
+ continue
196
+ }
197
+
198
+ if (isDefaultChangeAcceptedEntry(entry)) {
199
+ // Pure release-notes acknowledgement — no render-time mutation.
200
+ // The shim does NOT rewrite stored props (authors opted in to drift).
201
+ continue
202
+ }
203
+
204
+ if (isComponentStructureChangeEntry(entry)) {
205
+ // Render-time bookkeeping only — `hasChildren` / `selfClosing` are
206
+ // a parser-level concern, not a prop. The CI classifier enforces
207
+ // these entries; the shim has no prop to rewrite.
208
+ continue
209
+ }
210
+
211
+ // Exhaustive-check escape hatch — TypeScript proves the union is
212
+ // fully matched; if a future tagged variant is added without an arm
213
+ // here this line forces a type error.
214
+ const _exhaustive: never = entry
215
+ void _exhaustive
216
+ }
217
+
218
+ return props
219
+ }
@@ -0,0 +1,196 @@
1
+ /**
2
+ * Shared Tailwind class tables for table-driven MDX components.
3
+ *
4
+ * Pure data — no framework dependencies. Lifted VERBATIM from the reference
5
+ * Vue SFCs (`@blogmcp/mdx-render-vue/src/render/...`) so that the Vue and
6
+ * React renderers compose byte-identical class strings. This is the single
7
+ * source of truth: when a variant/color/size class changes, change it here.
8
+ *
9
+ * Tailwind JIT note: consumer Tailwind configs MUST scan this file (e.g.
10
+ * `./node_modules/@blogmcp/mdx-schema/src/styles/**`) so every class string
11
+ * below is seen at build time. Interpolated class names would not be visible
12
+ * to the JIT — every class here is a literal.
13
+ */
14
+
15
+ import type { GalleryProps } from '../types/index.js'
16
+
17
+ // ---------------------------------------------------------------------------
18
+ // Button — from mdx-render-vue/src/render/button/Button.vue
19
+ // ---------------------------------------------------------------------------
20
+ export const buttonStyles = {
21
+ base: 'inline-flex items-center justify-center font-medium border transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2',
22
+ size: {
23
+ sm: 'px-2.5 py-1 text-sm rounded',
24
+ md: 'px-4 py-2 text-sm rounded-md',
25
+ lg: 'px-5 py-2.5 text-base rounded-md',
26
+ },
27
+ variantColor: {
28
+ solid: {
29
+ primary: 'bg-blue-600 text-white hover:bg-blue-700 border-transparent',
30
+ neutral: 'bg-gray-800 text-white hover:bg-gray-900 border-transparent',
31
+ success: 'bg-emerald-600 text-white hover:bg-emerald-700 border-transparent',
32
+ warning: 'bg-amber-500 text-white hover:bg-amber-600 border-transparent',
33
+ error: 'bg-red-600 text-white hover:bg-red-700 border-transparent',
34
+ },
35
+ outline: {
36
+ primary: 'border-blue-600 text-blue-700 hover:bg-blue-50',
37
+ neutral: 'border-gray-400 text-gray-800 hover:bg-gray-50',
38
+ success: 'border-emerald-600 text-emerald-700 hover:bg-emerald-50',
39
+ warning: 'border-amber-500 text-amber-700 hover:bg-amber-50',
40
+ error: 'border-red-600 text-red-700 hover:bg-red-50',
41
+ },
42
+ soft: {
43
+ primary: 'bg-blue-50 text-blue-700 hover:bg-blue-100 border-transparent',
44
+ neutral: 'bg-gray-100 text-gray-800 hover:bg-gray-200 border-transparent',
45
+ success: 'bg-emerald-50 text-emerald-700 hover:bg-emerald-100 border-transparent',
46
+ warning: 'bg-amber-50 text-amber-700 hover:bg-amber-100 border-transparent',
47
+ error: 'bg-red-50 text-red-700 hover:bg-red-100 border-transparent',
48
+ },
49
+ ghost: {
50
+ primary: 'text-blue-700 hover:bg-blue-50 border-transparent',
51
+ neutral: 'text-gray-800 hover:bg-gray-100 border-transparent',
52
+ success: 'text-emerald-700 hover:bg-emerald-50 border-transparent',
53
+ warning: 'text-amber-700 hover:bg-amber-50 border-transparent',
54
+ error: 'text-red-700 hover:bg-red-50 border-transparent',
55
+ },
56
+ link: {
57
+ primary: 'text-blue-700 hover:underline border-transparent bg-transparent',
58
+ neutral: 'text-gray-800 hover:underline border-transparent bg-transparent',
59
+ success: 'text-emerald-700 hover:underline border-transparent bg-transparent',
60
+ warning: 'text-amber-700 hover:underline border-transparent bg-transparent',
61
+ error: 'text-red-700 hover:underline border-transparent bg-transparent',
62
+ },
63
+ },
64
+ } as const
65
+
66
+ // ---------------------------------------------------------------------------
67
+ // Badge — from mdx-render-vue/src/render/badge/Badge.vue
68
+ // ---------------------------------------------------------------------------
69
+ export const badgeStyles = {
70
+ base: 'inline-flex items-center px-2 py-0.5 text-xs font-medium border rounded-full',
71
+ variantColor: {
72
+ solid: {
73
+ primary: 'bg-blue-600 text-white border-transparent',
74
+ neutral: 'bg-gray-700 text-white border-transparent',
75
+ success: 'bg-emerald-600 text-white border-transparent',
76
+ warning: 'bg-amber-500 text-white border-transparent',
77
+ error: 'bg-red-600 text-white border-transparent',
78
+ },
79
+ soft: {
80
+ primary: 'bg-blue-100 text-blue-800 border-transparent',
81
+ neutral: 'bg-gray-100 text-gray-700 border-transparent',
82
+ success: 'bg-emerald-100 text-emerald-800 border-transparent',
83
+ warning: 'bg-amber-100 text-amber-800 border-transparent',
84
+ error: 'bg-red-100 text-red-800 border-transparent',
85
+ },
86
+ outline: {
87
+ primary: 'border-blue-500 text-blue-700',
88
+ neutral: 'border-gray-400 text-gray-700',
89
+ success: 'border-emerald-500 text-emerald-700',
90
+ warning: 'border-amber-500 text-amber-700',
91
+ error: 'border-red-500 text-red-700',
92
+ },
93
+ },
94
+ } as const
95
+
96
+ // ---------------------------------------------------------------------------
97
+ // Alert — from mdx-render-vue/src/render/alert/Alert.vue
98
+ // severity → wrap classes + iconify icon + icon color
99
+ // ---------------------------------------------------------------------------
100
+ export const alertStyles = {
101
+ base: 'mdx-alert flex gap-3 rounded-md border px-4 py-3 text-sm',
102
+ severity: {
103
+ info: { wrap: 'bg-blue-50 border-blue-200 text-blue-900', icon: 'lucide:info', iconClass: 'text-blue-600' },
104
+ success: { wrap: 'bg-emerald-50 border-emerald-200 text-emerald-900', icon: 'lucide:check-circle-2', iconClass: 'text-emerald-600' },
105
+ warning: { wrap: 'bg-amber-50 border-amber-200 text-amber-900', icon: 'lucide:alert-triangle', iconClass: 'text-amber-600' },
106
+ error: { wrap: 'bg-red-50 border-red-200 text-red-900', icon: 'lucide:alert-octagon', iconClass: 'text-red-600' },
107
+ },
108
+ } as const
109
+
110
+ // ---------------------------------------------------------------------------
111
+ // Callout — from mdx-render-vue/src/render/callout/{CalloutDefault,CalloutMinimal}.vue
112
+ //
113
+ // Two variants share a per-type color table. `default` adds an inline SVG icon
114
+ // (path data below); `minimal` is icon-less with flatter colors.
115
+ // ---------------------------------------------------------------------------
116
+ export const calloutStyles = {
117
+ default: {
118
+ base: 'callout my-6 p-4 rounded-lg border-l-4',
119
+ type: {
120
+ info: { bg: 'bg-blue-50', border: 'border-blue-500', text: 'text-blue-900', iconColor: 'text-blue-500' },
121
+ warning: { bg: 'bg-yellow-50', border: 'border-yellow-500', text: 'text-yellow-900', iconColor: 'text-yellow-500' },
122
+ tip: { bg: 'bg-green-50', border: 'border-green-500', text: 'text-green-900', iconColor: 'text-green-500' },
123
+ danger: { bg: 'bg-red-50', border: 'border-red-500', text: 'text-red-900', iconColor: 'text-red-500' },
124
+ },
125
+ },
126
+ minimal: {
127
+ base: 'callout my-6 p-4 rounded border',
128
+ type: {
129
+ info: { bg: 'bg-blue-50', border: 'border-blue-200', text: 'text-blue-800' },
130
+ warning: { bg: 'bg-yellow-50', border: 'border-yellow-200', text: 'text-yellow-800' },
131
+ tip: { bg: 'bg-green-50', border: 'border-green-200', text: 'text-green-800' },
132
+ danger: { bg: 'bg-red-50', border: 'border-red-200', text: 'text-red-800' },
133
+ },
134
+ },
135
+ /** SVG path data for the `default` variant icon, keyed by callout type. */
136
+ iconPaths: {
137
+ info: 'M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z',
138
+ warning: 'M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z',
139
+ tip: 'M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z',
140
+ danger: 'M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z',
141
+ },
142
+ } as const
143
+
144
+ export type ButtonVariant = keyof typeof buttonStyles.variantColor
145
+ export type ButtonColor = keyof typeof buttonStyles.variantColor.solid
146
+ export type ButtonSize = keyof typeof buttonStyles.size
147
+ export type BadgeVariant = keyof typeof badgeStyles.variantColor
148
+ export type BadgeColor = keyof typeof badgeStyles.variantColor.solid
149
+ export type AlertSeverity = keyof typeof alertStyles.severity
150
+ export type CalloutVariant = 'default' | 'minimal'
151
+
152
+ // ---------------------------------------------------------------------------
153
+ // Gallery tile geometry — single source of truth for the Vue + React renderers
154
+ // (and the md-editor preview). Pure + framework-agnostic: returns inline style
155
+ // objects (so a consumer's Tailwind JIT purge can't drop arbitrary
156
+ // aspect-[…]/object-[…] utilities) keyed in camelCase, which both Vue `:style`
157
+ // and React `style` accept. Renderers wrap this if they need a stricter style
158
+ // type (e.g. React `CSSProperties`).
159
+ // ---------------------------------------------------------------------------
160
+
161
+ export interface GalleryTileLayout {
162
+ /** Inline style for the tile box (sets aspect-ratio, or empty for "auto"). */
163
+ tileStyle: Record<string, string>
164
+ /** Inline style for the img/video (object-fit + object-position, or empty). */
165
+ mediaStyle: Record<string, string>
166
+ /** Sizing class for the img/video: fills the fixed tile, or natural height. */
167
+ mediaSizeClass: string
168
+ }
169
+
170
+ /**
171
+ * Derive tile/media inline styles from the Gallery `aspectRatio`/`fit`/`position`
172
+ * props.
173
+ *
174
+ * - `aspectRatio="auto"` → no fixed box; the image keeps its natural height
175
+ * (`w-full h-auto`); object-fit/position are irrelevant.
176
+ * - otherwise → a fixed-aspect box; the image fills it (`w-full h-full`) with
177
+ * `object-fit`/`object-position` controlling crop + region of interest.
178
+ *
179
+ * Uses `||` (not `??`) for the defaults so an empty-string prop (e.g.
180
+ * `aspectRatio=""` from a template emitting a blank attribute) falls back to the
181
+ * default instead of producing an invalid/empty CSS value (which would collapse
182
+ * the tile to zero height, or — for `fit=""` — stretch the image via `fill`).
183
+ */
184
+ export function galleryTileLayout(
185
+ props: Pick<GalleryProps, 'aspectRatio' | 'fit' | 'position'>,
186
+ ): GalleryTileLayout {
187
+ const aspectRatio = props.aspectRatio || '1'
188
+ if (aspectRatio === 'auto') {
189
+ return { tileStyle: {}, mediaStyle: {}, mediaSizeClass: 'w-full h-auto' }
190
+ }
191
+ return {
192
+ tileStyle: { aspectRatio },
193
+ mediaStyle: { objectFit: props.fit || 'cover', objectPosition: props.position || 'center' },
194
+ mediaSizeClass: 'w-full h-full',
195
+ }
196
+ }