@salmonui/editors 0.0.0-stage → 0.2.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 (111) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +39 -2
  3. package/dist/image-editor/ImageEditor.d.ts +59 -0
  4. package/dist/image-editor/ImageEditor.d.ts.map +1 -0
  5. package/dist/image-editor/ImageEditor.js +493 -0
  6. package/dist/image-editor/ImageEditor.js.map +1 -0
  7. package/dist/image-editor/adjust.d.ts +17 -0
  8. package/dist/image-editor/adjust.d.ts.map +1 -0
  9. package/dist/image-editor/adjust.js +53 -0
  10. package/dist/image-editor/adjust.js.map +1 -0
  11. package/dist/image-editor/annotations.d.ts +40 -0
  12. package/dist/image-editor/annotations.d.ts.map +1 -0
  13. package/dist/image-editor/annotations.js +184 -0
  14. package/dist/image-editor/annotations.js.map +1 -0
  15. package/dist/image-editor/draw.d.ts +25 -0
  16. package/dist/image-editor/draw.d.ts.map +1 -0
  17. package/dist/image-editor/draw.js +248 -0
  18. package/dist/image-editor/draw.js.map +1 -0
  19. package/dist/image-editor/engine.d.ts +116 -0
  20. package/dist/image-editor/engine.d.ts.map +1 -0
  21. package/dist/image-editor/engine.js +367 -0
  22. package/dist/image-editor/engine.js.map +1 -0
  23. package/dist/image-editor/geometry.d.ts +41 -0
  24. package/dist/image-editor/geometry.d.ts.map +1 -0
  25. package/dist/image-editor/geometry.js +62 -0
  26. package/dist/image-editor/geometry.js.map +1 -0
  27. package/dist/image-editor/history.d.ts +24 -0
  28. package/dist/image-editor/history.d.ts.map +1 -0
  29. package/dist/image-editor/history.js +31 -0
  30. package/dist/image-editor/history.js.map +1 -0
  31. package/dist/image-editor/interact.d.ts +73 -0
  32. package/dist/image-editor/interact.d.ts.map +1 -0
  33. package/dist/image-editor/interact.js +686 -0
  34. package/dist/image-editor/interact.js.map +1 -0
  35. package/dist/image-editor/items.d.ts +9 -0
  36. package/dist/image-editor/items.d.ts.map +1 -0
  37. package/dist/image-editor/items.js +179 -0
  38. package/dist/image-editor/items.js.map +1 -0
  39. package/dist/image-editor/ops.d.ts +35 -0
  40. package/dist/image-editor/ops.d.ts.map +1 -0
  41. package/dist/image-editor/ops.js +332 -0
  42. package/dist/image-editor/ops.js.map +1 -0
  43. package/dist/image-editor/panels.d.ts +24 -0
  44. package/dist/image-editor/panels.d.ts.map +1 -0
  45. package/dist/image-editor/panels.js +185 -0
  46. package/dist/image-editor/panels.js.map +1 -0
  47. package/dist/image-editor/pixels.d.ts +10 -0
  48. package/dist/image-editor/pixels.d.ts.map +1 -0
  49. package/dist/image-editor/pixels.js +172 -0
  50. package/dist/image-editor/pixels.js.map +1 -0
  51. package/dist/image-editor/transform.d.ts +33 -0
  52. package/dist/image-editor/transform.d.ts.map +1 -0
  53. package/dist/image-editor/transform.js +142 -0
  54. package/dist/image-editor/transform.js.map +1 -0
  55. package/dist/image-editor/types.d.ts +445 -0
  56. package/dist/image-editor/types.d.ts.map +1 -0
  57. package/dist/image-editor/types.js +6 -0
  58. package/dist/image-editor/types.js.map +1 -0
  59. package/dist/image-editor.css +1228 -0
  60. package/dist/image-editor.d.ts +5 -0
  61. package/dist/image-editor.d.ts.map +1 -0
  62. package/dist/image-editor.js +13 -0
  63. package/dist/image-editor.js.map +1 -0
  64. package/dist/inline-edit/InlineEdit.d.ts +6 -0
  65. package/dist/inline-edit/InlineEdit.d.ts.map +1 -0
  66. package/dist/inline-edit/InlineEdit.js +337 -0
  67. package/dist/inline-edit/InlineEdit.js.map +1 -0
  68. package/dist/inline-edit/types.d.ts +172 -0
  69. package/dist/inline-edit/types.d.ts.map +1 -0
  70. package/dist/inline-edit/types.js +2 -0
  71. package/dist/inline-edit/types.js.map +1 -0
  72. package/dist/inline-edit/validate.d.ts +11 -0
  73. package/dist/inline-edit/validate.d.ts.map +1 -0
  74. package/dist/inline-edit/validate.js +30 -0
  75. package/dist/inline-edit/validate.js.map +1 -0
  76. package/dist/inline-edit.css +621 -0
  77. package/dist/inline-edit.d.ts +3 -0
  78. package/dist/inline-edit.d.ts.map +1 -0
  79. package/dist/inline-edit.js +9 -0
  80. package/dist/inline-edit.js.map +1 -0
  81. package/dist/markdown-editor/MarkdownEditor.d.ts +6 -0
  82. package/dist/markdown-editor/MarkdownEditor.d.ts.map +1 -0
  83. package/dist/markdown-editor/MarkdownEditor.js +423 -0
  84. package/dist/markdown-editor/MarkdownEditor.js.map +1 -0
  85. package/dist/markdown-editor/commands.d.ts +69 -0
  86. package/dist/markdown-editor/commands.d.ts.map +1 -0
  87. package/dist/markdown-editor/commands.js +207 -0
  88. package/dist/markdown-editor/commands.js.map +1 -0
  89. package/dist/markdown-editor/dialog.d.ts +19 -0
  90. package/dist/markdown-editor/dialog.d.ts.map +1 -0
  91. package/dist/markdown-editor/dialog.js +88 -0
  92. package/dist/markdown-editor/dialog.js.map +1 -0
  93. package/dist/markdown-editor/items.d.ts +12 -0
  94. package/dist/markdown-editor/items.d.ts.map +1 -0
  95. package/dist/markdown-editor/items.js +110 -0
  96. package/dist/markdown-editor/items.js.map +1 -0
  97. package/dist/markdown-editor/menu-popup.d.ts +14 -0
  98. package/dist/markdown-editor/menu-popup.d.ts.map +1 -0
  99. package/dist/markdown-editor/menu-popup.js +13 -0
  100. package/dist/markdown-editor/menu-popup.js.map +1 -0
  101. package/dist/markdown-editor/types.d.ts +153 -0
  102. package/dist/markdown-editor/types.d.ts.map +1 -0
  103. package/dist/markdown-editor/types.js +2 -0
  104. package/dist/markdown-editor/types.js.map +1 -0
  105. package/dist/markdown-editor.css +1020 -0
  106. package/dist/markdown-editor.d.ts +6 -0
  107. package/dist/markdown-editor.d.ts.map +1 -0
  108. package/dist/markdown-editor.js +12 -0
  109. package/dist/markdown-editor.js.map +1 -0
  110. package/dist/styles.css +1699 -0
  111. package/package.json +53 -4
