nuxt-og-image 6.5.2 → 6.6.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/dist/chunks/tw4.cjs +1 -1
- package/dist/chunks/tw4.mjs +1 -1
- package/dist/chunks/uno.cjs +1 -1
- package/dist/chunks/uno.mjs +1 -1
- package/dist/devtools/components/og-image/AddComponentDialog.vue +85 -0
- package/dist/devtools/components/og-image/BlueskyCardRenderer.vue +134 -0
- package/dist/devtools/components/og-image/CreateOgImageDialog.vue +56 -0
- package/dist/devtools/components/og-image/DiscordCardRenderer.vue +125 -0
- package/dist/devtools/components/og-image/FacebookCardRenderer.vue +128 -0
- package/dist/devtools/components/og-image/IFrameLoader.vue +93 -0
- package/dist/devtools/components/og-image/ImageLoader.vue +197 -0
- package/dist/devtools/components/og-image/LinkedInCardRenderer.vue +100 -0
- package/dist/devtools/components/og-image/RendererSelectModal.vue +356 -0
- package/dist/devtools/components/og-image/SlackCardRenderer.vue +140 -0
- package/dist/devtools/components/og-image/TemplateComponentPreview.vue +186 -0
- package/dist/devtools/components/og-image/TwitterCardRenderer.vue +170 -0
- package/dist/devtools/components/og-image/WhatsAppRenderer.vue +294 -0
- package/dist/devtools/lib/og-image/keys.ts +8 -0
- package/dist/devtools/lib/og-image/og-image.ts +536 -0
- package/dist/devtools/lib/og-image/renderer-select.ts +3 -0
- package/dist/devtools/lib/og-image/rpc-types.ts +2 -0
- package/dist/devtools/lib/og-image/rpc.ts +73 -0
- package/dist/devtools/lib/og-image/runtime-types.ts +10 -0
- package/dist/devtools/lib/og-image/shared/urlEncoding.ts +502 -0
- package/dist/devtools/lib/og-image/shared.ts +30 -0
- package/dist/devtools/lib/og-image/templates.ts +9 -0
- package/dist/devtools/lib/og-image/types.ts +38 -0
- package/dist/devtools/lib/og-image/util/logic.ts +21 -0
- package/dist/devtools/nuxt.config.ts +6 -0
- package/dist/devtools/pages/og-image/debug.vue +32 -0
- package/dist/devtools/pages/og-image/docs.vue +3 -0
- package/dist/devtools/pages/og-image/index.vue +1682 -0
- package/dist/devtools/pages/og-image/templates.vue +150 -0
- package/dist/devtools/pages/og-image.vue +184 -0
- package/dist/module.cjs +1 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/server/og-image/core/plugins/imageSrc.js +2 -2
- package/dist/runtime/server/og-image/core/style-attr.d.ts +8 -0
- package/dist/runtime/server/og-image/core/style-attr.js +34 -0
- package/dist/runtime/server/og-image/core/vnodes.d.ts +2 -1
- package/dist/runtime/server/og-image/core/vnodes.js +3 -27
- package/dist/shared/{nuxt-og-image.CgPzmzQY.cjs → nuxt-og-image.CfTPCtaS.cjs} +38 -24
- package/dist/shared/{nuxt-og-image.DGAMxBol.mjs → nuxt-og-image.DdbTs-xp.mjs} +37 -23
- package/package.json +17 -18
- package/dist/devtools/200.html +0 -1
- package/dist/devtools/404.html +0 -1
- package/dist/devtools/_fonts/4ppnHhMi-pBsWSPo7mY0avYxlDoAg1N3PTzCwXLZ5rA-d9oibkGnTd1JL3tc_xnaVgBLYmOB8kjrK2cvZaqwj9s.woff2 +0 -0
- package/dist/devtools/_fonts/PV2hrQG6wq5BlIPDjdL1IcOflycaghyt5MHzlBqZtlo-lb_WexLz3VZqfTN0oi554iBH5tT2j2UFEV-XErCAS3E.woff2 +0 -0
- package/dist/devtools/_fonts/VE4cDVCv5MxbFM7ZLoLCGbIpNd71zhp7MDI9lmN5Y7I-xZyDYCUVrd6LV8eVGF3Um3UZjBFuUtDGtvdyTBBRYBo.woff2 +0 -0
- package/dist/devtools/_fonts/fVoGbnMbBFd5L9BBp9fUPavUSkZ_EmsQNSyadkT-108-U4T0khaeLQSIhtt9eVvaCEKJjtWJ4ioRJOf8hvqkWY0.woff2 +0 -0
- package/dist/devtools/_fonts/lQAxeCEs1R0Lw-H9XRU1RlOARQN8J6npRsPjyEDMe5s-_DUSLEkO3tKTuun_gSnDLoQPVEnpOnyqZMOw0ByZ6PA.woff2 +0 -0
- package/dist/devtools/_fonts/lntlqNHKLV2n82yTwMde70QqOjcfLE2XJ5oKZ3vRPWc-z6TxpIZQdWXztWLr9_OFWqt_WJJoeGtuK_-XQMZGQwE.woff2 +0 -0
- package/dist/devtools/_nuxt/B9jrmesR.js +0 -1
- package/dist/devtools/_nuxt/BA-4cUNc.js +0 -1
- package/dist/devtools/_nuxt/BOEXnX7x.js +0 -3
- package/dist/devtools/_nuxt/BWKJ0Uxb.js +0 -30
- package/dist/devtools/_nuxt/Bdtz4ZK9.js +0 -4
- package/dist/devtools/_nuxt/C5797Ieg.js +0 -1
- package/dist/devtools/_nuxt/C5jzcy9i.js +0 -1
- package/dist/devtools/_nuxt/CCTv7mmB.js +0 -1
- package/dist/devtools/_nuxt/CP0tQR2M.js +0 -1
- package/dist/devtools/_nuxt/C_JnDlx-.js +0 -1
- package/dist/devtools/_nuxt/CdmciVPJ.js +0 -1
- package/dist/devtools/_nuxt/CqjbkMN9.js +0 -3
- package/dist/devtools/_nuxt/CuJezOxb.js +0 -1
- package/dist/devtools/_nuxt/D4EkL0XJ.js +0 -6
- package/dist/devtools/_nuxt/DKaW7clv.js +0 -1
- package/dist/devtools/_nuxt/DSl3mlLY.js +0 -2
- package/dist/devtools/_nuxt/DYta7Mdi.js +0 -3
- package/dist/devtools/_nuxt/DevtoolsSection.CcOMr_vO.css +0 -1
- package/dist/devtools/_nuxt/DevtoolsSnippet.BhrTdbXn.css +0 -1
- package/dist/devtools/_nuxt/E8AZ6HoH.js +0 -1
- package/dist/devtools/_nuxt/IFrameLoader.k_861Nnq.css +0 -1
- package/dist/devtools/_nuxt/O5eLyffU.js +0 -1
- package/dist/devtools/_nuxt/builds/latest.json +0 -1
- package/dist/devtools/_nuxt/builds/meta/a36bc212-7179-4aa2-a534-6366229bd7b1.json +0 -1
- package/dist/devtools/_nuxt/entry.CcrXpo2y.css +0 -2
- package/dist/devtools/_nuxt/fira-code.Bc8wnsZt.woff2 +0 -0
- package/dist/devtools/_nuxt/hubot-sans.DLGyhQVu.woff2 +0 -0
- package/dist/devtools/_nuxt/pages.Ci_xvfJ8.css +0 -1
- package/dist/devtools/_nuxt/renderer-select.COGJ4ZQe.css +0 -1
- package/dist/devtools/_nuxt/templates.BByln3BG.css +0 -1
- package/dist/devtools/_nuxt/wMBdlVF-.js +0 -152
- package/dist/devtools/debug/index.html +0 -1
- package/dist/devtools/docs/index.html +0 -1
- package/dist/devtools/index.html +0 -1
- package/dist/devtools/templates/index.html +0 -1
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
</script>
|
|
3
|
+
|
|
4
|
+
<template>
|
|
5
|
+
<div class="slack-card">
|
|
6
|
+
<div class="slack-bar" />
|
|
7
|
+
<div class="slack-content">
|
|
8
|
+
<div class="slack-header">
|
|
9
|
+
<div class="slack-favicon">
|
|
10
|
+
<slot name="favIcon" />
|
|
11
|
+
</div>
|
|
12
|
+
<div class="slack-sitename">
|
|
13
|
+
<slot name="siteName" />
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
16
|
+
<div class="slack-title">
|
|
17
|
+
<slot name="title" />
|
|
18
|
+
</div>
|
|
19
|
+
<div class="slack-description">
|
|
20
|
+
<slot name="description" />
|
|
21
|
+
</div>
|
|
22
|
+
<div class="slack-image">
|
|
23
|
+
<slot />
|
|
24
|
+
<div class="slack-image-overlay" />
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
</template>
|
|
29
|
+
|
|
30
|
+
<style>
|
|
31
|
+
.slack-card {
|
|
32
|
+
display: flex;
|
|
33
|
+
font-family: 'Hubot Sans', Lato, -apple-system, BlinkMacSystemFont, sans-serif;
|
|
34
|
+
font-size: 15px;
|
|
35
|
+
line-height: 1.46;
|
|
36
|
+
-webkit-font-smoothing: antialiased;
|
|
37
|
+
min-height: 200px;
|
|
38
|
+
max-width: 500px;
|
|
39
|
+
margin: 0 auto;
|
|
40
|
+
background: oklch(100% 0 0);
|
|
41
|
+
border-radius: 8px;
|
|
42
|
+
padding: 8px 0;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.dark .slack-card {
|
|
46
|
+
background: #1a1d21;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.slack-bar {
|
|
50
|
+
flex-shrink: 0;
|
|
51
|
+
width: 4px;
|
|
52
|
+
background: #a855f7;
|
|
53
|
+
border-radius: 4px;
|
|
54
|
+
margin: 4px 0;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.slack-content {
|
|
58
|
+
padding: 0 12px;
|
|
59
|
+
flex: 1;
|
|
60
|
+
min-width: 0;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.slack-header {
|
|
64
|
+
display: flex;
|
|
65
|
+
align-items: center;
|
|
66
|
+
gap: 8px;
|
|
67
|
+
margin-bottom: 4px;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.slack-favicon img {
|
|
71
|
+
border-radius: 3px;
|
|
72
|
+
height: 16px;
|
|
73
|
+
width: 16px;
|
|
74
|
+
object-fit: cover;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.slack-sitename {
|
|
78
|
+
font-weight: 700;
|
|
79
|
+
font-size: 14px;
|
|
80
|
+
overflow: hidden;
|
|
81
|
+
text-overflow: ellipsis;
|
|
82
|
+
white-space: nowrap;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.slack-title {
|
|
86
|
+
color: #1264a3;
|
|
87
|
+
font-weight: 600;
|
|
88
|
+
font-size: 15px;
|
|
89
|
+
margin-bottom: 2px;
|
|
90
|
+
cursor: pointer;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.dark .slack-title {
|
|
94
|
+
color: #1d9bd1;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.slack-title:hover {
|
|
98
|
+
text-decoration: underline;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.slack-description {
|
|
102
|
+
color: oklch(55% 0.04 285);
|
|
103
|
+
font-size: 14px;
|
|
104
|
+
line-height: 1.5;
|
|
105
|
+
margin-bottom: 8px;
|
|
106
|
+
display: -webkit-box;
|
|
107
|
+
-webkit-line-clamp: 2;
|
|
108
|
+
-webkit-box-orient: vertical;
|
|
109
|
+
overflow: hidden;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.dark .slack-description {
|
|
113
|
+
color: oklch(70% 0.03 285);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.slack-image {
|
|
117
|
+
border-radius: 6px;
|
|
118
|
+
overflow: hidden;
|
|
119
|
+
max-width: 320px;
|
|
120
|
+
position: relative;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.slack-image img,
|
|
124
|
+
.slack-image > *:first-child:not(.slack-image-overlay) {
|
|
125
|
+
width: 100%;
|
|
126
|
+
height: auto;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.slack-image-overlay {
|
|
130
|
+
position: absolute;
|
|
131
|
+
inset: 0;
|
|
132
|
+
box-shadow: inset 0 0 0 1px oklch(0% 0 0 / 0.05);
|
|
133
|
+
border-radius: 6px;
|
|
134
|
+
pointer-events: none;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.dark .slack-image-overlay {
|
|
138
|
+
box-shadow: inset 0 0 0 1px oklch(100% 0 0 / 0.05);
|
|
139
|
+
}
|
|
140
|
+
</style>
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { OgImageComponent } from '../../lib/og-image/runtime-types'
|
|
3
|
+
import { withQuery } from 'ufo'
|
|
4
|
+
import { computed, ref } from 'vue'
|
|
5
|
+
import { host } from '../../lib/og-image/rpc'
|
|
6
|
+
|
|
7
|
+
const props = defineProps<{
|
|
8
|
+
src: string
|
|
9
|
+
aspectRatio: number
|
|
10
|
+
component: OgImageComponent
|
|
11
|
+
active: boolean
|
|
12
|
+
imageFormat?: string
|
|
13
|
+
width?: string
|
|
14
|
+
height?: string
|
|
15
|
+
}>()
|
|
16
|
+
|
|
17
|
+
const RE_CLOSING_ANGLE = />/g
|
|
18
|
+
|
|
19
|
+
function openComponent() {
|
|
20
|
+
host.value?.openInEditor(props.component.path!)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const isHtml = computed(() => {
|
|
24
|
+
return props.src.includes('.html')
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
const creditName = computed(() => {
|
|
28
|
+
return props.component.credits?.split('<')[0]?.trim()
|
|
29
|
+
})
|
|
30
|
+
const creditSite = computed(() => {
|
|
31
|
+
return props.component.credits?.split('<')[1]?.trim().replace(RE_CLOSING_ANGLE, '')
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
const loadStats = ref<{ timeTaken: string, sizeKb: string }>()
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<template>
|
|
38
|
+
<div class="template-card group">
|
|
39
|
+
<div class="template-header">
|
|
40
|
+
<ULink :to="creditSite" target="_blank" class="template-name">
|
|
41
|
+
{{ component.pascalName }}
|
|
42
|
+
</ULink>
|
|
43
|
+
</div>
|
|
44
|
+
<div class="template-preview" :class="active ? 'is-active' : ''">
|
|
45
|
+
<UTooltip :text="`Preview ${component.pascalName} for the current page.`">
|
|
46
|
+
<div class="template-image" :style="{ aspectRatio }">
|
|
47
|
+
<UIcon v-if="active" name="carbon:checkmark-filled" class="active-badge" />
|
|
48
|
+
<ImageLoader
|
|
49
|
+
v-if="!isHtml"
|
|
50
|
+
:src="withQuery(src, { component: component.pascalName })"
|
|
51
|
+
:aspect-ratio="aspectRatio"
|
|
52
|
+
class="w-full h-full"
|
|
53
|
+
@load="(e: { timeTaken: string, sizeKb: string }) => loadStats = e"
|
|
54
|
+
/>
|
|
55
|
+
<IFrameLoader
|
|
56
|
+
v-else
|
|
57
|
+
:src="src"
|
|
58
|
+
class="pointer-events-none"
|
|
59
|
+
:aspect-ratio="aspectRatio"
|
|
60
|
+
@load="(e: { timeTaken: string, sizeKb: string }) => loadStats = e"
|
|
61
|
+
/>
|
|
62
|
+
</div>
|
|
63
|
+
</UTooltip>
|
|
64
|
+
</div>
|
|
65
|
+
<div class="template-footer">
|
|
66
|
+
<UTooltip :text="`Open the source code of ${component.pascalName}.vue in your IDE`">
|
|
67
|
+
<ULink class="template-action" @click.stop="openComponent">
|
|
68
|
+
<UIcon name="carbon:code" class="w-3 h-3" />
|
|
69
|
+
View source
|
|
70
|
+
</ULink>
|
|
71
|
+
</UTooltip>
|
|
72
|
+
<div v-if="component.credits" class="template-credit">
|
|
73
|
+
<ULink v-if="creditSite" :to="creditSite" target="_blank">
|
|
74
|
+
{{ creditName }}
|
|
75
|
+
</ULink>
|
|
76
|
+
</div>
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
</template>
|
|
80
|
+
|
|
81
|
+
<style scoped>
|
|
82
|
+
.template-card {
|
|
83
|
+
display: flex;
|
|
84
|
+
flex-direction: column;
|
|
85
|
+
gap: 6px;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.template-header {
|
|
89
|
+
padding: 0 8px;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.template-name {
|
|
93
|
+
font-size: 13px;
|
|
94
|
+
font-weight: 500;
|
|
95
|
+
color: oklch(55% 0.04 285);
|
|
96
|
+
transition: color 0.15s ease;
|
|
97
|
+
text-decoration: none;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.group:hover .template-name {
|
|
101
|
+
color: oklch(35% 0.04 285);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.dark .template-name {
|
|
105
|
+
color: oklch(70% 0.03 285);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.dark .group:hover .template-name {
|
|
109
|
+
color: oklch(90% 0.02 285);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.template-preview {
|
|
113
|
+
border-radius: 10px;
|
|
114
|
+
overflow: hidden;
|
|
115
|
+
border: 2px solid transparent;
|
|
116
|
+
transition: border-color 0.2s ease, box-shadow 0.2s ease;
|
|
117
|
+
background: oklch(98% 0.005 285);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.dark .template-preview {
|
|
121
|
+
background: oklch(18% 0.04 285);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.template-preview:hover {
|
|
125
|
+
border-color: var(--seo-green);
|
|
126
|
+
box-shadow: 0 4px 16px oklch(0% 0 0 / 0.08);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.template-preview.is-active {
|
|
130
|
+
border-color: var(--seo-green);
|
|
131
|
+
box-shadow: 0 0 0 3px oklch(75% 0.15 145 / 0.2);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.template-image {
|
|
135
|
+
position: relative;
|
|
136
|
+
height: 150px;
|
|
137
|
+
overflow: hidden;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.active-badge {
|
|
141
|
+
position: absolute;
|
|
142
|
+
top: 8px;
|
|
143
|
+
right: 8px;
|
|
144
|
+
color: var(--seo-green);
|
|
145
|
+
z-index: 1;
|
|
146
|
+
filter: drop-shadow(0 1px 2px oklch(0% 0 0 / 0.2));
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.template-footer {
|
|
150
|
+
display: flex;
|
|
151
|
+
justify-content: space-between;
|
|
152
|
+
align-items: center;
|
|
153
|
+
padding: 0 8px;
|
|
154
|
+
font-size: 11px;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.template-action {
|
|
158
|
+
display: flex;
|
|
159
|
+
align-items: center;
|
|
160
|
+
gap: 4px;
|
|
161
|
+
color: oklch(55% 0.04 285);
|
|
162
|
+
transition: color 0.15s ease;
|
|
163
|
+
cursor: pointer;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.template-action:hover {
|
|
167
|
+
color: var(--seo-green);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.dark .template-action {
|
|
171
|
+
color: oklch(60% 0.03 285);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.template-credit {
|
|
175
|
+
color: oklch(60% 0.04 285);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.template-credit a {
|
|
179
|
+
color: inherit;
|
|
180
|
+
text-decoration: none;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.template-credit a:hover {
|
|
184
|
+
text-decoration: underline;
|
|
185
|
+
}
|
|
186
|
+
</style>
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, onMounted, ref } from 'vue'
|
|
3
|
+
|
|
4
|
+
const props = defineProps<{
|
|
5
|
+
aspectRatio: number
|
|
6
|
+
title?: string
|
|
7
|
+
cardType?: 'summary' | 'summary_large_image'
|
|
8
|
+
}>()
|
|
9
|
+
|
|
10
|
+
const currTime = ref('')
|
|
11
|
+
|
|
12
|
+
onMounted(() => {
|
|
13
|
+
const date = new Date()
|
|
14
|
+
const options: Intl.DateTimeFormatOptions = {
|
|
15
|
+
hour: 'numeric',
|
|
16
|
+
minute: 'numeric',
|
|
17
|
+
hour12: true,
|
|
18
|
+
month: 'short',
|
|
19
|
+
day: '2-digit',
|
|
20
|
+
year: 'numeric',
|
|
21
|
+
}
|
|
22
|
+
const formatter = new Intl.DateTimeFormat('en-US', options)
|
|
23
|
+
const parts = formatter.formatToParts(date)
|
|
24
|
+
currTime.value = `${parts.find(part => part.type === 'hour')?.value}:${
|
|
25
|
+
parts.find(part => part.type === 'minute')?.value} ${
|
|
26
|
+
parts.find(part => part.type === 'dayPeriod')?.value} · ${
|
|
27
|
+
parts.find(part => part.type === 'month')?.value} ${
|
|
28
|
+
parts.find(part => part.type === 'day')?.value}, ${
|
|
29
|
+
parts.find(part => part.type === 'year')?.value}`
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
// Auto-detect if should show summary (square) card based on aspect ratio
|
|
33
|
+
// Use summary card for square-ish images (aspect ratio close to 1)
|
|
34
|
+
const isSmallCard = computed(() => {
|
|
35
|
+
if (props.cardType)
|
|
36
|
+
return props.cardType === 'summary'
|
|
37
|
+
// Auto-detect: aspect ratio < 1.3 is considered square-ish
|
|
38
|
+
return props.aspectRatio < 1.3
|
|
39
|
+
})
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<template>
|
|
43
|
+
<div class="twitter-card">
|
|
44
|
+
<div class="twitter-card-inner">
|
|
45
|
+
<div
|
|
46
|
+
class="card-container"
|
|
47
|
+
:class="isSmallCard ? 'flex' : ''"
|
|
48
|
+
>
|
|
49
|
+
<div
|
|
50
|
+
class="card-image"
|
|
51
|
+
:class="isSmallCard ? 'w-32 h-32 shrink-0' : 'aspect-[2/1] w-full'"
|
|
52
|
+
:style="isSmallCard ? {} : { aspectRatio }"
|
|
53
|
+
>
|
|
54
|
+
<slot />
|
|
55
|
+
<div class="card-image-overlay" />
|
|
56
|
+
</div>
|
|
57
|
+
<div class="card-content" :class="isSmallCard ? 'flex-1 min-w-0' : ''">
|
|
58
|
+
<p class="card-domain">
|
|
59
|
+
<slot name="domain" />
|
|
60
|
+
</p>
|
|
61
|
+
<p class="card-title">
|
|
62
|
+
<slot name="title">
|
|
63
|
+
{{ title }}
|
|
64
|
+
</slot>
|
|
65
|
+
</p>
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
<p class="card-time">
|
|
69
|
+
{{ currTime }}
|
|
70
|
+
</p>
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
73
|
+
</template>
|
|
74
|
+
|
|
75
|
+
<style>
|
|
76
|
+
.twitter-card {
|
|
77
|
+
font-family: 'Hubot Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
|
78
|
+
max-height: 100%;
|
|
79
|
+
position: relative;
|
|
80
|
+
display: flex;
|
|
81
|
+
flex-direction: column;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.twitter-card-inner {
|
|
85
|
+
width: 100%;
|
|
86
|
+
max-width: 600px;
|
|
87
|
+
margin: 0 auto;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.twitter-card .card-container {
|
|
91
|
+
border-radius: 16px;
|
|
92
|
+
overflow: hidden;
|
|
93
|
+
border: 1px solid oklch(92% 0.01 285);
|
|
94
|
+
background: oklch(100% 0 0);
|
|
95
|
+
box-shadow: 0 4px 24px oklch(0% 0 0 / 0.06);
|
|
96
|
+
transition: border-color 0.2s ease, box-shadow 0.2s ease;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.dark .twitter-card .card-container {
|
|
100
|
+
border-color: oklch(28% 0.04 285);
|
|
101
|
+
background: oklch(18% 0.04 285);
|
|
102
|
+
box-shadow: 0 4px 24px oklch(0% 0 0 / 0.2);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.twitter-card .card-container:hover {
|
|
106
|
+
border-color: oklch(85% 0.02 285);
|
|
107
|
+
box-shadow: 0 6px 32px oklch(0% 0 0 / 0.1);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.dark .twitter-card .card-container:hover {
|
|
111
|
+
border-color: oklch(35% 0.04 285);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.twitter-card .card-image {
|
|
115
|
+
position: relative;
|
|
116
|
+
overflow: hidden;
|
|
117
|
+
background: oklch(96% 0.01 285);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.dark .twitter-card .card-image {
|
|
121
|
+
background: oklch(22% 0.04 285);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.twitter-card .card-image img,
|
|
125
|
+
.twitter-card .card-image > *:first-child:not(.card-image-overlay) {
|
|
126
|
+
width: 100%;
|
|
127
|
+
height: 100%;
|
|
128
|
+
object-fit: cover;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.twitter-card .card-image-overlay {
|
|
132
|
+
position: absolute;
|
|
133
|
+
inset: 0;
|
|
134
|
+
box-shadow: inset 0 0 0 1px oklch(0% 0 0 / 0.05);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.dark .twitter-card .card-image-overlay {
|
|
138
|
+
box-shadow: inset 0 0 0 1px oklch(100% 0 0 / 0.05);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.twitter-card .card-content {
|
|
142
|
+
padding: 12px 14px;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.twitter-card .card-domain {
|
|
146
|
+
font-size: 13px;
|
|
147
|
+
color: oklch(55% 0.04 285);
|
|
148
|
+
margin: 0;
|
|
149
|
+
white-space: nowrap;
|
|
150
|
+
overflow: hidden;
|
|
151
|
+
text-overflow: ellipsis;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.twitter-card .card-title {
|
|
155
|
+
font-size: 15px;
|
|
156
|
+
font-weight: 500;
|
|
157
|
+
margin: 2px 0 0;
|
|
158
|
+
line-height: 1.3;
|
|
159
|
+
display: -webkit-box;
|
|
160
|
+
-webkit-line-clamp: 2;
|
|
161
|
+
-webkit-box-orient: vertical;
|
|
162
|
+
overflow: hidden;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.twitter-card .card-time {
|
|
166
|
+
margin-top: 12px;
|
|
167
|
+
font-size: 14px;
|
|
168
|
+
color: oklch(55% 0.04 285);
|
|
169
|
+
}
|
|
170
|
+
</style>
|