@eworkbase/sdk 0.1.1 → 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.
@@ -0,0 +1,202 @@
1
+ /** Shared Mantine appearance for the desktop shell and isolated plugin views. */
2
+ @layer components {
3
+ .mantine-Badge-root {
4
+ width: fit-content;
5
+ height: auto;
6
+ min-height: 24px;
7
+ flex-shrink: 0;
8
+ gap: 6px;
9
+ padding: 3px 7px;
10
+ overflow: visible;
11
+ font-size: 12px;
12
+ font-weight: 600;
13
+ line-height: 16px;
14
+ letter-spacing: 0;
15
+ text-transform: none;
16
+ white-space: nowrap;
17
+ }
18
+
19
+ .mantine-Badge-label,
20
+ .mantine-Button-label,
21
+ .mantine-Tabs-tabLabel {
22
+ display: inline-flex;
23
+ align-items: center;
24
+ gap: inherit;
25
+ overflow: visible;
26
+ line-height: inherit;
27
+ }
28
+
29
+ .mantine-Badge-section { margin: 0; }
30
+ .mantine-Badge-root[data-full-width] { width: 100%; }
31
+
32
+ .mantine-Badge-label > svg,
33
+ .mantine-Button-label > svg { flex-shrink: 0; }
34
+
35
+ .mantine-Button-root,
36
+ .mantine-ActionIcon-root {
37
+ flex-shrink: 0;
38
+ font-weight: 600;
39
+ transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
40
+ }
41
+
42
+ .mantine-Button-inner,
43
+ .mantine-Button-label { gap: 6px; }
44
+
45
+ .mantine-Button-root[data-variant="default"],
46
+ .mantine-ActionIcon-root[data-variant="default"] {
47
+ border-color: var(--color-border-strong);
48
+ color: var(--color-foreground);
49
+ background: var(--color-surface);
50
+ }
51
+
52
+ .mantine-ActionIcon-root[data-variant="default"] { color: var(--color-muted); }
53
+
54
+ .workbase-brand-control[data-variant="filled"]:not(:disabled):not([data-disabled]) {
55
+ border-color: var(--color-primary-hover);
56
+ color: var(--color-primary-foreground);
57
+ }
58
+
59
+ .workbase-brand-control[data-variant="light"] {
60
+ color: var(--color-brand-deep);
61
+ background: var(--color-brand-weak);
62
+ }
63
+
64
+ .workbase-brand-control[data-variant="subtle"] { color: var(--color-brand); }
65
+
66
+ .workbase-status-teal { --workbase-status-color: var(--color-success); }
67
+ .workbase-status-orange { --workbase-status-color: var(--color-warning); }
68
+ .workbase-status-red { --workbase-status-color: var(--color-danger); }
69
+ .workbase-status-blue { --workbase-status-color: var(--color-accent); }
70
+ .workbase-status-gray { --workbase-status-color: var(--color-muted); }
71
+
72
+ .workbase-status-badge {
73
+ height: 24px;
74
+ align-self: center;
75
+ padding: 2px 8px;
76
+ border: 0;
77
+ color: var(--workbase-status-color);
78
+ background: color-mix(in srgb, var(--workbase-status-color) 8%, transparent);
79
+ font-weight: 500;
80
+ }
81
+
82
+ .workbase-status-gray { background: transparent; }
83
+
84
+ .workbase-status-badge:not(:has(.mantine-Badge-section)) .mantine-Badge-label::before {
85
+ content: "";
86
+ width: 6px;
87
+ height: 6px;
88
+ flex-shrink: 0;
89
+ border-radius: 50%;
90
+ background: currentColor;
91
+ opacity: 0.8;
92
+ }
93
+
94
+ @media (hover: hover) {
95
+ .mantine-Button-root[data-variant="default"]:hover:not(:disabled),
96
+ .mantine-ActionIcon-root[data-variant="default"]:hover:not(:disabled) {
97
+ border-color: var(--color-brand-gold);
98
+ background: var(--color-brand-weak);
99
+ }
100
+
101
+ .workbase-brand-control[data-variant="subtle"]:hover:not(:disabled) {
102
+ color: var(--color-brand-deep);
103
+ background: var(--color-brand-weak);
104
+ }
105
+ }
106
+
107
+ .mantine-Button-root:disabled,
108
+ .mantine-ActionIcon-root:disabled { opacity: 0.5; }
109
+
110
+ .mantine-Input-input {
111
+ border-color: var(--color-border-strong);
112
+ color: var(--color-foreground);
113
+ transition: border-color 150ms ease;
114
+ }
115
+
116
+ .mantine-Input-input::placeholder { color: var(--color-muted); }
117
+
118
+ .mantine-Input-input:hover:not(:disabled):not([data-error]) { border-color: var(--color-brand-gold); }
119
+
120
+ .mantine-Input-input:focus-visible:not([data-error]) {
121
+ border-color: var(--color-accent);
122
+ outline: 2px solid color-mix(in srgb, var(--color-accent) 18%, transparent);
123
+ outline-offset: 1px;
124
+ }
125
+
126
+ .mantine-Input-input:disabled { background: var(--color-surface-muted); }
127
+ .mantine-Input-input[data-error] { border-color: var(--color-danger); color: var(--color-danger); }
128
+
129
+ .mantine-InputWrapper-label { color: var(--color-foreground); }
130
+
131
+ .mantine-Combobox-dropdown { border-color: var(--color-border-strong); border-radius: 6px; }
132
+ .mantine-Combobox-option { border-radius: 4px; font-size: 14px; }
133
+ .mantine-Combobox-option[data-combobox-selected],
134
+ .mantine-Combobox-option[data-checked] { background: var(--color-brand-weak); color: var(--color-brand-deep); }
135
+
136
+ .mantine-Accordion-item { border: 0; }
137
+
138
+ .mantine-Accordion-control {
139
+ min-height: 32px;
140
+ gap: 8px;
141
+ padding: 6px 0;
142
+ color: inherit;
143
+ font-size: inherit;
144
+ font-weight: 600;
145
+ }
146
+
147
+ .mantine-Accordion-control:hover { background: var(--color-surface-raised); }
148
+
149
+ .mantine-Accordion-label {
150
+ display: flex;
151
+ min-width: 0;
152
+ align-items: center;
153
+ gap: 8px;
154
+ padding: 0;
155
+ font: inherit;
156
+ }
157
+
158
+ .mantine-Accordion-chevron { color: var(--color-muted); }
159
+ .mantine-Accordion-content { padding: 0; }
160
+
161
+ .mantine-Tabs-list { border-bottom: 1px solid var(--color-border); }
162
+ .mantine-Tabs-list::before { display: none; }
163
+
164
+ .mantine-Tabs-tab {
165
+ height: 36px;
166
+ margin-bottom: -1px;
167
+ padding: 0 12px;
168
+ border-radius: 0;
169
+ border-bottom: 2px solid transparent;
170
+ color: var(--color-muted);
171
+ font-size: 14px;
172
+ font-weight: 600;
173
+ }
174
+
175
+ .mantine-Tabs-tab[data-active] {
176
+ border-color: var(--color-primary-hover);
177
+ color: var(--color-brand-deep);
178
+ }
179
+
180
+ .mantine-Tabs-panel { margin-top: 12px; }
181
+ .mantine-Modal-title { color: var(--color-brand-deep); font-size: 18px; font-weight: 600; }
182
+ .mantine-Modal-overlay { background: rgb(0 0 0 / 45%); }
183
+ .mantine-Modal-content {
184
+ border: 1px solid var(--color-border-strong);
185
+ color: var(--color-foreground);
186
+ box-shadow: 0 18px 56px rgb(32 27 18 / 24%);
187
+ }
188
+
189
+ .mantine-Alert-root { padding: 12px; border: 1px solid color-mix(in srgb, currentColor 20%, transparent); }
190
+ .mantine-Alert-message { color: inherit; font-size: 14px; line-height: 1.5; }
191
+ .mantine-Notification-root { border: 1px solid var(--color-border); }
192
+ .mantine-Notification-title { color: var(--color-brand-deep); font-weight: 600; }
193
+ .mantine-Notification-description { color: var(--color-muted); }
194
+
195
+ .mantine-Checkbox-input:checked,
196
+ .mantine-Switch-track[data-checked] { border-color: var(--color-primary-hover); }
197
+
198
+ .mantine-UnstyledButton-root:focus-visible {
199
+ outline: 2px solid var(--color-primary-hover);
200
+ outline-offset: 2px;
201
+ }
202
+ }
@@ -0,0 +1,79 @@
1
+ //#region src/ui/theme.d.ts
2
+ /** Shared Mantine tokens for Workbase and its React plugin views; no runtime bridge dependencies. */
3
+ /** Allows the modal scroll-lock stylesheet to use the same nonce as Mantine. Call before mounting React. */
4
+ export declare function initializeWorkbaseUiStyles(): void;
5
+ /** Reads the per-document style authorization issued by the plugin asset protocol. */
6
+ export declare function getWorkbaseStyleNonce(): string;
7
+ export declare const workbaseUiTheme: {
8
+ readonly black: "#342f28";
9
+ readonly primaryColor: "workbase";
10
+ readonly primaryShade: 4;
11
+ readonly autoContrast: true;
12
+ readonly defaultRadius: "md";
13
+ readonly radius: {
14
+ readonly xs: "0.25rem";
15
+ readonly sm: "0.25rem";
16
+ readonly md: "0.375rem";
17
+ readonly lg: "0.5rem";
18
+ readonly xl: "0.75rem";
19
+ };
20
+ readonly fontFamily: "Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif";
21
+ readonly fontSizes: {
22
+ readonly xs: "0.75rem";
23
+ readonly sm: "0.875rem";
24
+ readonly md: "0.875rem";
25
+ readonly lg: "1rem";
26
+ readonly xl: "1.25rem";
27
+ };
28
+ readonly colors: {
29
+ readonly workbase: readonly ["#fffde8", "#fff7bf", "#ffef94", "#ffe76a", "#ffde39", "#ffca00", "#d5a900", "#aa8200", "#805f00", "#502e00"];
30
+ readonly gray: readonly ["#faf9f5", "#f3f2ed", "#e2dfd6", "#c9c4b8", "#aaa49a", "#756f66", "#6c675f", "#514b41", "#342f28", "#211d17"];
31
+ readonly red: readonly ["#fff4ef", "#f8ebe7", "#f7b49a", "#dc7756", "#b9360a", "#a52f09", "#902908", "#772207", "#601b06", "#491505"];
32
+ readonly teal: readonly ["#eef9f7", "#eaf5f4", "#a2d8d0", "#51aca2", "#087c75", "#076e68", "#06615b", "#05514c", "#04423e", "#033330"];
33
+ readonly orange: readonly ["#fff7e9", "#f5eee6", "#e9c98b", "#c4913d", "#9a5600", "#894d00", "#784300", "#643800", "#522e00", "#3f2300"];
34
+ readonly blue: readonly ["#f0f7ff", "#ebf3fc", "#a6ccfa", "#599be9", "#0969da", "#085ec2", "#0752aa", "#06458e", "#053974", "#042b59"];
35
+ };
36
+ readonly components: {
37
+ readonly Badge: {
38
+ readonly defaultProps: {
39
+ readonly radius: "md";
40
+ };
41
+ readonly classNames: typeof badgeClassNames;
42
+ };
43
+ readonly Button: {
44
+ readonly defaultProps: {
45
+ readonly size: "sm";
46
+ };
47
+ readonly classNames: typeof brandClassNames;
48
+ };
49
+ readonly ActionIcon: {
50
+ readonly classNames: typeof brandClassNames;
51
+ };
52
+ readonly Accordion: {
53
+ readonly defaultProps: {
54
+ readonly chevronSize: 14;
55
+ };
56
+ };
57
+ readonly Modal: {
58
+ readonly defaultProps: {
59
+ readonly radius: "xl";
60
+ };
61
+ };
62
+ };
63
+ readonly headings: {
64
+ readonly fontWeight: "600";
65
+ };
66
+ readonly respectReducedMotion: true;
67
+ };
68
+ declare function brandClassNames(_theme: unknown, { color }: {
69
+ readonly color?: string;
70
+ }): {
71
+ root: string | undefined;
72
+ };
73
+ declare function badgeClassNames(theme: unknown, props: {
74
+ readonly color?: string;
75
+ readonly variant?: string;
76
+ }): {
77
+ root: string | undefined;
78
+ };
79
+ //#endregion
@@ -0,0 +1,137 @@
1
+ //#region src/ui/theme.ts
2
+ /** Shared Mantine tokens for Workbase and its React plugin views; no runtime bridge dependencies. */
3
+ /** Allows the modal scroll-lock stylesheet to use the same nonce as Mantine. Call before mounting React. */
4
+ function initializeWorkbaseUiStyles() {
5
+ Object.assign(window, { __webpack_nonce__: getWorkbaseStyleNonce() });
6
+ }
7
+ /** Reads the per-document style authorization issued by the plugin asset protocol. */
8
+ function getWorkbaseStyleNonce() {
9
+ return document.querySelector("meta[name=\"workbase-style-nonce\"]")?.content ?? "";
10
+ }
11
+ const workbaseUiTheme = {
12
+ black: "#342f28",
13
+ primaryColor: "workbase",
14
+ primaryShade: 4,
15
+ autoContrast: true,
16
+ defaultRadius: "md",
17
+ radius: {
18
+ xs: "0.25rem",
19
+ sm: "0.25rem",
20
+ md: "0.375rem",
21
+ lg: "0.5rem",
22
+ xl: "0.75rem"
23
+ },
24
+ fontFamily: "Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif",
25
+ fontSizes: {
26
+ xs: "0.75rem",
27
+ sm: "0.875rem",
28
+ md: "0.875rem",
29
+ lg: "1rem",
30
+ xl: "1.25rem"
31
+ },
32
+ colors: {
33
+ workbase: [
34
+ "#fffde8",
35
+ "#fff7bf",
36
+ "#ffef94",
37
+ "#ffe76a",
38
+ "#ffde39",
39
+ "#ffca00",
40
+ "#d5a900",
41
+ "#aa8200",
42
+ "#805f00",
43
+ "#502e00"
44
+ ],
45
+ gray: [
46
+ "#faf9f5",
47
+ "#f3f2ed",
48
+ "#e2dfd6",
49
+ "#c9c4b8",
50
+ "#aaa49a",
51
+ "#756f66",
52
+ "#6c675f",
53
+ "#514b41",
54
+ "#342f28",
55
+ "#211d17"
56
+ ],
57
+ red: [
58
+ "#fff4ef",
59
+ "#f8ebe7",
60
+ "#f7b49a",
61
+ "#dc7756",
62
+ "#b9360a",
63
+ "#a52f09",
64
+ "#902908",
65
+ "#772207",
66
+ "#601b06",
67
+ "#491505"
68
+ ],
69
+ teal: [
70
+ "#eef9f7",
71
+ "#eaf5f4",
72
+ "#a2d8d0",
73
+ "#51aca2",
74
+ "#087c75",
75
+ "#076e68",
76
+ "#06615b",
77
+ "#05514c",
78
+ "#04423e",
79
+ "#033330"
80
+ ],
81
+ orange: [
82
+ "#fff7e9",
83
+ "#f5eee6",
84
+ "#e9c98b",
85
+ "#c4913d",
86
+ "#9a5600",
87
+ "#894d00",
88
+ "#784300",
89
+ "#643800",
90
+ "#522e00",
91
+ "#3f2300"
92
+ ],
93
+ blue: [
94
+ "#f0f7ff",
95
+ "#ebf3fc",
96
+ "#a6ccfa",
97
+ "#599be9",
98
+ "#0969da",
99
+ "#085ec2",
100
+ "#0752aa",
101
+ "#06458e",
102
+ "#053974",
103
+ "#042b59"
104
+ ]
105
+ },
106
+ components: {
107
+ Badge: {
108
+ defaultProps: { radius: "md" },
109
+ classNames: badgeClassNames
110
+ },
111
+ Button: {
112
+ defaultProps: { size: "sm" },
113
+ classNames: brandClassNames
114
+ },
115
+ ActionIcon: { classNames: brandClassNames },
116
+ Accordion: { defaultProps: { chevronSize: 14 } },
117
+ Modal: { defaultProps: { radius: "xl" } }
118
+ },
119
+ headings: { fontWeight: "600" },
120
+ respectReducedMotion: true
121
+ };
122
+ function brandClassNames(_theme, { color }) {
123
+ return { root: !color || color === "workbase" ? "workbase-brand-control" : void 0 };
124
+ }
125
+ function badgeClassNames(theme, props) {
126
+ const { color, variant } = props;
127
+ if (variant === "light" && color && [
128
+ "teal",
129
+ "orange",
130
+ "red",
131
+ "blue",
132
+ "gray"
133
+ ].includes(color)) return { root: `workbase-status-badge workbase-status-${color}` };
134
+ return brandClassNames(theme, props);
135
+ }
136
+ //#endregion
137
+ export { getWorkbaseStyleNonce, initializeWorkbaseUiStyles, workbaseUiTheme };
package/package.json CHANGED
@@ -1,34 +1,51 @@
1
1
  {
2
2
  "name": "@eworkbase/sdk",
3
- "version": "0.1.1",
4
- "description": "Typed backend and browser APIs for independently developed Workbase plugins.",
3
+ "version": "0.3.0",
5
4
  "type": "module",
6
5
  "exports": {
7
6
  ".": {
8
- "types": "./index.d.ts",
9
- "import": "./index.js"
7
+ "types": "./dist/index.d.ts",
8
+ "import": "./dist/index.js"
10
9
  },
11
10
  "./ui": {
12
- "types": "./ui/index.d.ts",
13
- "import": "./ui/index.js"
11
+ "types": "./dist/ui/index.d.ts",
12
+ "import": "./dist/ui/index.js"
14
13
  },
15
14
  "./ui/index.css": {
16
- "types": "./ui/index.css.d.ts",
17
- "default": "./ui/index.css"
15
+ "types": "./dist/ui/index.css.d.ts",
16
+ "default": "./dist/ui/index.css"
18
17
  },
19
18
  "./ui/model": {
20
- "types": "./ui/model.d.ts",
21
- "import": "./ui/model.js"
22
- }
19
+ "types": "./dist/ui/model.d.ts",
20
+ "import": "./dist/ui/model.js"
21
+ },
22
+ "./ui/theme": {
23
+ "types": "./dist/ui/theme.d.ts",
24
+ "import": "./dist/ui/theme.js"
25
+ },
26
+ "./ui/theme.css": "./dist/ui/theme.css"
23
27
  },
24
28
  "engines": {
25
29
  "node": ">=22"
26
30
  },
27
31
  "dependencies": {
28
32
  "penpal": "^7.0.0",
29
- "zod": "^4.3.6"
33
+ "zod": "^4.6.5"
30
34
  },
31
35
  "publishConfig": {
32
36
  "access": "public"
37
+ },
38
+ "files": [
39
+ "dist"
40
+ ],
41
+ "devDependencies": {
42
+ "@types/node": "^24.0.3",
43
+ "tsdown": "0.23.0",
44
+ "typescript": "^5.8.3"
45
+ },
46
+ "scripts": {
47
+ "build": "tsdown",
48
+ "typecheck": "tsc -p tsconfig.json --noEmit",
49
+ "pack:local": "pnpm build && pnpm pack"
33
50
  }
34
- }
51
+ }