@@ -0,0 +1,30 @@
1
+ // InlineEdit validation: the rules compile with the Data
2
+ // Grid evaluator (`@salmonui/core/validation`); built-in rules run synchronously, custom `validate`
3
+ // functions may be async. Pure: Node-testable.
4
+ import { compileValidationRules, NO_ERRORS } from '@salmonui/core/validation';
5
+ // Custom validators of InlineEdit take only the value; the grid context is a frozen stub.
6
+ const CONTEXT = Object.freeze({ rowId: '', columnId: '', column: undefined, isNew: false });
7
+ export function compileInlineValidation(rules) {
8
+ if (!rules)
9
+ return null;
10
+ const compiled = compileValidationRules(rules);
11
+ const custom = compiled.custom;
12
+ return {
13
+ sync: (value) => compiled.validate(value, undefined),
14
+ custom: custom ? (value) => custom(value, undefined, CONTEXT) : null,
15
+ };
16
+ }
17
+ /** Runs every rule; returns the errors synchronously when no custom rule is async. */
18
+ export function runValidation(validator, value) {
19
+ if (!validator)
20
+ return NO_ERRORS;
21
+ const errors = validator.sync(value);
22
+ if (errors.length || !validator.custom)
23
+ return errors;
24
+ const out = validator.custom(value);
25
+ if (out && typeof out.then === 'function') {
26
+ return Promise.resolve(out).then((message) => (message ? Object.freeze([message]) : NO_ERRORS));
27
+ }
28
+ return out ? Object.freeze([out]) : NO_ERRORS;
29
+ }
30
+ //# sourceMappingURL=validate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/inline-edit/validate.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,oGAAoG;AACpG,+CAA+C;AAE/C,OAAO,EAAE,sBAAsB,EAAE,SAAS,EAAgD,MAAM,2BAA2B,CAAC;AAU5H,0FAA0F;AAC1F,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,CAAyC,CAAC;AAEpI,MAAM,UAAU,uBAAuB,CAAC,KAA8C;IACpF,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IACxB,MAAM,QAAQ,GAAG,sBAAsB,CAAC,KAAoC,CAAC,CAAC;IAC9E,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC;IAC/B,OAAO;QACL,IAAI,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;QACpD,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI;KACrE,CAAC;AACJ,CAAC;AAED,sFAAsF;AACtF,MAAM,UAAU,aAAa,CAAC,SAAqC,EAAE,KAAc;IACjF,IAAI,CAAC,SAAS;QAAE,OAAO,SAAS,CAAC;IACjC,MAAM,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACrC,IAAI,MAAM,CAAC,MAAM,IAAI,CAAC,SAAS,CAAC,MAAM;QAAE,OAAO,MAAM,CAAC;IACtD,MAAM,GAAG,GAAG,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACpC,IAAI,GAAG,IAAI,OAAQ,GAAkC,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;QAC1E,OAAO,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;IAClG,CAAC;IACD,OAAO,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,GAAa,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC1D,CAAC"}
@@ -0,0 +1,621 @@
1
+ @layer salmon.a,salmon.b,salmon.c;
2
+ @layer salmon.a {
3
+ /* @salmonui/buttons/button/styles.css, first part (button-core): Button,
4
+ ToggleButton, ButtonGroup, ToggleButtonGroup without the chip, progress
5
+ and floating extras of styles/button.css. Colors come from --salmon-*
6
+ theme variables only; tone and variant are orthogonal (data-tone x
7
+ data-variant); sizes are three fixed metric sets. Logical properties only. */
8
+
9
+ .salmon-button {
10
+ --salmon-button-c: var(--salmon-surface-sunken);
11
+ --salmon-button-c-hover: var(--salmon-surface-hover);
12
+ --salmon-button-c-active: var(--salmon-border-subtle);
13
+ --salmon-button-c-on: var(--salmon-text-primary);
14
+ --salmon-button-c-edge: var(--salmon-border-default);
15
+ --salmon-button-c-subtle: var(--salmon-surface-hover);
16
+ --salmon-button-c-subtle-hover: var(--salmon-surface-sunken);
17
+ --salmon-button-c-text: var(--salmon-text-primary);
18
+ --salmon-button-c-border: var(--salmon-border-default);
19
+ --salmon-button-c-selected: var(--salmon-surface-selected);
20
+ --salmon-button-c-selected-edge: var(--salmon-border-selected);
21
+ --salmon-button-h: var(--salmon-control-height-md, 32px);
22
+ --salmon-button-pad: var(--salmon-control-padding-md, 12px);
23
+ --salmon-button-bg: var(--salmon-button-c);
24
+ --salmon-button-fg: var(--salmon-button-c-on);
25
+ --salmon-button-bd: var(--salmon-button-c-edge);
26
+ position: relative;
27
+ isolation: isolate;
28
+ display: inline-flex;
29
+ align-items: center;
30
+ justify-content: center;
31
+ gap: 6px;
32
+ box-sizing: border-box;
33
+ min-block-size: var(--salmon-button-h);
34
+ margin: 0;
35
+ padding-block: 0;
36
+ padding-inline: var(--salmon-button-pad);
37
+ overflow: hidden;
38
+ border: 1px solid var(--salmon-button-bd);
39
+ border-radius: var(--salmon-radius-md);
40
+ background: var(--salmon-button-bg);
41
+ color: var(--salmon-button-fg);
42
+ font-family: var(--salmon-font-sans);
43
+ font-size: var(--salmon-font-size-md);
44
+ font-weight: var(--salmon-font-weight-medium);
45
+ line-height: var(--salmon-line-height-tight);
46
+ text-decoration: none;
47
+ white-space: nowrap;
48
+ vertical-align: middle;
49
+ cursor: pointer;
50
+ user-select: none;
51
+ -webkit-tap-highlight-color: transparent;
52
+ transition: background-color var(--salmon-motion-duration-fast) var(--salmon-motion-easing), border-color var(--salmon-motion-duration-fast) var(--salmon-motion-easing), color var(--salmon-motion-duration-fast) var(--salmon-motion-easing);
53
+ }
54
+
55
+ /* The class's display would override the native hidden attribute. */
56
+ .salmon-button[hidden] {
57
+ display: none;
58
+ }
59
+
60
+ .salmon-button[data-tone='primary'],
61
+ .salmon-button[data-tone='success'],
62
+ .salmon-button[data-tone='warning'],
63
+ .salmon-button[data-tone='danger'],
64
+ .salmon-button[data-tone='info'] {
65
+ --salmon-button-c-edge: var(--salmon-button-c);
66
+ --salmon-button-c-selected: var(--salmon-button-c-subtle);
67
+ --salmon-button-c-selected-edge: var(--salmon-button-c);
68
+ }
69
+ .salmon-button[data-tone='primary'] {
70
+ --salmon-button-c: var(--salmon-color-primary);
71
+ --salmon-button-c-hover: var(--salmon-color-primary-hover);
72
+ --salmon-button-c-active: var(--salmon-color-primary-active);
73
+ --salmon-button-c-on: var(--salmon-color-primary-on);
74
+ --salmon-button-c-subtle: var(--salmon-color-primary-subtle);
75
+ --salmon-button-c-subtle-hover: var(--salmon-color-primary-subtle-hover);
76
+ --salmon-button-c-text: var(--salmon-color-primary-text);
77
+ --salmon-button-c-border: var(--salmon-color-primary-border);
78
+ }
79
+ .salmon-button[data-tone='success'] {
80
+ --salmon-button-c: var(--salmon-color-success);
81
+ --salmon-button-c-hover: var(--salmon-color-success-hover);
82
+ --salmon-button-c-active: var(--salmon-color-success-active);
83
+ --salmon-button-c-on: var(--salmon-color-success-on);
84
+ --salmon-button-c-subtle: var(--salmon-color-success-subtle);
85
+ --salmon-button-c-subtle-hover: var(--salmon-color-success-subtle-hover);
86
+ --salmon-button-c-text: var(--salmon-color-success-text);
87
+ --salmon-button-c-border: var(--salmon-color-success-border);
88
+ }
89
+ .salmon-button[data-tone='warning'] {
90
+ --salmon-button-c: var(--salmon-color-warning);
91
+ --salmon-button-c-hover: var(--salmon-color-warning-hover);
92
+ --salmon-button-c-active: var(--salmon-color-warning-active);
93
+ --salmon-button-c-on: var(--salmon-color-warning-on);
94
+ --salmon-button-c-subtle: var(--salmon-color-warning-subtle);
95
+ --salmon-button-c-subtle-hover: var(--salmon-color-warning-subtle-hover);
96
+ --salmon-button-c-text: var(--salmon-color-warning-text);
97
+ --salmon-button-c-border: var(--salmon-color-warning-border);
98
+ }
99
+ .salmon-button[data-tone='danger'] {
100
+ --salmon-button-c: var(--salmon-color-danger);
101
+ --salmon-button-c-hover: var(--salmon-color-danger-hover);
102
+ --salmon-button-c-active: var(--salmon-color-danger-active);
103
+ --salmon-button-c-on: var(--salmon-color-danger-on);
104
+ --salmon-button-c-subtle: var(--salmon-color-danger-subtle);
105
+ --salmon-button-c-subtle-hover: var(--salmon-color-danger-subtle-hover);
106
+ --salmon-button-c-text: var(--salmon-color-danger-text);
107
+ --salmon-button-c-border: var(--salmon-color-danger-border);
108
+ }
109
+ .salmon-button[data-tone='info'] {
110
+ --salmon-button-c: var(--salmon-color-info);
111
+ --salmon-button-c-hover: var(--salmon-color-info-hover);
112
+ --salmon-button-c-active: var(--salmon-color-info-active);
113
+ --salmon-button-c-on: var(--salmon-color-info-on);
114
+ --salmon-button-c-subtle: var(--salmon-color-info-subtle);
115
+ --salmon-button-c-subtle-hover: var(--salmon-color-info-subtle-hover);
116
+ --salmon-button-c-text: var(--salmon-color-info-text);
117
+ --salmon-button-c-border: var(--salmon-color-info-border);
118
+ }
119
+
120
+ /* Sizes: the density control metrics. */
121
+ .salmon-button[data-size='sm'] {
122
+ --salmon-button-h: var(--salmon-control-height-sm, 24px);
123
+ --salmon-button-pad: var(--salmon-control-padding-sm, 8px);
124
+ gap: 4px;
125
+ font-size: var(--salmon-font-size-sm);
126
+ }
127
+ .salmon-button[data-size='lg'] {
128
+ --salmon-button-h: var(--salmon-control-height-lg, 40px);
129
+ --salmon-button-pad: var(--salmon-control-padding-lg, 16px);
130
+ gap: 8px;
131
+ font-size: var(--salmon-font-size-lg);
132
+ }
133
+ .salmon-button[data-icon-only] {
134
+ min-inline-size: var(--salmon-button-h);
135
+ padding-inline: 0;
136
+ }
137
+ /* A glyph in the label is a flex item, not an inline box on the text baseline,
138
+ so it sits on the centre axis. */
139
+ .salmon-button[data-icon-only] > .salmon-button__label {
140
+ display: flex;
141
+ }
142
+
143
+ /* Variants. */
144
+ .salmon-button[data-variant='solid']:hover {
145
+ --salmon-button-bg: var(--salmon-button-c-hover);
146
+ }
147
+ .salmon-button[data-variant='solid']:active {
148
+ --salmon-button-bg: var(--salmon-button-c-active);
149
+ }
150
+ /* A pressed state persists, so it keeps the guaranteed pairs:
151
+ the fill with its on-color, marked by an inset ring
152
+ of that on-color; outline and ghost use the subtle surface with tone text. */
153
+ .salmon-button[data-variant='solid'][data-pressed] {
154
+ --salmon-button-bg: var(--salmon-button-c);
155
+ box-shadow: inset 0 0 0 2px var(--salmon-button-c-on);
156
+ }
157
+ .salmon-button[data-variant='outline'],
158
+ .salmon-button[data-variant='ghost'],
159
+ .salmon-button[data-variant='link'] {
160
+ --salmon-button-bg: transparent;
161
+ --salmon-button-fg: var(--salmon-button-c-text);
162
+ --salmon-button-bd: transparent;
163
+ }
164
+ .salmon-button[data-variant='outline'] {
165
+ --salmon-button-bd: var(--salmon-button-c-border);
166
+ }
167
+ .salmon-button[data-variant='outline']:hover,
168
+ .salmon-button[data-variant='ghost']:hover {
169
+ --salmon-button-bg: var(--salmon-button-c-subtle);
170
+ }
171
+ .salmon-button[data-variant='outline']:active,
172
+ .salmon-button[data-variant='ghost']:active {
173
+ --salmon-button-bg: var(--salmon-button-c-subtle-hover);
174
+ }
175
+ .salmon-button[data-variant='outline'][data-pressed],
176
+ .salmon-button[data-variant='ghost'][data-pressed] {
177
+ --salmon-button-bg: var(--salmon-button-c-subtle);
178
+ --salmon-button-bd: var(--salmon-button-c-selected-edge);
179
+ }
180
+ .salmon-button[data-variant='link'] {
181
+ padding-inline: 2px;
182
+ min-block-size: auto;
183
+ font-weight: var(--salmon-font-weight-regular);
184
+ }
185
+ .salmon-button[data-variant='link'][data-tone='neutral'] {
186
+ --salmon-button-fg: var(--salmon-text-link);
187
+ }
188
+ .salmon-button[data-variant='link']:hover,
189
+ .salmon-button[data-variant='link'][data-pressed] {
190
+ text-decoration: underline;
191
+ }
192
+ /* States. */
193
+ .salmon-button:focus-visible {
194
+ z-index: 1;
195
+ outline: var(--salmon-state-focus-ring-width) solid var(--salmon-state-focus-ring);
196
+ outline-offset: var(--salmon-state-focus-ring-offset);
197
+ }
198
+ .salmon-button[data-variant]:disabled,
199
+ .salmon-button[data-variant][aria-disabled='true']:not([data-loading]) {
200
+ --salmon-button-bg: var(--salmon-surface-disabled);
201
+ --salmon-button-fg: var(--salmon-text-disabled);
202
+ --salmon-button-bd: var(--salmon-border-subtle);
203
+ cursor: not-allowed;
204
+ }
205
+ .salmon-button[data-variant='link']:disabled,
206
+ .salmon-button[data-variant='link'][aria-disabled='true']:not([data-loading]),
207
+ .salmon-button[data-variant='ghost']:disabled {
208
+ --salmon-button-bg: transparent;
209
+ --salmon-button-bd: transparent;
210
+ }
211
+ .salmon-button[data-loading] {
212
+ cursor: progress;
213
+ }
214
+
215
+ .salmon-button__label {
216
+ min-inline-size: 0;
217
+ overflow: hidden;
218
+ text-overflow: ellipsis;
219
+ }
220
+ .salmon-button__icon,
221
+ .salmon-button__spinner {
222
+ display: inline-flex;
223
+ flex: none;
224
+ align-items: center;
225
+ justify-content: center;
226
+ }
227
+ .salmon-button__spinner:empty {
228
+ inline-size: 1em;
229
+ block-size: 1em;
230
+ box-sizing: border-box;
231
+ border: 2px solid currentColor;
232
+ border-inline-end-color: transparent;
233
+ border-radius: 50%;
234
+ animation: salmon-button-spin 0.8s linear infinite;
235
+ }
236
+ @keyframes salmon-button-spin {
237
+ to {
238
+ rotate: 360deg;
239
+ }
240
+ }
241
+ .salmon-button__sr {
242
+ position: absolute;
243
+ inline-size: 1px;
244
+ block-size: 1px;
245
+ margin: -1px;
246
+ padding: 0;
247
+ overflow: hidden;
248
+ clip-path: inset(50%);
249
+ white-space: nowrap;
250
+ border: 0;
251
+ }
252
+
253
+ /* Groups. */
254
+ .salmon-button-group,
255
+ .salmon-toggle-button-group {
256
+ display: inline-flex;
257
+ gap: 8px;
258
+ vertical-align: middle;
259
+ }
260
+ .salmon-button-group:not([data-attached]),
261
+ .salmon-toggle-button-group:not([data-attached]) {
262
+ flex-wrap: wrap;
263
+ }
264
+ .salmon-button-group[data-orientation='vertical'],
265
+ .salmon-toggle-button-group[data-orientation='vertical'] {
266
+ flex-direction: column;
267
+ align-items: stretch;
268
+ }
269
+ .salmon-button-group[data-attached],
270
+ .salmon-toggle-button-group[data-attached] {
271
+ gap: 0;
272
+ }
273
+ [data-attached][data-orientation='horizontal'] > .salmon-button:not(:first-of-type) {
274
+ margin-inline-start: -1px;
275
+ border-start-start-radius: 0;
276
+ border-end-start-radius: 0;
277
+ }
278
+ [data-attached][data-orientation='horizontal'] > .salmon-button:not(:last-of-type) {
279
+ border-start-end-radius: 0;
280
+ border-end-end-radius: 0;
281
+ }
282
+ [data-attached][data-orientation='vertical'] > .salmon-button:not(:first-of-type) {
283
+ margin-block-start: -1px;
284
+ border-start-start-radius: 0;
285
+ border-start-end-radius: 0;
286
+ }
287
+ [data-attached][data-orientation='vertical'] > .salmon-button:not(:last-of-type) {
288
+ border-end-start-radius: 0;
289
+ border-end-end-radius: 0;
290
+ }
291
+ [data-attached] > .salmon-button:hover,
292
+ [data-attached] > .salmon-button[data-pressed] {
293
+ z-index: 1;
294
+ }
295
+
296
+ @media (prefers-reduced-motion: reduce) {
297
+ .salmon-button {
298
+ transition: none;
299
+ }
300
+ .salmon-button__spinner:empty {
301
+ animation-duration: 2.4s;
302
+ }
303
+ }
304
+
305
+ @media (forced-colors: active) {
306
+ .salmon-button {
307
+ border-color: ButtonText;
308
+ }
309
+ .salmon-button[data-pressed] {
310
+ forced-color-adjust: none;
311
+ border-color: Highlight;
312
+ background: Highlight;
313
+ color: HighlightText;
314
+ }
315
+ .salmon-button:disabled {
316
+ border-color: GrayText;
317
+ color: GrayText;
318
+ }
319
+ }
320
+
321
+ }
322
+ @layer salmon.b {
323
+ /* @salmonui/buttons/button/styles.css, second part: the filter chip variant,
324
+ the progress fill and the floating action button. tooling/checks/copy-css.mjs
325
+ writes dist/button.css as styles/button-core.css followed by this file;
326
+ families of other packages that render plain buttons only carry
327
+ button-core.css (`@salmonui/buttons:button-core` in the manifest).
328
+ Chip hover and pressed apply
329
+ to enabled chips only, so the disabled state of button-core.css, which
330
+ comes first, keeps winning. */
331
+
332
+ .salmon-button[data-variant='chip'] {
333
+ --salmon-button-h: calc(var(--salmon-control-height-md, 32px) - 4px);
334
+ --salmon-button-bg: transparent;
335
+ --salmon-button-fg: var(--salmon-button-c-text);
336
+ --salmon-button-bd: var(--salmon-button-c-border);
337
+ border-radius: var(--salmon-radius-sm);
338
+ font-weight: var(--salmon-font-weight-regular);
339
+ }
340
+ .salmon-button[data-variant='chip'][data-size='sm'] {
341
+ --salmon-button-h: calc(var(--salmon-control-height-sm, 24px) - 2px);
342
+ }
343
+ .salmon-button[data-variant='chip'][data-size='lg'] {
344
+ --salmon-button-h: calc(var(--salmon-control-height-lg, 40px) - 6px);
345
+ }
346
+ .salmon-button[data-variant='chip']:hover:where(:enabled) {
347
+ --salmon-button-bg: var(--salmon-button-c-subtle);
348
+ }
349
+ .salmon-button[data-variant='chip'][data-pressed]:where(:enabled) {
350
+ --salmon-button-bg: var(--salmon-button-c-selected);
351
+ --salmon-button-bd: var(--salmon-button-c-selected-edge);
352
+ }
353
+ /* Filter chips show a check when pressed. */
354
+ .salmon-button[data-variant='chip'][data-pressed]::after {
355
+ content: '';
356
+ order: -1;
357
+ inline-size: 0.3em;
358
+ block-size: 0.6em;
359
+ margin-block-start: -0.2em;
360
+ border: solid currentColor;
361
+ border-width: 0 2px 2px 0;
362
+ rotate: 45deg;
363
+ }
364
+
365
+ /* Progress fill from inline-start. */
366
+ .salmon-button[data-progress]::before {
367
+ content: '';
368
+ position: absolute;
369
+ z-index: -1;
370
+ inset-block: 0;
371
+ inset-inline-start: 0;
372
+ inline-size: var(--salmon-button-progress, 0%);
373
+ background: currentColor;
374
+ opacity: 0.22;
375
+ transition: inline-size var(--salmon-motion-duration-fast) var(--salmon-motion-easing);
376
+ }
377
+
378
+ /* Floating action button: circular, elevated, CSS positioned. */
379
+ .salmon-button[data-floating] {
380
+ --salmon-button-h: 56px;
381
+ --salmon-button-pad: 20px;
382
+ --salmon-button-inset: 16px;
383
+ position: fixed;
384
+ z-index: 10;
385
+ border-radius: var(--salmon-radius-full);
386
+ box-shadow: var(--salmon-shadow-lg);
387
+ }
388
+ .salmon-button[data-floating][data-size='sm'] {
389
+ --salmon-button-h: 40px;
390
+ --salmon-button-pad: 14px;
391
+ }
392
+ .salmon-button[data-floating][data-size='lg'] {
393
+ --salmon-button-h: 64px;
394
+ --salmon-button-pad: 24px;
395
+ }
396
+ .salmon-button[data-floating-scope='parent'] {
397
+ position: absolute;
398
+ }
399
+ .salmon-button[data-floating^='top'] {
400
+ inset-block-start: var(--salmon-button-inset);
401
+ }
402
+ .salmon-button[data-floating^='bottom'] {
403
+ inset-block-end: var(--salmon-button-inset);
404
+ }
405
+ .salmon-button[data-floating$='Start'] {
406
+ inset-inline-start: var(--salmon-button-inset);
407
+ }
408
+ .salmon-button[data-floating$='End'] {
409
+ inset-inline-end: var(--salmon-button-inset);
410
+ }
411
+ .salmon-button[data-floating^='middle'] {
412
+ inset-block-start: 50%;
413
+ translate: 0 -50%;
414
+ }
415
+ /* Direction sign: -1 under the nearest dir="rtl", 1 under dir="ltr". */
416
+ :where([dir='rtl']) { --salmon-dir: -1; }
417
+ :where([dir='ltr']) { --salmon-dir: 1; }
418
+ .salmon-button[data-floating$='Center'] {
419
+ inset-inline-start: 50%;
420
+ translate: calc(-50% * var(--salmon-dir, 1)) 0;
421
+ }
422
+ .salmon-button[data-floating='middleCenter'] {
423
+ translate: calc(-50% * var(--salmon-dir, 1)) -50%;
424
+ }
425
+
426
+ @media (prefers-reduced-motion: reduce) {
427
+ .salmon-button[data-progress]::before {
428
+ transition: none;
429
+ }
430
+ }
431
+
432
+ }
433
+ @layer salmon.c {
434
+ /* @salmonui/react/inline-edit/styles.css: InlineEdit.
435
+ Colors from --salmon-* theme variables only; logical properties only.
436
+ The Save / Cancel buttons are Button: pages also load button/styles.css. */
437
+
438
+ .salmon-inline-edit {
439
+ display: inline-flex;
440
+ align-items: center;
441
+ gap: var(--salmon-space-1);
442
+ max-inline-size: 100%;
443
+ font-family: var(--salmon-font-sans);
444
+ font-size: var(--salmon-font-size-md);
445
+ line-height: var(--salmon-line-height-normal);
446
+ color: var(--salmon-text-primary);
447
+ /* The preview text shares the baseline of an inline label next to it. */
448
+ vertical-align: baseline;
449
+ }
450
+
451
+ .salmon-inline-edit[data-mode='inline'][data-editing] {
452
+ display: flex;
453
+ }
454
+
455
+ .salmon-inline-edit-preview {
456
+ display: inline-block;
457
+ min-inline-size: 2ch;
458
+ margin: 0;
459
+ padding-block: 2px;
460
+ padding-inline: var(--salmon-space-1);
461
+ border: 1px dashed transparent;
462
+ border-radius: var(--salmon-radius-sm);
463
+ background: transparent;
464
+ color: inherit;
465
+ font: inherit;
466
+ text-align: start;
467
+ overflow-wrap: anywhere;
468
+ }
469
+
470
+ button.salmon-inline-edit-preview {
471
+ cursor: text;
472
+ }
473
+
474
+ button.salmon-inline-edit-preview:hover:not([aria-disabled]) {
475
+ border-color: var(--salmon-border-default);
476
+ background: var(--salmon-surface-hover);
477
+ }
478
+
479
+ .salmon-inline-edit-preview:focus-visible {
480
+ outline: var(--salmon-state-focus-ring-width) solid var(--salmon-state-focus-ring);
481
+ outline-offset: var(--salmon-state-focus-ring-offset);
482
+ }
483
+
484
+ .salmon-inline-edit-preview[data-empty] {
485
+ color: var(--salmon-text-placeholder);
486
+ }
487
+
488
+ .salmon-inline-edit[data-disabled] .salmon-inline-edit-preview {
489
+ color: var(--salmon-text-disabled);
490
+ cursor: default;
491
+ }
492
+
493
+ /* Double-click mode: the edit button is the touch fallback. */
494
+ .salmon-inline-edit[data-trigger='doubleClick'] .salmon-inline-edit-edit-button {
495
+ display: none;
496
+ }
497
+
498
+ @media (pointer: coarse) {
499
+ .salmon-inline-edit[data-trigger='doubleClick'] .salmon-inline-edit-edit-button {
500
+ display: inline-flex;
501
+ }
502
+ }
503
+
504
+ .salmon-inline-edit-editor {
505
+ display: flex;
506
+ flex-wrap: wrap;
507
+ /* Save / Cancel line up with the top of a multi-line editor (32px rows match). */
508
+ align-items: flex-start;
509
+ gap: var(--salmon-space-2);
510
+ flex: 1 1 auto;
511
+ min-inline-size: 0;
512
+ }
513
+
514
+ .salmon-inline-edit-field {
515
+ display: flex;
516
+ flex: 1 1 12rem;
517
+ min-inline-size: 0;
518
+ }
519
+
520
+ .salmon-inline-edit-field > * {
521
+ flex: 1 1 auto;
522
+ min-inline-size: 0;
523
+ }
524
+
525
+ /* The default input, and a plain native control a custom editor renders
526
+ (`children` spreading `inputProps`), share the md control metrics. */
527
+ .salmon-inline-edit-input,
528
+ .salmon-inline-edit-field > :is(input:not([type='checkbox'], [type='radio'], [type='range'], [type='color']), textarea):not([class]) {
529
+ box-sizing: border-box;
530
+ min-block-size: var(--salmon-control-height-md, 32px);
531
+ padding-block: 4px;
532
+ padding-inline: var(--salmon-space-2);
533
+ border: 1px solid var(--salmon-border-default);
534
+ border-radius: var(--salmon-radius-md);
535
+ background: var(--salmon-surface-base);
536
+ color: var(--salmon-text-primary);
537
+ font: inherit;
538
+ }
539
+
540
+ .salmon-inline-edit-field > textarea:not([class]) {
541
+ resize: vertical;
542
+ }
543
+
544
+ .salmon-inline-edit-field > :is(input, textarea):not([class]):focus-visible,
545
+ .salmon-inline-edit-input:focus-visible {
546
+ outline: var(--salmon-state-focus-ring-width) solid var(--salmon-state-focus-ring);
547
+ outline-offset: 0;
548
+ }
549
+
550
+ .salmon-inline-edit-field > :is(input, textarea):not([class])[aria-invalid='true'],
551
+ .salmon-inline-edit-input[aria-invalid='true'] {
552
+ border-color: var(--salmon-state-invalid);
553
+ }
554
+
555
+ .salmon-inline-edit-actions {
556
+ display: inline-flex;
557
+ gap: var(--salmon-space-2);
558
+ margin-inline-start: auto;
559
+ }
560
+
561
+ .salmon-inline-edit-error {
562
+ flex: 1 0 100%;
563
+ color: var(--salmon-color-danger-text);
564
+ font-size: var(--salmon-font-size-sm);
565
+ }
566
+
567
+ .salmon-inline-edit-popover {
568
+ z-index: 1000;
569
+ box-sizing: border-box;
570
+ inline-size: max(16rem, var(--salmon-overlay-anchor-width, 0px));
571
+ max-inline-size: calc(100vw - 16px);
572
+ padding: var(--salmon-space-3);
573
+ overflow: visible;
574
+ border: 1px solid var(--salmon-border-default);
575
+ border-radius: var(--salmon-radius-lg);
576
+ background: var(--salmon-surface-overlay);
577
+ color: var(--salmon-text-primary);
578
+ box-shadow: var(--salmon-shadow-md);
579
+ font-family: var(--salmon-font-sans);
580
+ font-size: var(--salmon-font-size-md);
581
+ }
582
+
583
+ .salmon-inline-edit-popover:not([data-placed]) {
584
+ visibility: hidden;
585
+ }
586
+
587
+ /* Narrow viewports: the popover sits at the bottom edge (CSS only, so SSR is unaffected). */
588
+ @media (max-width: 480px) {
589
+ .salmon-inline-edit-popover[data-placed] {
590
+ inset: auto 0 0 0 !important;
591
+ inline-size: auto;
592
+ max-inline-size: none;
593
+ transform: none !important;
594
+ border-end-start-radius: 0;
595
+ border-end-end-radius: 0;
596
+ }
597
+ }
598
+
599
+ .salmon-inline-edit-label,
600
+ .salmon-inline-edit-status {
601
+ position: absolute;
602
+ inline-size: 1px;
603
+ block-size: 1px;
604
+ overflow: hidden;
605
+ clip-path: inset(50%);
606
+ white-space: nowrap;
607
+ }
608
+
609
+ @media (prefers-reduced-motion: no-preference) {
610
+ .salmon-inline-edit-popover[data-placed] {
611
+ animation: salmon-inline-edit-in var(--salmon-motion-duration-fast) var(--salmon-motion-easing);
612
+ }
613
+ }
614
+
615
+ @keyframes salmon-inline-edit-in {
616
+ from {
617
+ opacity: 0;
618
+ }
619
+ }
620
+
621
+ }
@@ -0,0 +1,3 @@
1
+ export { InlineEdit, INLINE_EDIT_DEFAULT_LOCALE_TEXT } from './inline-edit/InlineEdit.js';
2
+ export type { InlineEditActionsContext, InlineEditApi, InlineEditCancelEvent, InlineEditCancellable, InlineEditDraftChangeEvent, InlineEditEditingChangeEvent, InlineEditInputProps, InlineEditLocaleText, InlineEditPart, InlineEditProps, InlineEditRenderContext, InlineEditSaveErrorEvent, InlineEditSaveEvent, InlineEditSource, InlineEditStartEvent, InlineEditTrigger, InlineEditValidation, InlineEditValidator, } from './inline-edit/types.js';
3
+ //# sourceMappingURL=inline-edit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inline-edit.d.ts","sourceRoot":"","sources":["../src/inline-edit.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,+BAA+B,EAAE,MAAM,6BAA6B,CAAC;AAC1F,YAAY,EACV,wBAAwB,EACxB,aAAa,EACb,qBAAqB,EACrB,qBAAqB,EACrB,0BAA0B,EAC1B,4BAA4B,EAC5B,oBAAoB,EACpB,oBAAoB,EACpB,cAAc,EACd,eAAe,EACf,uBAAuB,EACvB,wBAAwB,EACxB,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1,9 @@
1
+ 'use client';
2
+ import { expectStylesheet } from '@salmonui/core/internal/dev';
3
+ // `@salmonui/editors/inline-edit`: InlineEdit, an in-place editor.
4
+ // Styles: `@salmonui/editors/inline-edit/styles.css`
5
+ // plus `@salmonui/buttons/button/styles.css` for the actions.
6
+ export { InlineEdit, INLINE_EDIT_DEFAULT_LOCALE_TEXT } from './inline-edit/InlineEdit.js';
7
+ if (process.env.NODE_ENV !== 'production')
8
+ expectStylesheet('@salmonui/editors/inline-edit', 'salmon-inline-edit');
9
+ //# sourceMappingURL=inline-edit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inline-edit.js","sourceRoot":"","sources":["../src/inline-edit.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D,mEAAmE;AACnE,qDAAqD;AACrD,8DAA8D;AAC9D,OAAO,EAAE,UAAU,EAAE,+BAA+B,EAAE,MAAM,6BAA6B,CAAC;AAyB1F,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY;IAAE,gBAAgB,CAAC,+BAA+B,EAAE,oBAAoB,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { type KeyboardEvent, type ReactElement } from 'react';
2
+ import type { MarkdownEditorProps, MarkdownToolbarItemId } from './types.js';
3
+ /** The command of a Mod shortcut, or null. Undo / redo stay native. */
4
+ export declare function shortcutCommand(event: Pick<KeyboardEvent, 'key' | 'code' | 'ctrlKey' | 'metaKey' | 'shiftKey' | 'altKey'>): MarkdownToolbarItemId | null;
5
+ export declare function MarkdownEditor(props: MarkdownEditorProps): ReactElement;
6
+ //# sourceMappingURL=MarkdownEditor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MarkdownEditor.d.ts","sourceRoot":"","sources":["../../src/markdown-editor/MarkdownEditor.tsx"],"names":[],"mappings":"AAQA,OAAO,EAWL,KAAK,aAAa,EAElB,KAAK,YAAY,EAGlB,MAAM,OAAO,CAAC;AAYf,OAAO,KAAK,EAAqB,mBAAmB,EAA6F,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAc3L,uEAAuE;AACvE,wBAAgB,eAAe,CAAC,KAAK,EAAE,IAAI,CAAC,aAAa,EAAE,KAAK,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAC,GAAG,qBAAqB,GAAG,IAAI,CAOxJ;AAcD,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,YAAY,CAsgBvE"}