@duffcloudservices/cms 0.1.7 → 0.3.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/package.json CHANGED
@@ -1,77 +1,82 @@
1
- {
2
- "name": "@duffcloudservices/cms",
3
- "version": "0.1.7",
4
- "description": "Vue 3 composables and Vite plugins for DCS CMS integration",
5
- "type": "module",
6
- "exports": {
7
- ".": {
8
- "types": "./dist/index.d.ts",
9
- "import": "./dist/index.js"
10
- },
11
- "./plugins": {
12
- "types": "./dist/plugins/index.d.ts",
13
- "import": "./dist/plugins/index.js"
14
- },
15
- "./editor": {
16
- "types": "./dist/editor/editorBridge.d.ts",
17
- "import": "./dist/editor/editorBridge.js"
18
- },
19
- "./components": {
20
- "import": "./src/components/PreviewRibbon.vue"
21
- }
22
- },
23
- "main": "./dist/index.js",
24
- "types": "./dist/index.d.ts",
25
- "files": [
26
- "dist",
27
- "src/components"
28
- ],
29
- "scripts": {
30
- "build": "tsup",
31
- "dev": "tsup --watch",
32
- "test": "vitest run",
33
- "test:watch": "vitest",
34
- "type-check": "tsc --noEmit",
35
- "lint": "eslint src --ext .ts",
36
- "prepublishOnly": "pnpm run build"
37
- },
38
- "peerDependencies": {
39
- "vue": "^3.4.0",
40
- "@unhead/vue": "^1.9.0"
41
- },
42
- "dependencies": {
43
- "js-yaml": "^4.1.0"
44
- },
45
- "devDependencies": {
46
- "@types/js-yaml": "^4.0.9",
47
- "@types/node": "^20.11.0",
48
- "@vue/test-utils": "^2.4.0",
49
- "tsup": "^8.0.0",
50
- "typescript": "~5.6.3",
51
- "vite": "^6.3.5",
52
- "vitest": "^3.2.3",
53
- "vue": "^3.5.16",
54
- "@unhead/vue": "^2.0.5"
55
- },
56
- "keywords": [
57
- "vue",
58
- "vitepress",
59
- "cms",
60
- "dcs",
61
- "composables",
62
- "duff-cloud-services"
63
- ],
64
- "author": "Duff Cloud Services",
65
- "license": "MIT",
66
- "repository": {
67
- "type": "git",
68
- "url": "https://github.com/duffn/dcs"
69
- },
70
- "homepage": "https://portal.duffcloudservices.com",
71
- "bugs": {
72
- "url": "https://github.com/duffn/dcs/issues"
73
- },
74
- "engines": {
75
- "node": ">=18.0.0"
76
- }
77
- }
1
+ {
2
+ "name": "@duffcloudservices/cms",
3
+ "version": "0.3.0",
4
+ "description": "Vue 3 composables and Vite plugins for DCS CMS integration",
5
+ "type": "module",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./dist/index.d.ts",
9
+ "import": "./dist/index.js"
10
+ },
11
+ "./plugins": {
12
+ "types": "./dist/plugins/index.d.ts",
13
+ "import": "./dist/plugins/index.js"
14
+ },
15
+ "./editor": {
16
+ "types": "./dist/editor/editorBridge.d.ts",
17
+ "import": "./dist/editor/editorBridge.js"
18
+ },
19
+ "./components": {
20
+ "import": "./src/components/PreviewRibbon.vue"
21
+ },
22
+ "./responsive-image": {
23
+ "import": "./src/components/ResponsiveImage.vue"
24
+ }
25
+ },
26
+ "main": "./dist/index.js",
27
+ "types": "./dist/index.d.ts",
28
+ "files": [
29
+ "dist",
30
+ "src/components"
31
+ ],
32
+ "peerDependencies": {
33
+ "vue": "^3.4.0",
34
+ "@unhead/vue": "^1.9.0"
35
+ },
36
+ "dependencies": {
37
+ "js-yaml": "^4.1.0",
38
+ "@duffcloudservices/cms-core": "0.4.0"
39
+ },
40
+ "devDependencies": {
41
+ "@types/js-yaml": "^4.0.9",
42
+ "@types/markdown-it": "^14.1.0",
43
+ "@types/node": "^20.11.0",
44
+ "@vue/test-utils": "^2.4.0",
45
+ "markdown-it": "^14.0.0",
46
+ "tsup": "^8.0.0",
47
+ "typescript": "~5.6.3",
48
+ "vite": "^6.3.5",
49
+ "vitest": "^3.2.3",
50
+ "vue": "^3.5.16",
51
+ "@unhead/vue": "^2.0.5"
52
+ },
53
+ "keywords": [
54
+ "vue",
55
+ "vitepress",
56
+ "cms",
57
+ "dcs",
58
+ "composables",
59
+ "duff-cloud-services"
60
+ ],
61
+ "author": "Duff Cloud Services",
62
+ "license": "MIT",
63
+ "repository": {
64
+ "type": "git",
65
+ "url": "https://github.com/duffn/dcs"
66
+ },
67
+ "homepage": "https://portal.duffcloudservices.com",
68
+ "bugs": {
69
+ "url": "https://github.com/duffn/dcs/issues"
70
+ },
71
+ "engines": {
72
+ "node": ">=18.0.0"
73
+ },
74
+ "scripts": {
75
+ "build": "tsup",
76
+ "dev": "tsup --watch",
77
+ "test": "vitest run",
78
+ "test:watch": "vitest",
79
+ "type-check": "tsc --noEmit",
80
+ "lint": "eslint src --ext .ts"
81
+ }
82
+ }
@@ -132,6 +132,13 @@ const STI = 4
132
132
  /** The preview domain where the ribbon should be displayed */
