@mistriwork/kit 0.0.0-stage → 1.0.0-rc.9
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/LICENSE +21 -0
- package/README.md +16 -2
- package/dist/clientFiles.d.ts +5 -0
- package/dist/clientFiles.js +21 -0
- package/dist/shared/uiTokens.d.ts +4 -0
- package/dist/shared/uiTokens.js +132 -0
- package/mark.svg +1 -0
- package/package.json +35 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Baljinder Randhawa
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
<img src="mark.svg" alt="mistri" width="48" height="48" />
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# @mistriwork/kit
|
|
4
|
+
|
|
5
|
+
The shared React client both shells, mistri's and tablewalk's, are drawn with:
|
|
6
|
+
the walk and the address, Grid, Value, the record page, lists, filters and
|
|
7
|
+
charts. Its `dist/client` is the page the server sends.
|
|
8
|
+
|
|
9
|
+
It is a layer of [mistri](https://mistriwork.dev), published so the App
|
|
10
|
+
framework and the database browser (`tablewalk`) serve the same client. Install
|
|
11
|
+
`tablewalk` or `mistri`; this package comes with either.
|
|
12
|
+
[Source](https://github.com/rbaljinder/mistri/tree/main/packages/kit).
|
|
13
|
+
|
|
14
|
+
This package is internal plumbing for `mistri` and `tablewalk`, with no semver
|
|
15
|
+
promise to an App's author: its `exports` name each module those two import,
|
|
16
|
+
and any of them may change or go in any release. An App imports `mistri`'s
|
|
17
|
+
names (or `tablewalk`'s), never these.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ClientFiles } from '@mistriwork/engine/server/devclient.js';
|
|
2
|
+
/** The page's sources, and the workspace whose Vite serves them. */
|
|
3
|
+
export declare const KIT_CLIENT: Pick<ClientFiles, 'source' | 'workspace'>;
|
|
4
|
+
/** A product's page: the kit's sources, and `built`, the folder its own client build wrote. */
|
|
5
|
+
export declare function clientFiles(built: string): ClientFiles;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where the page every server sends comes from. The page is the kit's: its index.html, its entry (boot.js) and the
|
|
3
|
+
* shell, which start whichever product sent the page (shellStart.js). Each product builds it into its own dist/client
|
|
4
|
+
* — the database browser's with config/vite.tablewalk.config.ts, the App framework's with config/vite.mistri.config.ts, each
|
|
5
|
+
* without the other's main — and names that build with `clientFiles`; the engine serves whichever files it is handed
|
|
6
|
+
* (clientHttp.ts, devclient.ts).
|
|
7
|
+
*
|
|
8
|
+
* From source — under tsx, in a checkout — Vite serves `source` with the workspace's vite.config.ts, and watches only
|
|
9
|
+
* the workspace. Built, the page is the product's bundle; a server under tsx sends that one too when
|
|
10
|
+
* MISTRI_BUILT_CLIENT=1.
|
|
11
|
+
*/
|
|
12
|
+
import { fileURLToPath } from 'node:url';
|
|
13
|
+
/** The page's sources, and the workspace whose Vite serves them. */
|
|
14
|
+
export const KIT_CLIENT = {
|
|
15
|
+
source: fileURLToPath(new URL('./client/', import.meta.url)),
|
|
16
|
+
workspace: fileURLToPath(new URL('../../../', import.meta.url)),
|
|
17
|
+
};
|
|
18
|
+
/** A product's page: the kit's sources, and `built`, the folder its own client build wrote. */
|
|
19
|
+
export function clientFiles(built) {
|
|
20
|
+
return { ...KIT_CLIENT, built };
|
|
21
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Every token a component may name, theme roles first, then faces, corners and the sheets' own steps. */
|
|
2
|
+
export declare const UI_TOKENS: readonly string[];
|
|
3
|
+
/** The token a name was most likely meant to be: the word another system uses for it, else the nearest spelling. */
|
|
4
|
+
export declare function nearestToken(name: string): string | undefined;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The custom properties a custom component may read: `@mistriwork/mistri/ui` exports
|
|
3
|
+
* them as `tokens`, and `mistri check` holds a component's `var(--…)` to
|
|
4
|
+
* them. They are not listed by hand a second time — the theme's roles, faces
|
|
5
|
+
* and corners are read off the tables the theme wears them from
|
|
6
|
+
* (themeTokens.ts), so a role added there is a token here. Only the sheets'
|
|
7
|
+
* own steps (space, type sizes, motion, depth, the larger corners) are named below,
|
|
8
|
+
* because no theme role carries them.
|
|
9
|
+
*/
|
|
10
|
+
import { FONT_TOKENS, PALETTE_TOKENS, RADIUS_TOKENS } from '@mistriwork/engine/shared/themeTokens.js';
|
|
11
|
+
const SHEET_TOKENS = [
|
|
12
|
+
'--radius-lg',
|
|
13
|
+
'--radius-pop',
|
|
14
|
+
'--radius-panel',
|
|
15
|
+
'--radius-dialog',
|
|
16
|
+
'--radius-item',
|
|
17
|
+
'--type-ui',
|
|
18
|
+
'--type-display',
|
|
19
|
+
'--type-list-title',
|
|
20
|
+
'--type-record-title',
|
|
21
|
+
'--space-1',
|
|
22
|
+
'--space-2',
|
|
23
|
+
'--space-3',
|
|
24
|
+
'--space-4',
|
|
25
|
+
'--space-5',
|
|
26
|
+
'--space-6',
|
|
27
|
+
'--space-7',
|
|
28
|
+
'--space-8',
|
|
29
|
+
'--space-2h',
|
|
30
|
+
'--space-3h',
|
|
31
|
+
'--space-4h',
|
|
32
|
+
'--section-seam',
|
|
33
|
+
'--page-measure',
|
|
34
|
+
'--room-inset',
|
|
35
|
+
'--row-h',
|
|
36
|
+
'--text-xs',
|
|
37
|
+
'--text-sm',
|
|
38
|
+
'--text-base',
|
|
39
|
+
'--text-md',
|
|
40
|
+
'--text-lg',
|
|
41
|
+
'--text-xl',
|
|
42
|
+
'--heading-weight',
|
|
43
|
+
'--track-caps',
|
|
44
|
+
'--track-display',
|
|
45
|
+
'--track-title',
|
|
46
|
+
'--t-hover',
|
|
47
|
+
'--t-press',
|
|
48
|
+
'--t-popover',
|
|
49
|
+
'--t-panel',
|
|
50
|
+
'--ease-out',
|
|
51
|
+
'--ease-in-out',
|
|
52
|
+
'--shadow-pop',
|
|
53
|
+
'--shadow-panel',
|
|
54
|
+
'--shadow-modal',
|
|
55
|
+
'--scrim',
|
|
56
|
+
'--scrim-light',
|
|
57
|
+
'--focus-width',
|
|
58
|
+
'--focus-offset',
|
|
59
|
+
];
|
|
60
|
+
/** Every token a component may name, theme roles first, then faces, corners and the sheets' own steps. */
|
|
61
|
+
export const UI_TOKENS = [
|
|
62
|
+
...Object.values(PALETTE_TOKENS),
|
|
63
|
+
...Object.values(FONT_TOKENS),
|
|
64
|
+
...Object.values(RADIUS_TOKENS),
|
|
65
|
+
...SHEET_TOKENS,
|
|
66
|
+
];
|
|
67
|
+
/** What a reader reaches for from another system's vocabulary, and the token that says it here. */
|
|
68
|
+
const WORDS = {
|
|
69
|
+
negative: '--status-critical',
|
|
70
|
+
danger: '--status-critical',
|
|
71
|
+
error: '--status-critical',
|
|
72
|
+
destructive: '--status-critical',
|
|
73
|
+
red: '--status-critical',
|
|
74
|
+
positive: '--status-good',
|
|
75
|
+
success: '--status-good',
|
|
76
|
+
green: '--status-good',
|
|
77
|
+
warning: '--status-warning',
|
|
78
|
+
caution: '--status-warning',
|
|
79
|
+
info: '--status-info',
|
|
80
|
+
text: '--ink',
|
|
81
|
+
foreground: '--ink',
|
|
82
|
+
fg: '--ink',
|
|
83
|
+
'text-muted': '--ink-muted',
|
|
84
|
+
muted: '--ink-muted',
|
|
85
|
+
secondary: '--ink-muted',
|
|
86
|
+
subtle: '--ink-subtle',
|
|
87
|
+
background: '--ground',
|
|
88
|
+
bg: '--ground',
|
|
89
|
+
page: '--ground',
|
|
90
|
+
card: '--surface',
|
|
91
|
+
panel: '--surface',
|
|
92
|
+
border: '--line',
|
|
93
|
+
divider: '--line',
|
|
94
|
+
primary: '--accent',
|
|
95
|
+
brand: '--accent',
|
|
96
|
+
'accent-color': '--accent',
|
|
97
|
+
font: '--sans',
|
|
98
|
+
'font-family': '--sans',
|
|
99
|
+
'font-mono': '--mono',
|
|
100
|
+
'border-radius': '--radius',
|
|
101
|
+
rounded: '--radius',
|
|
102
|
+
// Renamed before 1.0, with `nav.currentInk`: words on a fill are on<Fill>.
|
|
103
|
+
'nav-current-ink': '--nav-on-current',
|
|
104
|
+
};
|
|
105
|
+
function distance(a, b) {
|
|
106
|
+
const row = Array.from({ length: b.length + 1 }, (_, i) => i);
|
|
107
|
+
for (let i = 1; i <= a.length; i++) {
|
|
108
|
+
let diagonal = row[0];
|
|
109
|
+
row[0] = i;
|
|
110
|
+
for (let j = 1; j <= b.length; j++) {
|
|
111
|
+
const above = row[j];
|
|
112
|
+
row[j] = Math.min(row[j] + 1, row[j - 1] + 1, diagonal + (a[i - 1] === b[j - 1] ? 0 : 1));
|
|
113
|
+
diagonal = above;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return row[b.length];
|
|
117
|
+
}
|
|
118
|
+
/** The token a name was most likely meant to be: the word another system uses for it, else the nearest spelling. */
|
|
119
|
+
export function nearestToken(name) {
|
|
120
|
+
const bare = name.replace(/^--/, '').toLowerCase();
|
|
121
|
+
const said = WORDS[bare];
|
|
122
|
+
if (said)
|
|
123
|
+
return said;
|
|
124
|
+
let best;
|
|
125
|
+
let bestDistance = 3;
|
|
126
|
+
for (const token of UI_TOKENS) {
|
|
127
|
+
const gap = distance(bare, token.slice(2));
|
|
128
|
+
if (gap < bestDistance)
|
|
129
|
+
[best, bestDistance] = [token, gap];
|
|
130
|
+
}
|
|
131
|
+
return best;
|
|
132
|
+
}
|
package/mark.svg
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><style>.i{fill:#1c1a17}.a{fill:#6b3fd4}@media (prefers-color-scheme:dark){.i{fill:#f2f0ec}.a{fill:#a88bff}}</style><path class="i" d="M2 4H26V18H22V10H18V28H12V10H8V28H2Z"/><rect class="a" x="20" y="20" width="10" height="8"/></svg>
|
package/package.json
CHANGED
|
@@ -1,6 +1,37 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mistriwork/kit",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.0.0-rc.9",
|
|
4
|
+
"description": "The shared React client both shells are drawn with: the walk and the address, Grid, Value, the record page, lists, filters and charts.",
|
|
5
|
+
"homepage": "https://mistriwork.dev",
|
|
6
|
+
"bugs": {
|
|
7
|
+
"url": "https://github.com/rbaljinder/mistri/issues"
|
|
8
|
+
},
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"author": "Baljinder Randhawa",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/rbaljinder/mistri.git",
|
|
14
|
+
"directory": "packages/kit"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"README.md",
|
|
19
|
+
"mark.svg",
|
|
20
|
+
"LICENSE"
|
|
21
|
+
],
|
|
22
|
+
"type": "module",
|
|
23
|
+
"exports": {
|
|
24
|
+
"./clientFiles.js": "./dist/clientFiles.js",
|
|
25
|
+
"./shared/uiTokens.js": "./dist/shared/uiTokens.js",
|
|
26
|
+
"./package.json": "./package.json"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@mistriwork/engine": "1.0.0-rc.9",
|
|
30
|
+
"@mistriwork/ui": "1.0.0-rc.9",
|
|
31
|
+
"intl-messageformat": "12.1.2",
|
|
32
|
+
"qrcode-generator": "^2.0.4"
|
|
33
|
+
},
|
|
34
|
+
"engines": {
|
|
35
|
+
"node": ">=24.22.1"
|
|
36
|
+
}
|
|
37
|
+
}
|