@maple-kit/ui 0.8.0 → 0.10.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 (55) hide show
  1. package/README.md +5 -2
  2. package/dist/cx.js +6 -0
  3. package/dist/icons/chevron.d.ts +4 -0
  4. package/dist/icons/chevron.js +8 -0
  5. package/dist/icons/code.d.ts +4 -0
  6. package/dist/icons/code.js +5 -0
  7. package/dist/icons/index.d.ts +4 -1
  8. package/dist/icons/index.js +4 -1
  9. package/dist/icons/link.d.ts +4 -0
  10. package/dist/icons/link.js +5 -0
  11. package/dist/index.d.ts +2 -1
  12. package/dist/index.js +2 -1
  13. package/dist/island/account.js +2 -1
  14. package/dist/island/approve.js +2 -1
  15. package/dist/island/content.js +2 -1
  16. package/dist/island/css.js +5 -17
  17. package/dist/island/filters.js +2 -1
  18. package/dist/island/header.js +2 -1
  19. package/dist/island/island.js +2 -1
  20. package/dist/island/item.js +2 -1
  21. package/dist/island/list.js +2 -1
  22. package/dist/island/new-comment.js +2 -1
  23. package/dist/island/settings.js +2 -1
  24. package/dist/island/trigger.js +2 -1
  25. package/dist/island/unsent.js +2 -1
  26. package/dist/island/wordmark.d.ts +6 -5
  27. package/dist/island/wordmark.js +16 -6
  28. package/dist/maple.d.ts +2 -1
  29. package/dist/maple.js +2 -1
  30. package/dist/marks/index.d.ts +2 -1
  31. package/dist/marks/index.js +3 -2
  32. package/dist/marks/pixel-leaf.d.ts +20 -0
  33. package/dist/marks/pixel-leaf.js +39 -0
  34. package/dist/marks/shape.js +1 -1
  35. package/dist/mock/css.js +427 -0
  36. package/dist/mock/index.d.ts +4 -0
  37. package/dist/mock/index.js +4 -0
  38. package/dist/mock/language.d.ts +39 -0
  39. package/dist/mock/language.js +66 -0
  40. package/dist/mock/layers.js +168 -0
  41. package/dist/mock/menu.js +85 -0
  42. package/dist/mock/mock.d.ts +18 -0
  43. package/dist/mock/mock.js +200 -0
  44. package/dist/mock/sheet.d.ts +8 -0
  45. package/dist/mock/sheet.js +9 -0
  46. package/dist/notice/notice.js +2 -1
  47. package/dist/part.js +1 -4
  48. package/dist/root.js +2 -1
  49. package/dist/sheet-base.d.ts +11 -0
  50. package/dist/sheet-base.js +173 -0
  51. package/dist/stylesheet.d.ts +3 -12
  52. package/dist/stylesheet.js +5 -167
  53. package/dist/tip.js +1 -1
  54. package/dist/tokens.js +6 -2
  55. package/package.json +6 -4
@@ -1,183 +1,21 @@
1
- import { COLOR_TOKENS, MOTION_TOKENS, RADIUS_TOKENS, REDUCED_MOTION_TOKENS, SHADOW_TOKENS, SIZE_TOKENS, TYPE_TOKENS } from "./tokens.js";
2
1
  import { composerCss } from "./composer/css.js";
3
2
  import { islandCss } from "./island/css.js";
4
3
  import { marksCss } from "./marks/css.js";
4
+ import { mockCss } from "./mock/css.js";
5
5
  import { noticeCss } from "./notice/css.js";
6
6
  import { pickerCss } from "./picker/css.js";
7
+ import { SCHEME_ATTRIBUTE, baseCss, tokenCss } from "./sheet-base.js";
7
8
  //#region src/stylesheet.ts
