@canopy-iiif/app 0.6.28

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.
@@ -0,0 +1,80 @@
1
+ @use '../variables' as *;
2
+
3
+ .canopy-cmdk {
4
+ .canopy-cmdk__trigger {
5
+ display: inline-flex;
6
+ align-items: center;
7
+ gap: 0.25rem;
8
+ padding: 0.25rem 0.5rem;
9
+ border: 1px solid #e5e7eb;
10
+ color: #374151;
11
+ background: #fff;
12
+ border-radius: 6px;
13
+ cursor: pointer;
14
+ }
15
+
16
+ .canopy-cmdk__overlay {
17
+ position: fixed;
18
+ inset: 0;
19
+ display: none;
20
+ align-items: flex-start;
21
+ justify-content: center;
22
+ background: rgba(0, 0, 0, 0.3);
23
+ z-index: 9999;
24
+ padding-top: 10vh;
25
+ }
26
+
27
+ .canopy-cmdk__panel {
28
+ position: relative;
29
+ background: #fff;
30
+ min-width: 320px;
31
+ max-width: 720px;
32
+ width: 90%;
33
+ border-radius: 8px;
34
+ box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
35
+ overflow: hidden;
36
+ font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Helvetica, Arial, sans-serif;
37
+ }
38
+
39
+ .canopy-cmdk__close {
40
+ position: absolute;
41
+ top: 8px;
42
+ right: 8px;
43
+ border: 1px solid #e5e7eb;
44
+ background: #fff;
45
+ border-radius: 6px;
46
+ padding: 2px 6px;
47
+ cursor: pointer;
48
+ }
49
+
50
+ .canopy-cmdk__inputWrap {
51
+ padding: 10px 12px;
52
+ border-bottom: 1px solid #e5e7eb;
53
+ }
54
+ .canopy-cmdk__input {
55
+ width: 100%;
56
+ padding: 8px 10px;
57
+ border: 1px solid #e5e7eb;
58
+ border-radius: 6px;
59
+ outline: none;
60
+ }
61
+
62
+ .canopy-cmdk__list {
63
+ max-height: 50vh;
64
+ overflow: auto;
65
+ padding: 6px 0;
66
+ }
67
+
68
+ .canopy-cmdk__item {
69
+ display: flex;
70
+ align-items: center;
71
+ gap: 8px;
72
+ }
73
+ .canopy-cmdk__thumb {
74
+ width: 40px;
75
+ height: 40px;
76
+ object-fit: cover;
77
+ border-radius: 4px;
78
+ }
79
+ }
80
+
@@ -0,0 +1,5 @@
1
+ // Components bundle. Provide variables to all components, then import each partial.
2
+ @use '../variables' as *;
3
+
4
+ @use './card';
5
+ @use './command';
@@ -0,0 +1,127 @@
1
+ /* Canopy Card component styles */
2
+ .canopy-card {
3
+ display: block;
4
+ text-decoration: none;
5
+ color: inherit;
6
+ border: 1px solid rgb(230, 231, 234); /* slate-200 */
7
+ border-radius: 0.5rem;
8
+ overflow: hidden;
9
+ transition: all 150ms cubic-bezier(0.22, 1, 0.36, 1);
10
+ box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 3px 0 rgba(0, 0, 0, 0.05);
11
+ }
12
+ .canopy-card figure {
13
+ margin: 0;
14
+ }
15
+ .canopy-card .canopy-card-media {
16
+ position: relative;
17
+ width: 100%;
18
+ padding-bottom: var(--canopy-card-padding, 100%);
19
+ background-color: rgb(229, 231, 235); /* slate-200 */
20
+ overflow: hidden;
21
+ }
22
+ .canopy-card .canopy-card-media > img {
23
+ position: absolute;
24
+ inset: 0;
25
+ width: 100%;
26
+ height: 100%;
27
+ object-fit: cover;
28
+ display: block;
29
+ opacity: 0;
30
+ transition: opacity 500ms cubic-bezier(0.22, 1, 0.36, 1);
31
+ }
32
+ .canopy-card[data-image-loaded=true] .canopy-card-media > img {
33
+ opacity: 1;
34
+ }
35
+ .canopy-card .canopy-card-image {
36
+ display: block;
37
+ width: 100%;
38
+ height: auto;
39
+ opacity: 0;
40
+ transition: opacity 500ms cubic-bezier(0.22, 1, 0.36, 1);
41
+ }
42
+ .canopy-card[data-image-loaded=true] .canopy-card-image {
43
+ opacity: 1;
44
+ }
45
+ .canopy-card figcaption {
46
+ padding: 1rem;
47
+ }
48
+ .canopy-card figcaption > span:first-child {
49
+ display: block;
50
+ }
51
+ .canopy-card figcaption > span + span {
52
+ display: block;
53
+ }
54
+ .canopy-card:hover, .canopy-card:focus {
55
+ color: var(--color-brand-default);
56
+ box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.07), 0 1px 2px 0 rgba(0, 0, 0, 0.07);
57
+ }
58
+
59
+ .canopy-cmdk .canopy-cmdk__trigger {
60
+ display: inline-flex;
61
+ align-items: center;
62
+ gap: 0.25rem;
63
+ padding: 0.25rem 0.5rem;
64
+ border: 1px solid #e5e7eb;
65
+ color: #374151;
66
+ background: #fff;
67
+ border-radius: 6px;
68
+ cursor: pointer;
69
+ }
70
+ .canopy-cmdk .canopy-cmdk__overlay {
71
+ position: fixed;
72
+ inset: 0;
73
+ display: none;
74
+ align-items: flex-start;
75
+ justify-content: center;
76
+ background: rgba(0, 0, 0, 0.3);
77
+ z-index: 9999;
78
+ padding-top: 10vh;
79
+ }
80
+ .canopy-cmdk .canopy-cmdk__panel {
81
+ position: relative;
82
+ background: #fff;
83
+ min-width: 320px;
84
+ max-width: 720px;
85
+ width: 90%;
86
+ border-radius: 8px;
87
+ box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
88
+ overflow: hidden;
89
+ font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Helvetica, Arial, sans-serif;
90
+ }
91
+ .canopy-cmdk .canopy-cmdk__close {
92
+ position: absolute;
93
+ top: 8px;
94
+ right: 8px;
95
+ border: 1px solid #e5e7eb;
96
+ background: #fff;
97
+ border-radius: 6px;
98
+ padding: 2px 6px;
99
+ cursor: pointer;
100
+ }
101
+ .canopy-cmdk .canopy-cmdk__inputWrap {
102
+ padding: 10px 12px;
103
+ border-bottom: 1px solid #e5e7eb;
104
+ }
105
+ .canopy-cmdk .canopy-cmdk__input {
106
+ width: 100%;
107
+ padding: 8px 10px;
108
+ border: 1px solid #e5e7eb;
109
+ border-radius: 6px;
110
+ outline: none;
111
+ }
112
+ .canopy-cmdk .canopy-cmdk__list {
113
+ max-height: 50vh;
114
+ overflow: auto;
115
+ padding: 6px 0;
116
+ }
117
+ .canopy-cmdk .canopy-cmdk__item {
118
+ display: flex;
119
+ align-items: center;
120
+ gap: 8px;
121
+ }
122
+ .canopy-cmdk .canopy-cmdk__thumb {
123
+ width: 40px;
124
+ height: 40px;
125
+ object-fit: cover;
126
+ border-radius: 4px;
127
+ }
@@ -0,0 +1,3 @@
1
+ // UI styles entry (optional). Import the components bundle.
2
+ @use './components/index';
3
+
@@ -0,0 +1,72 @@
1
+ @use "./variables" as *;
2
+
3
+ :root {
4
+ --color-brand-50: #{$color-brand-50};
5
+ --color-brand-100: #{$color-brand-100};
6
+ --color-brand-200: #{$color-brand-200};
7
+ --color-brand-300: #{$color-brand-300};
8
+ --color-brand-400: #{$color-brand-400};
9
+ --color-brand-500: #{$color-brand-500};
10
+ --color-brand-600: #{$color-brand-600};
11
+ --color-brand-700: #{$color-brand-700};
12
+ --color-brand-800: #{$color-brand-800};
13
+ --color-brand-900: #{$color-brand-900};
14
+ --color-brand-default: #{$color-brand-default};
15
+
16
+ --color-gray-50: #{$color-gray-50};
17
+ --color-gray-100: #{$color-gray-100};
18
+ --color-gray-200: #{$color-gray-200};
19
+ --color-gray-300: #{$color-gray-300};
20
+ --color-gray-400: #{$color-gray-400};
21
+ --color-gray-500: #{$color-gray-500};
22
+ --color-gray-600: #{$color-gray-600};
23
+ --color-gray-700: #{$color-gray-700};
24
+ --color-gray-800: #{$color-gray-800};
25
+ --color-gray-900: #{$color-gray-900};
26
+ --color-gray-default: #{$color-gray-default};
27
+ --color-gray-muted: #{$color-gray-muted};
28
+
29
+ // Clover IIIF specific color roles
30
+ --colors-accent: #{$color-brand-default} !important;
31
+ --colors-accentAlt: #{$color-brand-800} !important;
32
+ --colors-accentMuted: #{$color-brand-400} !important;
33
+ --colors-primary: #{$color-gray-default} !important;
34
+ --colors-primaryAlt: #{$color-gray-default} !important;
35
+ --colors-primaryMuted: #{$color-gray-default} !important;
36
+ --colors-secondary: #{$color-gray-50} !important;
37
+ --colors-secondaryAlt: #{$color-gray-50} !important;
38
+ --colors-secondaryMuted: #{$color-gray-50} !important;
39
+
40
+ --font-sans: #{$font-sans} !important;
41
+ --font-mono: #{$font-mono} !important;
42
+
43
+ --font-size-xs: #{$font-size-xs} !important;
44
+ --line-height-xs: #{$line-height-xs} !important;
45
+ --font-size-sm: #{$font-size-sm} !important;
46
+ --line-height-sm: #{$line-height-sm} !important;
47
+ --font-size-base: #{$font-size-base} !important;
48
+ --line-height-base: #{$line-height-base} !important;
49
+ --font-size-lg: #{$font-size-lg} !important;
50
+ --line-height-lg: #{$line-height-lg} !important;
51
+ --font-size-xl: #{$font-size-xl} !important;
52
+ --line-height-xl: #{$line-height-xl} !important;
53
+ --font-size-2xl: #{$font-size-2xl} !important;
54
+ --line-height-2xl: #{$line-height-2xl} !important;
55
+ --font-size-3xl: #{$font-size-3xl} !important;
56
+ --line-height-3xl: #{$line-height-3xl} !important;
57
+
58
+ --radius-sm: #{$radius-sm} !important;
59
+ --radius-default: #{$radius-default} !important;
60
+ --radius-md: #{$radius-md} !important;
61
+
62
+ --max-w-content: #{$max-w-content} !important;
63
+ --max-w-wide: #{$max-w-wide} !important;
64
+
65
+ --shadow-sm: #{$shadow-sm} !important;
66
+ --shadow: #{$shadow} !important;
67
+ --shadow-md: #{$shadow-md} !important;
68
+ --shadow-lg: #{$shadow-lg} !important;
69
+
70
+ --duration-fast: #{$duration-fast} !important;
71
+ --easing-standard: #{$easing-standard} !important;
72
+ }
@@ -0,0 +1,66 @@
1
+ // Sass variables (source of truth) and CSS variables (emitted) for Canopy UI.
2
+
3
+ // Brand scale
4
+ $color-brand-50: #fdfdfe !default;
5
+ $color-brand-100: #edf2fe !default;
6
+ $color-brand-200: #d2deff !default;
7
+ $color-brand-300: #abbdf9 !default;
8
+ $color-brand-400: #8da4ef !default;
9
+ $color-brand-500: #3e63dd !default;
10
+ $color-brand-600: #3358d4 !default;
11
+ $color-brand-700: #2c4bbd !default;
12
+ $color-brand-800: #243c94 !default;
13
+ $color-brand-900: #1f2d5c !default;
14
+ $color-brand-default: $color-brand-600 !default;
15
+
16
+ $color-gray-50: #fcfcfd !default;
17
+ $color-gray-100: #f0f0f3 !default;
18
+ $color-gray-200: #e0e1e6 !default;
19
+ $color-gray-300: #cdced6 !default;
20
+ $color-gray-400: #b9bbc6 !default;
21
+ $color-gray-500: #8b8d98 !default;
22
+ $color-gray-600: #80838d !default;
23
+ $color-gray-700: #60646c !default;
24
+ $color-gray-800: #1c2024 !default;
25
+ $color-gray-900: #121418 !default;
26
+ $color-gray-default: $color-gray-900 !default;
27
+ $color-gray-muted: $color-gray-600 !default;
28
+
29
+ // Fonts
30
+ $font-sans: "system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Helvetica, Arial, sans-serif" !default;
31
+ $font-mono: "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace" !default;
32
+
33
+ // Font sizes / line heights
34
+ $font-size-xs: 0.75rem !default;
35
+ $line-height-xs: 1rem !default;
36
+ $font-size-sm: 0.875rem !default;
37
+ $line-height-sm: 1.25rem !default;
38
+ $font-size-base: 1rem !default;
39
+ $line-height-base: 1.5rem !default;
40
+ $font-size-lg: 1.125rem !default;
41
+ $line-height-lg: 1.75rem !default;
42
+ $font-size-xl: 1.25rem !default;
43
+ $line-height-xl: 1.75rem !default;
44
+ $font-size-2xl: 1.5rem !default;
45
+ $line-height-2xl: 2rem !default;
46
+ $font-size-3xl: 1.875rem !default;
47
+ $line-height-3xl: 2.25rem !default;
48
+
49
+ // Radii
50
+ $radius-sm: 0.125rem !default;
51
+ $radius-default: 0.25rem !default;
52
+ $radius-md: 0.375rem !default;
53
+
54
+ // Max widths
55
+ $max-w-content: 1200px !default;
56
+ $max-w-wide: 1440px !default;
57
+
58
+ // Shadows
59
+ $shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05) !default;
60
+ $shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06) !default;
61
+ $shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06) !default;
62
+ $shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05) !default;
63
+
64
+ // Transitions
65
+ $duration-fast: 150ms !default;
66
+ $easing-standard: cubic-bezier(0.2, 0.8, 0.2, 1) !default;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Canopy IIIF Tailwind plugin
3
+ *
4
+ * Provides semantic component styles for Canopy UI elements.
5
+ * Users can disable these defaults by removing this plugin from
6
+ * their Tailwind config.
7
+ */
8
+ const plugin = require("tailwindcss/plugin");
9
+ const fs = require("fs");
10
+ const path = require("path");
11
+
12
+ function compileScss(filePath) {
13
+ try {
14
+ const sass = require("sass");
15
+ const out = sass.compile(filePath, { style: "expanded" });
16
+ return out && out.css ? out.css : "";
17
+ } catch (e) {
18
+ // No CSS fallback; if compilation fails, skip with an empty string.
19
+ try { console.warn("Canopy UI: failed to compile", filePath, e && e.message ? e.message : e); } catch (_) {}
20
+ return "";
21
+ }
22
+ }
23
+
24
+ module.exports = plugin(function ({ addComponents, postcss }) {
25
+ try {
26
+ const entry = path.join(__dirname, 'styles', 'components', 'index.scss');
27
+ const css = compileScss(entry);
28
+ if (css && css.trim()) {
29
+ const root = postcss && postcss.parse ? postcss.parse(css) : null;
30
+ if (root) addComponents(root);
31
+ }
32
+ } catch (_) {
33
+ // no-op on failure
34
+ }
35
+ });
@@ -0,0 +1,105 @@
1
+ /**
2
+ * canopy-iiif-preset
3
+ *
4
+ * A Tailwind preset that sources design tokens (colors, fonts, sizes, etc.)
5
+ * from Sass under packages/ui/styles, injects them as CSS variables, and maps
6
+ * Tailwind theme.extend values to those variables for easy use in utilities.
7
+ */
8
+ const plugin = require("tailwindcss/plugin");
9
+ const fs = require("fs");
10
+ const path = require("path");
11
+
12
+ function compileVarsCss() {
13
+ try {
14
+ const sass = require("sass");
15
+ const entry = path.join(__dirname, "styles", "variables.emit.scss");
16
+ const out = sass.compile(entry, { style: "expanded" });
17
+ return out && out.css ? out.css : "";
18
+ } catch (_) {
19
+ return "";
20
+ }
21
+ }
22
+
23
+ module.exports = {
24
+ theme: {
25
+ container: { center: true, padding: "1rem" },
26
+ extend: {
27
+ colors: {
28
+ brand: {
29
+ DEFAULT: "var(--color-brand-default)",
30
+ 50: "var(--color-brand-50)",
31
+ 100: "var(--color-brand-100)",
32
+ 200: "var(--color-brand-200)",
33
+ 300: "var(--color-brand-300)",
34
+ 400: "var(--color-brand-400)",
35
+ 500: "var(--color-brand-500)",
36
+ 600: "var(--color-brand-600)",
37
+ 700: "var(--color-brand-700)",
38
+ 800: "var(--color-brand-800)",
39
+ 900: "var(--color-brand-900)",
40
+ },
41
+ gray: {
42
+ DEFAULT: "var(--color-gray-default)",
43
+ 50: "var(--color-gray-50)",
44
+ 100: "var(--color-gray-100)",
45
+ 200: "var(--color-gray-200)",
46
+ 300: "var(--color-gray-300)",
47
+ 400: "var(--color-gray-400)",
48
+ 500: "var(--color-gray-500)",
49
+ 600: "var(--color-gray-600)",
50
+ 700: "var(--color-gray-700)",
51
+ 800: "var(--color-gray-800)",
52
+ 900: "var(--color-gray-900)",
53
+ },
54
+ muted: "var(--color-gray-muted)",
55
+ },
56
+ fontFamily: {
57
+ sans: ["var(--font-sans)"],
58
+ mono: ["var(--font-mono)"],
59
+ },
60
+ fontSize: {
61
+ xs: ["var(--font-size-xs)", { lineHeight: "var(--line-height-xs)" }],
62
+ sm: ["var(--font-size-sm)", { lineHeight: "var(--line-height-sm)" }],
63
+ base: [
64
+ "var(--font-size-base)",
65
+ { lineHeight: "var(--line-height-base)" },
66
+ ],
67
+ lg: ["var(--font-size-lg)", { lineHeight: "var(--line-height-lg)" }],
68
+ xl: ["var(--font-size-xl)", { lineHeight: "var(--line-height-xl)" }],
69
+ "2xl": [
70
+ "var(--font-size-2xl)",
71
+ { lineHeight: "var(--line-height-2xl)" },
72
+ ],
73
+ "3xl": [
74
+ "var(--font-size-3xl)",
75
+ { lineHeight: "var(--line-height-3xl)" },
76
+ ],
77
+ },
78
+ borderRadius: {
79
+ sm: "var(--radius-sm)",
80
+ DEFAULT: "var(--radius-default)",
81
+ md: "var(--radius-md)",
82
+ },
83
+ maxWidth: { content: "var(--max-w-content)", wide: "var(--max-w-wide)" },
84
+ boxShadow: {
85
+ sm: "var(--shadow-sm)",
86
+ DEFAULT: "var(--shadow)",
87
+ md: "var(--shadow-md)",
88
+ lg: "var(--shadow-lg)",
89
+ },
90
+ transitionDuration: {
91
+ canopyFast: "var(--duration-fast)",
92
+ },
93
+ transitionTimingFunction: {
94
+ canopy: "var(--easing-standard)",
95
+ },
96
+ },
97
+ },
98
+ plugins: [
99
+ // Inject CSS variables (tokens) derived from Sass variables
100
+ plugin(function ({ addBase, postcss }) {
101
+ const css = compileVarsCss();
102
+ if (css && postcss && postcss.parse) addBase(postcss.parse(css));
103
+ }),
104
+ ],
105
+ };