@furystack/shades-common-components 12.2.0 → 12.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.
Files changed (92) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/esm/components/index.d.ts +1 -0
  3. package/esm/components/index.d.ts.map +1 -1
  4. package/esm/components/index.js +1 -0
  5. package/esm/components/index.js.map +1 -1
  6. package/esm/components/markdown/index.d.ts +5 -0
  7. package/esm/components/markdown/index.d.ts.map +1 -0
  8. package/esm/components/markdown/index.js +5 -0
  9. package/esm/components/markdown/index.js.map +1 -0
  10. package/esm/components/markdown/markdown-display.d.ts +19 -0
  11. package/esm/components/markdown/markdown-display.d.ts.map +1 -0
  12. package/esm/components/markdown/markdown-display.js +149 -0
  13. package/esm/components/markdown/markdown-display.js.map +1 -0
  14. package/esm/components/markdown/markdown-display.spec.d.ts +2 -0
  15. package/esm/components/markdown/markdown-display.spec.d.ts.map +1 -0
  16. package/esm/components/markdown/markdown-display.spec.js +191 -0
  17. package/esm/components/markdown/markdown-display.spec.js.map +1 -0
  18. package/esm/components/markdown/markdown-editor.d.ts +25 -0
  19. package/esm/components/markdown/markdown-editor.d.ts.map +1 -0
  20. package/esm/components/markdown/markdown-editor.js +113 -0
  21. package/esm/components/markdown/markdown-editor.js.map +1 -0
  22. package/esm/components/markdown/markdown-editor.spec.d.ts +2 -0
  23. package/esm/components/markdown/markdown-editor.spec.d.ts.map +1 -0
  24. package/esm/components/markdown/markdown-editor.spec.js +111 -0
  25. package/esm/components/markdown/markdown-editor.spec.js.map +1 -0
  26. package/esm/components/markdown/markdown-input.d.ts +29 -0
  27. package/esm/components/markdown/markdown-input.d.ts.map +1 -0
  28. package/esm/components/markdown/markdown-input.js +100 -0
  29. package/esm/components/markdown/markdown-input.js.map +1 -0
  30. package/esm/components/markdown/markdown-input.spec.d.ts +2 -0
  31. package/esm/components/markdown/markdown-input.spec.d.ts.map +1 -0
  32. package/esm/components/markdown/markdown-input.spec.js +215 -0
  33. package/esm/components/markdown/markdown-input.spec.js.map +1 -0
  34. package/esm/components/markdown/markdown-parser.d.ts +82 -0
  35. package/esm/components/markdown/markdown-parser.d.ts.map +1 -0
  36. package/esm/components/markdown/markdown-parser.js +274 -0
  37. package/esm/components/markdown/markdown-parser.js.map +1 -0
  38. package/esm/components/markdown/markdown-parser.spec.d.ts +2 -0
  39. package/esm/components/markdown/markdown-parser.spec.d.ts.map +1 -0
  40. package/esm/components/markdown/markdown-parser.spec.js +229 -0
  41. package/esm/components/markdown/markdown-parser.spec.js.map +1 -0
  42. package/esm/components/styles.d.ts +1 -0
  43. package/esm/components/styles.d.ts.map +1 -1
  44. package/esm/components/styles.js.map +1 -1
  45. package/esm/components/typography.d.ts.map +1 -1
  46. package/esm/components/typography.js +26 -14
  47. package/esm/components/typography.js.map +1 -1
  48. package/esm/services/css-variable-theme.d.ts +3 -0
  49. package/esm/services/css-variable-theme.d.ts.map +1 -1
  50. package/esm/services/css-variable-theme.js +3 -0
  51. package/esm/services/css-variable-theme.js.map +1 -1
  52. package/esm/services/css-variable-theme.spec.js +3 -0
  53. package/esm/services/css-variable-theme.spec.js.map +1 -1
  54. package/esm/services/default-dark-palette.d.ts +8 -0
  55. package/esm/services/default-dark-palette.d.ts.map +1 -0
  56. package/esm/services/default-dark-palette.js +56 -0
  57. package/esm/services/default-dark-palette.js.map +1 -0
  58. package/esm/services/default-dark-theme.d.ts +3 -0
  59. package/esm/services/default-dark-theme.d.ts.map +1 -1
  60. package/esm/services/default-dark-theme.js +7 -4
  61. package/esm/services/default-dark-theme.js.map +1 -1
  62. package/esm/services/default-light-theme.d.ts +3 -0
  63. package/esm/services/default-light-theme.d.ts.map +1 -1
  64. package/esm/services/default-light-theme.js +3 -0
  65. package/esm/services/default-light-theme.js.map +1 -1
  66. package/esm/services/index.d.ts +1 -0
  67. package/esm/services/index.d.ts.map +1 -1
  68. package/esm/services/index.js +1 -0
  69. package/esm/services/index.js.map +1 -1
  70. package/esm/services/theme-provider-service.d.ts +10 -1
  71. package/esm/services/theme-provider-service.d.ts.map +1 -1
  72. package/esm/services/theme-provider-service.js.map +1 -1
  73. package/package.json +1 -1
  74. package/src/components/index.ts +1 -0
  75. package/src/components/markdown/index.ts +4 -0
  76. package/src/components/markdown/markdown-display.spec.tsx +243 -0
  77. package/src/components/markdown/markdown-display.tsx +202 -0
  78. package/src/components/markdown/markdown-editor.spec.tsx +142 -0
  79. package/src/components/markdown/markdown-editor.tsx +167 -0
  80. package/src/components/markdown/markdown-input.spec.tsx +274 -0
  81. package/src/components/markdown/markdown-input.tsx +143 -0
  82. package/src/components/markdown/markdown-parser.spec.ts +258 -0
  83. package/src/components/markdown/markdown-parser.ts +333 -0
  84. package/src/components/styles.tsx +1 -0
  85. package/src/components/typography.tsx +28 -15
  86. package/src/services/css-variable-theme.spec.ts +3 -0
  87. package/src/services/css-variable-theme.ts +3 -0
  88. package/src/services/default-dark-palette.ts +57 -0
  89. package/src/services/default-dark-theme.ts +7 -4
  90. package/src/services/default-light-theme.ts +3 -0
  91. package/src/services/index.ts +1 -0
  92. package/src/services/theme-provider-service.ts +7 -1