8
- const SCHEME_ATTRIBUTE = "data-mk-scheme";
9
- const DARK_HOST = `:host([${SCHEME_ATTRIBUTE}="dark"])`;
10
- function declare(tokens) {
11
- return Object.entries(tokens).map(([name, value]) => ` ${name}: ${value};`).join("\n");
12
- }
13
- function declareThemed(tokens, scheme) {
14
- return Object.entries(tokens).map(([name, value]) => ` ${name}: ${value[scheme]};`).join("\n");
15
- }
16
- function tokenCss() {
17
- return [
18
- `:host {`,
19
- declareThemed(COLOR_TOKENS, "light"),
20
- declareThemed(SHADOW_TOKENS, "light"),
21
- declare(RADIUS_TOKENS),
22
- declare(TYPE_TOKENS),
23
- declare(SIZE_TOKENS),
24
- declare(MOTION_TOKENS),
25
- ` color-scheme: light;`,
26
- `}`,
27
- ``,
28
- `${DARK_HOST} {`,
29
- declareThemed(COLOR_TOKENS, "dark"),
30
- declareThemed(SHADOW_TOKENS, "dark"),
31
- ` color-scheme: dark;`,
32
- `}`,
33
- ``,
34
- `@media (prefers-reduced-motion: reduce) {`,
35
- ` :host {`,
36
- declare(REDUCED_MOTION_TOKENS).split("\n").map((line) => ` ${line}`).join("\n"),
37
- ` }`,
38
- `}`
39
- ].join("\n");
40
- }
41
9
  function ruleCss() {
42
10
  return `
43
- :host {
44
- display: block;
45
- font-family: var(--mk-font);
46
- font-size: 13px;
47
- font-weight: 400;
48
- font-style: normal;
49
- font-variant: normal;
50
- letter-spacing: normal;
51
- line-height: 1.45;
52
- text-align: left;
53
- color: var(--mk-fg);
54
- -webkit-font-smoothing: antialiased;
55
- -moz-osx-font-smoothing: grayscale;
56
- }
57
-
58
- *,
59
- *::before,
60
- *::after {
61
- box-sizing: border-box;
62
- }
63
-
64
- .mk-layer {
65
- position: absolute;
66
- inset: 0;
67
- pointer-events: none;
68
- }
69
-
70
- .mk-live {
71
- pointer-events: auto;
72
- }
73
-
74
- .mk-surface {
75
- background: var(--mk-bg);
76
- border: 1px solid var(--mk-line-firm);
77
- border-radius: var(--mk-r);
78
- box-shadow: var(--mk-sh2);
79
- }
80
-
81
- ${DARK_HOST} .mk-surface {
82
- box-shadow: var(--mk-sh2), inset 0 1px 0 oklch(1 0 0 / 0.045);
83
- }
84
-
85
- .mk-num {
86
- font-variant-numeric: tabular-nums;
87
- }
88
-
89
- .mk-mono {
90
- font-family: var(--mk-mono);
91
- font-variant-numeric: tabular-nums;
92
- }
93
-
94
- .mk-body {
95
- text-wrap: pretty;
96
- }
97
-
98
- .mk-title,
99
- h1,
100
- h2,
101
- h3 {
102
- text-wrap: balance;
103
- }
104
-
105
- .mk-shot {
106
- outline: 1px solid var(--mk-shot-edge);
107
- outline-offset: -1px;
108
- }
109
-
110
- /* No radius here: an outline already follows the control's own corners, and
111
- forcing one squared off every pill in the overlay the moment it took focus.
112
- The two controls that carry no radius of their own are given one below. */
113
- :where(a, button, input, textarea, [role="button"], [tabindex]):focus-visible {
114
- outline: 2px solid var(--mk-accent);
115
- outline-offset: 2px;
116
- }
117
-
118
- .mk-press {
119
- transition: transform var(--mk-dur-fade) var(--mk-ease-surface);
120
- }
121
-
122
- .mk-press:active {
123
- transform: scale(var(--mk-press));
124
- }
125
-
126
- .mk-hit {
127
- position: relative;
128
- }
129
-
130
- .mk-hit::after {
131
- content: "";
132
- position: absolute;
133
- top: 50%;
134
- left: 50%;
135
- width: max(100%, var(--mk-hit));
136
- height: max(100%, var(--mk-hit));
137
- transform: translate(-50%, -50%);
138
- }
139
-
140
- .mk-track {
141
- transition: opacity var(--mk-dur-fade) var(--mk-ease-surface);
142
- }
143
-
144
- .mk-icon-swap {
145
- display: inline-grid;
146
- place-items: center;
147
- }
148
-
149
- .mk-icon-swap > * {
150
- grid-area: 1 / 1;
151
- transition:
152
- opacity var(--mk-dur-swap) var(--mk-ease-swap),
153
- transform var(--mk-dur-swap) var(--mk-ease-swap),
154
- filter var(--mk-dur-swap) var(--mk-ease-swap);
155
- }
156
-
157
- .mk-icon-swap > [data-mk-icon="out"] {
158
- opacity: 0;
159
- transform: scale(var(--mk-icon-scale));
160
- filter: blur(var(--mk-icon-blur));
161
- }
162
-
163
- .mk-icon-swap > [data-mk-icon="in"] {
164
- opacity: 1;
165
- transform: scale(1);
166
- filter: blur(0);
167
- }
168
-
169
- @media (max-width: 639px) {
170
- :host {
171
- --mk-composer-w: 100%;
172
- --mk-composer-r: var(--mk-r) var(--mk-r) 0 0;
173
- }
174
- }
11
+ ${baseCss()}
175
12
 
176
13
  ${islandCss()}
177
14
  ${composerCss()}
178
15
  ${marksCss()}
179
16
  ${noticeCss()}
180
17
  ${pickerCss()}
18
+ ${mockCss()}
181
19
  `.trim();
182
20
  }