133
133
  const PREVIEW_DOMAIN = 'preview.duffcloudservices.com'
134
134
 
135
+ /**
136
+ * Query string parameter that suppresses the preview ribbon.
137
+ * Used by GitHub Actions snapshot capture so screenshots don't include the ribbon overlay.
138
+ * Example: https://preview.duffcloudservices.com/kept/?dcs-hide-ribbon
139
+ */
140
+ const HIDE_RIBBON_PARAM = 'dcs-hide-ribbon'
141
+
135
142
  /** localStorage key for persisting which corner the ribbon is docked to */
136
143
  const STORAGE_KEY = 'dcs-preview-ribbon-side'
137
144
 
@@ -156,6 +163,10 @@ function shouldShow(): boolean {
156
163
  return false
157
164
  }
158
165
 
166
+ // Allow suppression via query parameter (for automated screenshot capture)
167
+ const params = new URLSearchParams(globalThis.location.search)
168
+ if (params.has(HIDE_RIBBON_PARAM)) return false
169
+
159
170
  return true
160
171
  }
161
172
 
@@ -0,0 +1,55 @@
1
+ <script setup lang="ts">
2
+ /**
3
+ * Convenience component that renders a responsive `<picture>` element for
4
+ * DCS CDN-hosted images. For non-CDN images it falls back to a plain `<img>`.
5
+ *
6
+ * @example
7
+ * ```vue
8
+ * <ResponsiveImage
9
+ * src="https://files.duffcloudservices.com/kept/assets/hero/abc-123.jpg"
10
+ * alt="Hero banner"
11
+ * context="hero"
12
+ * class="w-full h-full object-cover"
13
+ * />
14
+ * ```
15
+ */
16
+ import { useResponsiveImage } from '../composables/useResponsiveImage'
17
+ import type { ImageContext } from '@duffcloudservices/cms-core'
18
+
19
+ const props = defineProps<{
20
+ /** Image source URL (original CDN URL or local path). */
21
+ src: string
22
+ /** Alt text for accessibility. */
23
+ alt: string
24
+ /** Sizing context — determines which variants to include. */
25
+ context?: ImageContext
26
+ /** CSS class(es) applied to the `<img>` element. */
27
+ class?: string
28
+ /** Optional `sizes` attribute override. */
29
+ sizes?: string
30
+ /** Skip responsive variants and use the original URL only. */
31
+ original?: boolean
32
+ }>()
33
+
34
+ const image = useResponsiveImage({
35
+ src: () => props.src,
36
+ alt: () => props.alt,
37
+ context: () => props.context ?? 'content',
38
+ sizes: () => props.sizes,
39
+ original: () => props.original,
40
+ })
41
+ </script>
42
+
43
+ <template>
44
+ <picture v-if="image.hasVariants && !original">
45
+ <source
46
+ v-for="source in image.sources"
47
+ :key="source.type"
48
+ :srcset="source.srcset"
49
+ :type="source.type"
50
+ :sizes="source.sizes"
51
+ />
52
+ <img v-bind="image.imgProps" :class="props.class" />
53
+ </picture>
54
+ <img v-else v-bind="image.imgProps" :class="props.class" />
55
+ </template>