@@ -3,8 +3,8 @@ import { Shade, createComponent } from '@furystack/shades'
3
3
  import { buildTransition, cssVariableTheme } from '../services/css-variable-theme.js'
4
4
  import { paletteMainColors } from '../services/palette-css-vars.js'
5
5
  import type { Palette } from '../services/theme-provider-service.js'
6
- import { Icon } from './icons/icon.js'
7
6
  import { clipboard } from './icons/icon-definitions.js'
7
+ import { Icon } from './icons/icon.js'
8
8
 
9
9
  /**
10
10
  * Typography variant determines semantic HTML tag and default styles.
@@ -50,74 +50,85 @@ type VariantDef = {
50
50
  lineHeight: string
51
51
  letterSpacing: string
52
52
  textTransform?: string
53
- scale?: string
53
+ marginTop?: string
54
+ marginBottom?: string
54
55
  }
55
56
 
56
57
  const variantDefs: Record<TypographyVariant, VariantDef> = {
57
58
  h1: {
58
- fontSize: cssVariableTheme.typography.fontSize.xl,
59
+ fontSize: cssVariableTheme.typography.fontSize.xxxxl,
59
60
  fontWeight: cssVariableTheme.typography.fontWeight.bold,
60
61
  lineHeight: cssVariableTheme.typography.lineHeight.tight,
61
62
  letterSpacing: cssVariableTheme.typography.letterSpacing.tight,
62
- scale: '2',
63
+ marginBottom: '0.3em',
63
64
  },
64
65
  h2: {
65
- fontSize: cssVariableTheme.typography.fontSize.xl,
66
+ fontSize: cssVariableTheme.typography.fontSize.xxxl,
66
67
  fontWeight: cssVariableTheme.typography.fontWeight.bold,
67
68
  lineHeight: cssVariableTheme.typography.lineHeight.tight,
68
69
  letterSpacing: cssVariableTheme.typography.letterSpacing.dense,
69
- scale: '1.6',
70
+ marginTop: '1.5em',
71
+ marginBottom: '0.3em',
70
72
  },
71
73
  h3: {
72
- fontSize: cssVariableTheme.typography.fontSize.xl,
74
+ fontSize: cssVariableTheme.typography.fontSize.xxl,
73
75
  fontWeight: cssVariableTheme.typography.fontWeight.semibold,
74
76
  lineHeight: cssVariableTheme.typography.lineHeight.tight,
75
77
  letterSpacing: cssVariableTheme.typography.letterSpacing.normal,
76
- scale: '1.3',
78
+ marginTop: '1.25em',
79
+ marginBottom: '0.25em',
77
80
  },
78
81
  h4: {
79
- fontSize: cssVariableTheme.typography.fontSize.lg,
82
+ fontSize: cssVariableTheme.typography.fontSize.xl,
80
83
  fontWeight: cssVariableTheme.typography.fontWeight.semibold,
81
84
  lineHeight: cssVariableTheme.typography.lineHeight.tight,
82
85
  letterSpacing: cssVariableTheme.typography.letterSpacing.wide,
83
- scale: '1.15',
86
+ marginTop: '1em',
87
+ marginBottom: '0.25em',
84
88
  },
85
89
  h5: {
86
90
  fontSize: cssVariableTheme.typography.fontSize.lg,
87
91
  fontWeight: cssVariableTheme.typography.fontWeight.medium,
88
92
  lineHeight: cssVariableTheme.typography.lineHeight.normal,
89
93
  letterSpacing: cssVariableTheme.typography.letterSpacing.normal,
94
+ marginTop: '0.75em',
95
+ marginBottom: '0.35em',
90
96
  },
91
97
  h6: {
92
98
  fontSize: cssVariableTheme.typography.fontSize.md,
93
99
  fontWeight: cssVariableTheme.typography.fontWeight.medium,
94
100
  lineHeight: cssVariableTheme.typography.lineHeight.normal,
95
101
  letterSpacing: cssVariableTheme.typography.letterSpacing.wide,
96
- scale: '1.1',
102
+ marginTop: '0.5em',
103
+ marginBottom: '0.2em',
97
104
  },
98
105
  subtitle1: {
99
106
  fontSize: cssVariableTheme.typography.fontSize.md,
100
107
  fontWeight: cssVariableTheme.typography.fontWeight.medium,
101
108
  lineHeight: cssVariableTheme.typography.lineHeight.normal,
102
109
  letterSpacing: cssVariableTheme.typography.letterSpacing.wide,
110
+ marginBottom: '0.35em',
103
111
  },
104
112
  subtitle2: {
105
113
  fontSize: cssVariableTheme.typography.fontSize.sm,
106
114
  fontWeight: cssVariableTheme.typography.fontWeight.medium,
107
115
  lineHeight: cssVariableTheme.typography.lineHeight.normal,
108
116
  letterSpacing: '0.1px',
117
+ marginBottom: '0.25em',
109
118
  },
110
119
  body1: {
111
120
  fontSize: cssVariableTheme.typography.fontSize.md,
112
121
  fontWeight: cssVariableTheme.typography.fontWeight.normal,
113
122
  lineHeight: cssVariableTheme.typography.lineHeight.relaxed,
114
123
  letterSpacing: cssVariableTheme.typography.letterSpacing.wide,
124
+ marginBottom: '0.75em',
115
125
  },
116
126
  body2: {
117
127
  fontSize: cssVariableTheme.typography.fontSize.sm,
118
128
  fontWeight: cssVariableTheme.typography.fontWeight.normal,
119
129
  lineHeight: cssVariableTheme.typography.lineHeight.relaxed,
120
130
  letterSpacing: cssVariableTheme.typography.letterSpacing.wide,
131
+ marginBottom: '0.5em',
121
132
  },
122
133
  caption: {
123
134
  fontSize: cssVariableTheme.typography.fontSize.xs,
@@ -131,6 +142,7 @@ const variantDefs: Record<TypographyVariant, VariantDef> = {
131
142
  lineHeight: cssVariableTheme.typography.lineHeight.normal,
132
143
  letterSpacing: cssVariableTheme.typography.letterSpacing.widest,
133
144
  textTransform: 'uppercase',
145
+ marginBottom: '0.5em',
134
146
  },
135
147
  }
136
148
 
@@ -146,10 +158,11 @@ const buildVariantCssRules = (): Record<string, Record<string, string>> => {
146
158
  if (def.textTransform) {
147
159
  rule.textTransform = def.textTransform
148
160
  }
149
- if (def.scale && def.scale !== '1') {
150
- rule.transformOrigin = 'left top'
151
- rule.transform = `scale(${def.scale})`
152
- rule.marginBottom = `calc((${def.scale} - 1) * 1em)`
161
+ if (def.marginTop) {
162
+ rule.marginTop = def.marginTop
163
+ }
164
+ if (def.marginBottom) {
165
+ rule.marginBottom = def.marginBottom
153
166
  }
154
167
  rules[`&[data-variant="${variant}"]`] = rule
155
168
  }
@@ -59,6 +59,9 @@ describe('css-variable-theme', () => {
59
59
  expect(cssVariableTheme.typography.fontFamily).toBe('var(--shades-theme-typography-font-family)')
60
60
  expect(cssVariableTheme.typography.fontSize.xs).toBe('var(--shades-theme-typography-font-size-xs)')
61
61
  expect(cssVariableTheme.typography.fontSize.md).toBe('var(--shades-theme-typography-font-size-md)')
62
+ expect(cssVariableTheme.typography.fontSize.xxl).toBe('var(--shades-theme-typography-font-size-xxl)')
63
+ expect(cssVariableTheme.typography.fontSize.xxxl).toBe('var(--shades-theme-typography-font-size-xxxl)')
64
+ expect(cssVariableTheme.typography.fontSize.xxxxl).toBe('var(--shades-theme-typography-font-size-xxxxl)')
62
65
  expect(cssVariableTheme.typography.fontWeight.normal).toBe('var(--shades-theme-typography-font-weight-normal)')
63
66
  expect(cssVariableTheme.typography.fontWeight.bold).toBe('var(--shades-theme-typography-font-weight-bold)')
64
67
  expect(cssVariableTheme.typography.lineHeight.tight).toBe('var(--shades-theme-typography-line-height-tight)')
@@ -102,6 +102,9 @@ export const cssVariableTheme = {
102
102
  md: 'var(--shades-theme-typography-font-size-md)',
103
103
  lg: 'var(--shades-theme-typography-font-size-lg)',
104
104
  xl: 'var(--shades-theme-typography-font-size-xl)',
105
+ xxl: 'var(--shades-theme-typography-font-size-xxl)',
106
+ xxxl: 'var(--shades-theme-typography-font-size-xxxl)',
107
+ xxxxl: 'var(--shades-theme-typography-font-size-xxxxl)',
105
108
  },
106
109
  fontWeight: {
107
110
  normal: 'var(--shades-theme-typography-font-weight-normal)',
@@ -0,0 +1,57 @@
1
+ import type { Palette } from './theme-provider-service.js'
2
+
3
+ /**
4
+ * Color palette optimized for dark backgrounds (#121212).
5
+ * Uses lighter Material Design color variants to ensure
6
+ * WCAG AA contrast (≥4.5:1) against the dark theme background.
7
+ */
8
+ export const defaultDarkPalette: Palette = {
9
+ primary: {
10
+ light: '#9fa8da',
11
+ lightContrast: '#000000',
12
+ main: '#7986cb',
13
+ mainContrast: '#000000',
14
+ dark: '#5c6bc0',
15
+ darkContrast: '#ffffff',
16
+ },
17
+ secondary: {
18
+ light: '#4aedc4',
19
+ lightContrast: '#000000',
20
+ main: '#1de9b6',
21
+ mainContrast: '#000000',
22
+ dark: '#14a37f',
23
+ darkContrast: '#ffffff',
24
+ },
25
+ error: {
26
+ light: '#ef9a9a',
27
+ lightContrast: '#000000',
28
+ main: '#ef5350',
29
+ mainContrast: '#000000',
30
+ dark: '#e53935',
31
+ darkContrast: '#ffffff',
32
+ },
33
+ warning: {
34
+ light: '#ffb74d',
35
+ lightContrast: '#000000',
36
+ main: '#ff9800',
37
+ mainContrast: '#000000',
38
+ dark: '#f57c00',
39
+ darkContrast: '#000000',
40
+ },
41
+ info: {
42
+ light: '#90caf9',
43
+ lightContrast: '#000000',
44
+ main: '#42a5f5',
45
+ mainContrast: '#000000',
46
+ dark: '#1e88e5',
47
+ darkContrast: '#ffffff',
48
+ },
49
+ success: {
50
+ light: '#81c784',
51
+ lightContrast: '#000000',
52
+ main: '#4caf50',
53
+ mainContrast: '#000000',
54
+ dark: '#388e3c',
55
+ darkContrast: '#ffffff',
56
+ },
57
+ }
@@ -1,4 +1,4 @@
1
- import { defaultPalette } from './default-palette.js'
1
+ import { defaultDarkPalette } from './default-dark-palette.js'
2
2
  import type { Theme } from './theme-provider-service.js'