183
21
  function buildOverlayCss() {
@@ -185,4 +23,4 @@ function buildOverlayCss() {
185
23
  }
186
24
  const OVERLAY_CSS = buildOverlayCss();
187
25
  //#endregion
188
- export { OVERLAY_CSS, SCHEME_ATTRIBUTE, ruleCss, tokenCss };
26
+ export { OVERLAY_CSS, SCHEME_ATTRIBUTE, ruleCss };
package/dist/tip.js CHANGED
@@ -1,4 +1,4 @@
1
- import { cx } from "./part.js";
1
+ import { cx } from "./cx.js";
2
2
  import { createElement, forwardRef, useCallback, useId, useRef } from "react";
3
3
  //#region src/tip.ts
4
4
  const GAP_PX = 6;
package/dist/tokens.js CHANGED
@@ -128,6 +128,7 @@ const MOTION_TOKENS = {
128
128
  "--mk-dur-swap": "150ms",
129
129
  "--mk-dur-mark-in": "500ms",
130
130
  "--mk-dur-fade": "150ms",
131
+ "--mk-dur-shimmer": "1100ms",
131
132
  "--mk-delay-tooltip": "80ms",
132
133
  "--mk-stagger-step": "40ms",
133
134
  "--mk-stagger-cap": "240ms",
@@ -138,7 +139,8 @@ const MOTION_TOKENS = {
138
139
  "--mk-rise-row": "6px",
139
140
  "--mk-shift-composer": "100%",
140
141
  "--mk-icon-scale": "0.25",
141
- "--mk-icon-blur": "4px"
142
+ "--mk-icon-blur": "4px",
143
+ "--mk-shimmer-sweep": "100%"
142
144
  };
143
145
  const REDUCED_MOTION_TOKENS = {
144
146
  "--mk-ease-surface": "ease-out",
@@ -153,6 +155,7 @@ const REDUCED_MOTION_TOKENS = {
153
155
  "--mk-dur-swap": "100ms",
154
156
  "--mk-dur-mark-in": "100ms",
155
157
  "--mk-dur-fade": "100ms",
158
+ "--mk-dur-shimmer": "100ms",
156
159
  "--mk-delay-tooltip": "0ms",
157
160
  "--mk-stagger-step": "0ms",
158
161
  "--mk-stagger-cap": "0ms",
@@ -163,7 +166,8 @@ const REDUCED_MOTION_TOKENS = {
163
166
  "--mk-rise-row": "0px",
164
167
  "--mk-shift-composer": "0%",
165
168
  "--mk-icon-scale": "1",
166
- "--mk-icon-blur": "0px"
169
+ "--mk-icon-blur": "0px",
170
+ "--mk-shimmer-sweep": "0%"
167
171
  };
168
172
  const RUNTIME_TOKENS = [
169
173
  "--mk-p",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maple-kit/ui",
3
- "version": "0.8.0",
3
+ "version": "0.10.0",
4
4
  "description": "Maple's composed reviewer parts: the marks, the island and the composer",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -22,18 +22,20 @@
22
22
  ],
23
23
  "exports": {
24
24
  ".": "./dist/index.js",
25
- "./maple": "./dist/maple.js",
26
25
  "./composer": "./dist/composer/index.js",
27
26
  "./icons": "./dist/icons/index.js",
28
27
  "./island": "./dist/island/index.js",
28
+ "./maple": "./dist/maple.js",
29
29
  "./marks": "./dist/marks/index.js",
30
+ "./mock": "./dist/mock/index.js",
30
31
  "./notice": "./dist/notice/index.js",
31
32
  "./picker": "./dist/picker/index.js",
32
33
  "./package.json": "./package.json"
33
34
  },
34
35
  "dependencies": {
35
- "@maple-kit/core": "0.8.0",
36
- "@maple-kit/react": "0.8.0"
36
+ "@maple-kit/core": "0.10.0",
37
+ "@maple-kit/mock": "0.10.0",
38
+ "@maple-kit/react": "0.10.0"
37
39
  },
38
40
  "peerDependencies": {
39
41
  "react": "^18.2.0 || ^19.0.0",