@coolms/ui-react 0.0.0-stage → 0.1.0-alpha.10
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.
- package/CHANGELOG.md +154 -0
- package/LICENSE +21 -0
- package/README.md +99 -2
- package/design-tokens.lock.json +47 -0
- package/dist/components/Button.d.ts +22 -0
- package/dist/components/Call.d.ts +71 -0
- package/dist/components/Collections.d.ts +64 -0
- package/dist/components/Dialogs.d.ts +48 -0
- package/dist/components/Fields.d.ts +50 -0
- package/dist/components/FilePicker.d.ts +83 -0
- package/dist/components/FileViewer.d.ts +63 -0
- package/dist/components/Icon.d.ts +19 -0
- package/dist/components/PaneToolbar.d.ts +48 -0
- package/dist/components/SignIn.d.ts +46 -0
- package/dist/components/State.d.ts +31 -0
- package/dist/components/Status.d.ts +48 -0
- package/dist/components/Structure.d.ts +48 -0
- package/dist/components/Workspace.d.ts +155 -0
- package/dist/components/internal.d.ts +9 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +1574 -0
- package/dist/server/capability.d.ts +31 -0
- package/dist/server/client-update.d.ts +13 -0
- package/dist/server/conflict.d.ts +9 -0
- package/dist/server/refusal.d.ts +21 -0
- package/dist/server/reread.d.ts +9 -0
- package/kit.contract.json +35 -0
- package/package.json +66 -4
- package/src/fonts/OFL.txt +92 -0
- package/src/fonts/inter-cyrillic.woff2 +0 -0
- package/src/fonts/inter-latin-ext.woff2 +0 -0
- package/src/fonts/inter-latin.woff2 +0 -0
- package/src/fonts/inter.css +27 -0
- package/src/kit.css +673 -0
- package/src/tokens/coolms-tokens.css +246 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a declared action comes to for this caller on this subject, as the server answered it in the subject's
|
|
3
|
+
* capabilities map (contract: server state `capability`, reactions R3 and R4). An action is offered from that answer
|
|
4
|
+
* only -- never computed from mode bits, owner, membership or role.
|
|
5
|
+
*
|
|
6
|
+
* allowed offered
|
|
7
|
+
* elevate offered locked by a client that elevates; not offered by one that never does
|
|
8
|
+
* denied not offered, or offered disabled with the server's refusal when the client shows why
|
|
9
|
+
* anything else -- a state this client does not know -- is denied, and said (R4)
|
|
10
|
+
*/
|
|
11
|
+
export type Capability = 'allowed' | 'elevate' | 'denied';
|
|
12
|
+
export interface Offer {
|
|
13
|
+
/** Whether the action is shown at all. */
|
|
14
|
+
readonly offered: boolean;
|
|
15
|
+
/** Shown, but behind elevation (only in a client that elevates). */
|
|
16
|
+
readonly locked: boolean;
|
|
17
|
+
/** Shown, but refused: the refusal in words, as the server gave it. */
|
|
18
|
+
readonly refusal?: string;
|
|
19
|
+
/** The server's answer was not one this client knows (R4): treated as denied. */
|
|
20
|
+
readonly unknown?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface OfferOptions {
|
|
23
|
+
/** Whether this client can ask for elevation (theme-admin does; a workspace client does not). */
|
|
24
|
+
readonly elevates: boolean;
|
|
25
|
+
/** Show a denied action disabled, with its refusal, instead of leaving it out. */
|
|
26
|
+
readonly showRefused?: boolean;
|
|
27
|
+
/** The server's refusal phrase for a denied action, when it gave one. */
|
|
28
|
+
readonly refusal?: string;
|
|
29
|
+
}
|
|
30
|
+
export declare function isCapability(answer: unknown): answer is Capability;
|
|
31
|
+
export declare function offerFor(answer: unknown, options: OfferOptions): Offer;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether this client's version is still supported (contract: server state `client-version`, reaction R6): a response
|
|
3
|
+
* typed /errors/client-update-required (any status), or a discovery minimumVersion above this client's version, means
|
|
4
|
+
* stop using that server and say an update is needed.
|
|
5
|
+
*/
|
|
6
|
+
export declare const CLIENT_UPDATE_REQUIRED = "/errors/client-update-required";
|
|
7
|
+
/** Compares dotted numeric versions ("1.10.2" > "1.9"); a part that is not a number counts as 0. */
|
|
8
|
+
export declare function versionBelow(version: string, minimum: string): boolean;
|
|
9
|
+
export declare function needsClientUpdate(input: {
|
|
10
|
+
readonly problemType?: string | undefined;
|
|
11
|
+
readonly minimumVersion?: string | undefined;
|
|
12
|
+
readonly version: string;
|
|
13
|
+
}): boolean;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A write that named the version it read (If-Match) and answered 412 changed nothing (contract: server state
|
|
3
|
+
* `versioned-write`, reaction R5): say so and offer to read again -- never resend the write over what changed.
|
|
4
|
+
*/
|
|
5
|
+
export interface Conflict {
|
|
6
|
+
readonly conflict: boolean;
|
|
7
|
+
readonly message?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function readConflict(status: number): Conflict;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether an action is allowed NOW is the action's own response (contract: server state `action-now`, reaction R2):
|
|
3
|
+
* a 403 stamped X-Elevation-Required asks for elevation -- a client that never elevates says it cannot do that here --
|
|
4
|
+
* and any other 403 is a refusal, quoted as the server gave it. A flag read earlier never stands in for it.
|
|
5
|
+
*/
|
|
6
|
+
export type Refusal = {
|
|
7
|
+
readonly kind: 'none';
|
|
8
|
+
} | {
|
|
9
|
+
readonly kind: 'elevation-required';
|
|
10
|
+
readonly message: string;
|
|
11
|
+
} | {
|
|
12
|
+
readonly kind: 'refused';
|
|
13
|
+
readonly message: string;
|
|
14
|
+
};
|
|
15
|
+
type HeaderSource = Headers | Readonly<Record<string, string | undefined>>;
|
|
16
|
+
/** The server's own words for a refusal: a problem+json `detail`, else its `title`. */
|
|
17
|
+
export declare function refusalText(body: unknown): string | undefined;
|
|
18
|
+
export declare function readRefusal(status: number, headers: HeaderSource | undefined, body: unknown, options: {
|
|
19
|
+
elevates: boolean;
|
|
20
|
+
}): Refusal;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Tell every useReread on the page to read again (an elevation granted or ended, a refusal answered). */
|
|
2
|
+
export declare function rereadAll(): void;
|
|
3
|
+
export interface Reread<T> {
|
|
4
|
+
readonly value: T | undefined;
|
|
5
|
+
readonly error: unknown;
|
|
6
|
+
readonly loading: boolean;
|
|
7
|
+
readonly reread: () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare function useReread<T>(read: () => Promise<T>): Reread<T>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"kit": "@coolms/ui-react",
|
|
3
|
+
"components": {
|
|
4
|
+
"button": { "implementedBy": "Button", "states": ["default", "primary", "danger", "disabled", "busy", "locked"] },
|
|
5
|
+
"text-field": { "implementedBy": "TextField", "states": ["default", "focused", "disabled", "read-only", "invalid", "pinned"] },
|
|
6
|
+
"select": { "implementedBy": "Select", "states": ["default", "disabled", "read-only", "invalid", "empty-list"] },
|
|
7
|
+
"toggle": { "implementedBy": "Toggle", "states": ["on", "off", "disabled", "read-only"] },
|
|
8
|
+
"modal": { "implementedBy": "Modal", "states": ["open", "closing", "dirty"] },
|
|
9
|
+
"confirm-dialog": { "implementedBy": "ConfirmDialog", "states": ["default", "danger", "discard-changes"] },
|
|
10
|
+
"toast": { "implementedBy": "Toast", "states": ["success", "error", "info", "with-action"] },
|
|
11
|
+
"loading": { "implementedBy": "Loading", "states": ["inline", "block"] },
|
|
12
|
+
"empty-state": { "implementedBy": "EmptyState", "states": ["default", "with-action"] },
|
|
13
|
+
"state": { "implementedBy": "State", "states": ["loading", "empty", "error", "denied", "page", "block", "inline", "with-action", "delayed"] },
|
|
14
|
+
"error-banner": { "implementedBy": "ErrorBanner", "states": ["default", "with-retry"] },
|
|
15
|
+
"page-header": { "implementedBy": "PageHeader", "states": ["default", "with-actions", "with-back-link"] },
|
|
16
|
+
"tab-strip": { "implementedBy": "TabStrip", "states": ["default", "active", "with-count"] },
|
|
17
|
+
"list": { "implementedBy": "List", "states": ["loading", "empty", "populated", "selected", "error"] },
|
|
18
|
+
"avatar": { "implementedBy": "Avatar", "states": ["picture", "initials", "presence"] },
|
|
19
|
+
"context-menu": { "implementedBy": "ContextMenu", "states": ["open", "item-danger", "item-locked", "item-refused"] }
|
|
20
|
+
},
|
|
21
|
+
"serverStates": {
|
|
22
|
+
"node-rwx": { "where": "src/server/capability.ts" },
|
|
23
|
+
"action-now": { "where": "src/server/refusal.ts" },
|
|
24
|
+
"elevation": { "where": "src/server/reread.ts" },
|
|
25
|
+
"space-writable": { "where": "src/server/reread.ts" },
|
|
26
|
+
"consent": { "where": "src/server/reread.ts" },
|
|
27
|
+
"capability": { "where": "src/server/capability.ts" },
|
|
28
|
+
"navi-offered": { "where": "src/server/reread.ts" },
|
|
29
|
+
"versioned-write": { "where": "src/server/conflict.ts" },
|
|
30
|
+
"client-version": { "where": "src/server/client-update.ts" }
|
|
31
|
+
},
|
|
32
|
+
"notOffered": {
|
|
33
|
+
"elevation-required": "this kit's clients never elevate: an `elevate` answer is not offered at all (offerFor with elevates: false)"
|
|
34
|
+
}
|
|
35
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,68 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coolms/ui-react",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0-alpha.10",
|
|
4
|
+
"description": "The CoolMS UI kit for React: the components of the CoolMS UI contract, styled by the CoolMS design tokens",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/coolms/ui-react.git"
|
|
10
|
+
},
|
|
11
|
+
"engines": {
|
|
12
|
+
"node": "^22.0.0 || ^24.0.0 || ^26.0.0"
|
|
13
|
+
},
|
|
14
|
+
"sideEffects": [
|
|
15
|
+
"*.css"
|
|
16
|
+
],
|
|
17
|
+
"main": "./dist/index.js",
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"import": "./dist/index.js"
|
|
23
|
+
},
|
|
24
|
+
"./kit.css": "./src/kit.css",
|
|
25
|
+
"./tokens.css": "./src/tokens/coolms-tokens.css",
|
|
26
|
+
"./fonts.css": "./src/fonts/inter.css"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"dist",
|
|
30
|
+
"src/kit.css",
|
|
31
|
+
"src/tokens",
|
|
32
|
+
"src/fonts",
|
|
33
|
+
"kit.contract.json",
|
|
34
|
+
"design-tokens.lock.json",
|
|
35
|
+
"CHANGELOG.md"
|
|
36
|
+
],
|
|
37
|
+
"scripts": {
|
|
38
|
+
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
39
|
+
"test": "vitest run",
|
|
40
|
+
"check": "node tools/check-kit.mjs kit.contract.json && node tools/check-kit-sources.mjs kit.contract.json",
|
|
41
|
+
"tokens:check": "node tools/tokens-lock.mjs && node tools/check-css.mjs src/tokens/coolms-tokens.css && node tools/check-css-teeth.mjs && node tools/check-css-tokens.mjs && node tools/check-breakpoints.mjs",
|
|
42
|
+
"demo": "vite --config demo/vite.config.ts",
|
|
43
|
+
"demo:build": "vite build --config demo/vite.config.ts",
|
|
44
|
+
"check:layout": "node tools/check-layout.mjs",
|
|
45
|
+
"verify": "npm run tokens:check && npm run check && npm run typecheck && npm test && npm run build && npm run check:built && npm run demo:build && npm run check:layout",
|
|
46
|
+
"build": "vite build --config vite.lib.config.ts && tsc -p tsconfig.build.json",
|
|
47
|
+
"check:built": "node tools/check-built.mjs",
|
|
48
|
+
"prepack": "npm run build"
|
|
49
|
+
},
|
|
50
|
+
"peerDependencies": {
|
|
51
|
+
"react": "^19.2.3",
|
|
52
|
+
"react-dom": "^19.2.3"
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"@testing-library/jest-dom": "6.9.1",
|
|
56
|
+
"@testing-library/react": "16.3.3",
|
|
57
|
+
"@testing-library/user-event": "14.6.7",
|
|
58
|
+
"@types/react": "19.2.18",
|
|
59
|
+
"@types/react-dom": "19.2.7",
|
|
60
|
+
"@vitejs/plugin-react": "4.7.0",
|
|
61
|
+
"jsdom": "26.1.0",
|
|
62
|
+
"react": "19.2.3",
|
|
63
|
+
"react-dom": "19.2.3",
|
|
64
|
+
"typescript": "6.0.3",
|
|
65
|
+
"vite": "6.4.5",
|
|
66
|
+
"vitest": "5.1.0"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
Copyright (c) 2016 The Inter Project Authors (https://github.com/rsms/inter)
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
This license is copied below, and is also available with a FAQ at:
|
|
5
|
+
http://scripts.sil.org/OFL
|
|
6
|
+
|
|
7
|
+
-----------------------------------------------------------
|
|
8
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
9
|
+
-----------------------------------------------------------
|
|
10
|
+
|
|
11
|
+
PREAMBLE
|
|
12
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
13
|
+
development of collaborative font projects, to support the font creation
|
|
14
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
15
|
+
open framework in which fonts may be shared and improved in partnership
|
|
16
|
+
with others.
|
|
17
|
+
|
|
18
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
19
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
20
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
21
|
+
redistributed and/or sold with any software provided that any reserved
|
|
22
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
23
|
+
however, cannot be released under any other type of license. The
|
|
24
|
+
requirement for fonts to remain under this license does not apply
|
|
25
|
+
to any document created using the fonts or their derivatives.
|
|
26
|
+
|
|
27
|
+
DEFINITIONS
|
|
28
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
29
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
30
|
+
include source files, build scripts and documentation.
|
|
31
|
+
|
|
32
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
33
|
+
copyright statement(s).
|
|
34
|
+
|
|
35
|
+
"Original Version" refers to the collection of Font Software components as
|
|
36
|
+
distributed by the Copyright Holder(s).
|
|
37
|
+
|
|
38
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
39
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
40
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
41
|
+
new environment.
|
|
42
|
+
|
|
43
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
44
|
+
writer or other person who contributed to the Font Software.
|
|
45
|
+
|
|
46
|
+
PERMISSION AND CONDITIONS
|
|
47
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
48
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
49
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
50
|
+
Software, subject to the following conditions:
|
|
51
|
+
|
|
52
|
+
1) Neither the Font Software nor any of its individual components,
|
|
53
|
+
in Original or Modified Versions, may be sold by itself.
|
|
54
|
+
|
|
55
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
56
|
+
redistributed and/or sold with any software, provided that each copy
|
|
57
|
+
contains the above copyright notice and this license. These can be
|
|
58
|
+
included either as stand-alone text files, human-readable headers or
|
|
59
|
+
in the appropriate machine-readable metadata fields within text or
|
|
60
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
61
|
+
|
|
62
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
63
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
64
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
65
|
+
presented to the users.
|
|
66
|
+
|
|
67
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
68
|
+
Software shall not be used to promote, endorse or advertise any
|
|
69
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
70
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
71
|
+
permission.
|
|
72
|
+
|
|
73
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
74
|
+
must be distributed entirely under this license, and must not be
|
|
75
|
+
distributed under any other license. The requirement for fonts to
|
|
76
|
+
remain under this license does not apply to any document created
|
|
77
|
+
using the Font Software.
|
|
78
|
+
|
|
79
|
+
TERMINATION
|
|
80
|
+
This license becomes null and void if any of the above conditions are
|
|
81
|
+
not met.
|
|
82
|
+
|
|
83
|
+
DISCLAIMER
|
|
84
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
85
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
86
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
87
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
88
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
89
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
90
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
91
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
92
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/* Inter (https://github.com/rsms/inter), SIL Open Font License 1.1: fonts/OFL.txt. One variable file per subset,
|
|
2
|
+
weights 400 to 700; a browser fetches only the subsets a page uses, by unicode-range. Subsets: Latin, Latin
|
|
3
|
+
Extended (Polish among others) and Cyrillic (Russian and Belarusian among others). */
|
|
4
|
+
@font-face {
|
|
5
|
+
font-family: 'Inter';
|
|
6
|
+
font-style: normal;
|
|
7
|
+
font-weight: 400 700;
|
|
8
|
+
font-display: swap;
|
|
9
|
+
src: url('./inter-latin.woff2') format('woff2');
|
|
10
|
+
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
|
11
|
+
}
|
|
12
|
+
@font-face {
|
|
13
|
+
font-family: 'Inter';
|
|
14
|
+
font-style: normal;
|
|
15
|
+
font-weight: 400 700;
|
|
16
|
+
font-display: swap;
|
|
17
|
+
src: url('./inter-latin-ext.woff2') format('woff2');
|
|
18
|
+
unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
|
19
|
+
}
|
|
20
|
+
@font-face {
|
|
21
|
+
font-family: 'Inter';
|
|
22
|
+
font-style: normal;
|
|
23
|
+
font-weight: 400 700;
|
|
24
|
+
font-display: swap;
|
|
25
|
+
src: url('./inter-cyrillic.woff2') format('woff2');
|
|
26
|
+
unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
|
|
27
|
+
}
|