3
3
 
4
4
  export const defaultDarkTheme = {
@@ -16,10 +16,10 @@ export const defaultDarkTheme = {
16
16
  disabledBackground: 'rgba(255, 255, 255, 0.12)',
17
17
  },
18
18
  background: {
19
- default: '#303030',
20
- paper: '#424242',
19
+ default: '#121212',
20
+ paper: '#1e1e1e',
21
21
  },
22
- palette: defaultPalette,
22
+ palette: defaultDarkPalette,
23
23
  divider: 'rgba(255, 255, 255, 0.12)',
24
24
  action: {
25
25
  hoverBackground: 'rgba(255, 255, 255, 0.08)',
@@ -54,6 +54,9 @@ export const defaultDarkTheme = {
54
54
  md: '14px',
55
55
  lg: '16px',
56
56
  xl: '24px',
57
+ xxl: '30px',
58
+ xxxl: '36px',
59
+ xxxxl: '48px',
57
60
  },
58
61
  fontWeight: {
59
62
  normal: '400',
@@ -54,6 +54,9 @@ export const defaultLightTheme = {
54
54
  md: '14px',
55
55
  lg: '16px',
56
56
  xl: '24px',
57
+ xxl: '30px',
58
+ xxxl: '36px',
59
+ xxxxl: '48px',
57
60
  },
58
61
  fontWeight: {
59
62
  normal: '400',
@@ -1,6 +1,7 @@
1
1
  export * from './click-away-service.js'
2
2
  export * from './collection-service.js'
3
3
  export * from './css-variable-theme.js'
4
+ export * from './default-dark-palette.js'
4
5
  export * from './default-dark-theme.js'
5
6
  export * from './default-light-theme.js'
6
7
  export * from './default-palette.js'
@@ -158,8 +158,14 @@ export type FontSizeScale = {
158
158
  md: string
159
159
  /** 16px - large body, icons */
160
160
  lg: string
161
- /** 24px - page headings */
161
+ /** 24px - subheadings, large UI elements */
162
162
  xl: string
163
+ /** 30px - small headings (h3) */
164
+ xxl: string
165
+ /** 36px - medium headings (h2) */
166
+ xxxl: string
167
+ /** 48px - large headings (h1) */
168
+ xxxxl: string
163
169
  }
164
170
 
165
171
  /**