@alleninstitute/cortex-ui 0.1.0 → 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.
- package/README.md +101 -79
- package/dist/cjs/cortex-ui.cjs.js +3 -3
- package/dist/cjs/cui-divider.cjs.entry.js +49 -0
- package/dist/cjs/cui-icon.cjs.entry.js +100 -0
- package/dist/cjs/cui-progress.cjs.entry.js +46 -0
- package/dist/cjs/cui-tag.cjs.entry.js +4 -4
- package/dist/cjs/index-RBrlguTk.js +1565 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +4 -1
- package/dist/collection/components/cui-divider/cui-divider.css +100 -0
- package/dist/collection/components/cui-divider/cui-divider.js +150 -0
- package/dist/collection/components/cui-icon/cui-icon.css +134 -0
- package/dist/collection/components/cui-icon/cui-icon.js +239 -0
- package/dist/collection/components/cui-progress/cui-progress.css +102 -0
- package/dist/collection/components/cui-progress/cui-progress.js +187 -0
- package/dist/collection/components/cui-tag/cui-tag.css +19 -19
- package/dist/collection/components/cui-tag/cui-tag.js +5 -5
- package/dist/components/cui-divider.d.ts +11 -0
- package/dist/components/cui-divider.js +1 -0
- package/dist/components/cui-icon.d.ts +11 -0
- package/dist/components/cui-icon.js +1 -0
- package/dist/components/cui-progress.d.ts +11 -0
- package/dist/components/cui-progress.js +1 -0
- package/dist/components/cui-tag.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/cortex-ui/cortex-ui.css +1 -1
- package/dist/cortex-ui/cortex-ui.esm.js +1 -1
- package/dist/cortex-ui/p-0e66a721.entry.js +1 -0
- package/dist/cortex-ui/p-1af73c5a.entry.js +1 -0
- package/dist/cortex-ui/p-2d2004f0.entry.js +1 -0
- package/dist/cortex-ui/p-8925abbe.entry.js +1 -0
- package/dist/cortex-ui/p-BZmInLSX.js +3 -0
- package/dist/esm/cortex-ui.js +4 -4
- package/dist/esm/cui-divider.entry.js +47 -0
- package/dist/esm/cui-icon.entry.js +98 -0
- package/dist/esm/cui-progress.entry.js +44 -0
- package/dist/esm/cui-tag.entry.js +4 -4
- package/dist/esm/index-BZmInLSX.js +1557 -0
- package/dist/esm/loader.js +3 -3
- package/dist/fonts/AllenInstituteHeadline-Bold.woff2 +0 -0
- package/dist/fonts/AllenInstituteHeadline-BoldItalic.woff2 +0 -0
- package/dist/fonts/AllenInstituteHeadline-Italic.woff2 +0 -0
- package/dist/fonts/AllenInstituteHeadline-Light.woff2 +0 -0
- package/dist/fonts/AllenInstituteHeadline-LightItalic.woff2 +0 -0
- package/dist/fonts/AllenInstituteHeadline-Medium.woff2 +0 -0
- package/dist/fonts/AllenInstituteHeadline-MediumItalic.woff2 +0 -0
- package/dist/fonts/AllenInstituteHeadline-Regular.woff2 +0 -0
- package/dist/fonts/AllenInstituteHeadline-Semibold.woff2 +0 -0
- package/dist/fonts/AllenInstituteHeadline-SemiboldItalic.woff2 +0 -0
- package/dist/fonts/AllenInstituteText-Bold.woff2 +0 -0
- package/dist/fonts/AllenInstituteText-BoldItalic.woff2 +0 -0
- package/dist/fonts/AllenInstituteText-Italic.woff2 +0 -0
- package/dist/fonts/AllenInstituteText-Light.woff2 +0 -0
- package/dist/fonts/AllenInstituteText-LightItalic.woff2 +0 -0
- package/dist/fonts/AllenInstituteText-Medium.woff2 +0 -0
- package/dist/fonts/AllenInstituteText-MediumItalic.woff2 +0 -0
- package/dist/fonts/AllenInstituteText-Regular.woff2 +0 -0
- package/dist/fonts/AllenInstituteText-Semibold.woff2 +0 -0
- package/dist/fonts/AllenInstituteText-SemiboldItalic.woff2 +0 -0
- package/dist/fonts.css +186 -0
- package/dist/types/components/cui-divider/cui-divider.d.ts +38 -0
- package/dist/types/components/cui-icon/cui-icon.d.ts +76 -0
- package/dist/types/components/cui-progress/cui-progress.d.ts +40 -0
- package/dist/types/components/cui-tag/cui-tag.d.ts +1 -1
- package/dist/types/components.d.ts +343 -5
- package/dist/types/stencil-public-runtime.d.ts +11 -0
- package/package.json +31 -22
- package/dist/cjs/index-Rxdz0vyq.js +0 -1337
- package/dist/collection/stories/assets/accessibility.svg +0 -1
- package/dist/collection/stories/assets/discord.svg +0 -1
- package/dist/collection/stories/assets/github.svg +0 -1
- package/dist/collection/stories/assets/tutorials.svg +0 -1
- package/dist/collection/stories/assets/youtube.svg +0 -1
- package/dist/cortex-ui/p-054ebfa8.entry.js +0 -1
- package/dist/cortex-ui/p-C70YK15K.js +0 -2
- package/dist/esm/index-C70YK15K.js +0 -1330
package/README.md
CHANGED
|
@@ -2,7 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
A reusable web components library built with [Stencil.js](https://stenciljs.com/), documented with [Storybook](https://storybook.js.org/).
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
- **Using the library in your app?** Start with
|
|
6
|
+
[Getting Started](https://alleninstitute.github.io/cortex-ui/?path=/docs/getting-started--docs) in the deployed
|
|
7
|
+
Storybook — React, HTML/other frameworks, CDN, and AI-agent setup.
|
|
8
|
+
- **Contributing a component or a fix?** See [CONTRIBUTING.md](CONTRIBUTING.md). AI agents working in this repo should
|
|
9
|
+
read [AGENTS.md](AGENTS.md).
|
|
10
|
+
|
|
11
|
+
## Development Setup
|
|
12
|
+
|
|
13
|
+
Working on the library itself starts here; [CONTRIBUTING.md](CONTRIBUTING.md) covers the rest of the flow — adding a
|
|
14
|
+
component, the Definition of Done, commit conventions, and opening a PR.
|
|
6
15
|
|
|
7
16
|
### Prerequisites
|
|
8
17
|
|
|
@@ -100,11 +109,26 @@ component's maturity is also included in the machine-readable docs below so agen
|
|
|
100
109
|
|
|
101
110
|
## Using the Library
|
|
102
111
|
|
|
103
|
-
### Script tag
|
|
112
|
+
### Script tag (CDN, no build step)
|
|
113
|
+
|
|
114
|
+
The package is on the public npm registry, so unpkg and jsDelivr already mirror it. One module script registers every
|
|
115
|
+
component:
|
|
116
|
+
|
|
117
|
+
```html
|
|
118
|
+
<script
|
|
119
|
+
type="module"
|
|
120
|
+
src="https://unpkg.com/@alleninstitute/cortex-ui/dist/cortex-ui/cortex-ui.esm.js"
|
|
121
|
+
></script>
|
|
122
|
+
<link
|
|
123
|
+
rel="stylesheet"
|
|
124
|
+
href="https://unpkg.com/@alleninstitute/cortex-ui/dist/fonts.css"
|
|
125
|
+
/>
|
|
126
|
+
```
|
|
104
127
|
|
|
105
|
-
|
|
128
|
+
The stylesheet registers the Allen Institute typefaces — see [Fonts](#fonts).
|
|
106
129
|
|
|
107
|
-
|
|
130
|
+
Pin a version in production (`.../cortex-ui@0.2.0/dist/...`) — an unpinned URL follows the latest release. jsDelivr
|
|
131
|
+
serves the same file from `https://cdn.jsdelivr.net/npm/@alleninstitute/cortex-ui/dist/cortex-ui/cortex-ui.esm.js`.
|
|
108
132
|
|
|
109
133
|
Then use the components anywhere in your HTML:
|
|
110
134
|
|
|
@@ -128,6 +152,19 @@ import { defineCustomElements } from '@alleninstitute/cortex-ui/loader';
|
|
|
128
152
|
defineCustomElements();
|
|
129
153
|
```
|
|
130
154
|
|
|
155
|
+
#### Fonts
|
|
156
|
+
|
|
157
|
+
The package bundles the Allen Institute typefaces as WOFF2 — both families, weights 300–700, with italics. Register
|
|
158
|
+
them once, wherever the app imports its global CSS:
|
|
159
|
+
|
|
160
|
+
```js
|
|
161
|
+
import '@alleninstitute/cortex-ui/fonts.css';
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
This has to happen at the document level, because a `@font-face` rule declared inside a component's shadow DOM is
|
|
165
|
+
ignored. Once it has, every component picks the font up, since `--cui-font-family-base` already names it (with
|
|
166
|
+
`--cui-font-family-headline` available for titles). Skip the import and the tokens fall back to a system font stack.
|
|
167
|
+
|
|
131
168
|
#### TypeScript support
|
|
132
169
|
|
|
133
170
|
The package ships with full type definitions. Import the generated types:
|
|
@@ -189,11 +226,18 @@ server by hand with the MCP inspector.
|
|
|
189
226
|
|
|
190
227
|
### Machine-readable docs
|
|
191
228
|
|
|
192
|
-
Every build regenerates agent-consumable docs, which are also served from the deployed Storybook site root
|
|
229
|
+
Every build regenerates agent-consumable docs, which are also served from the deployed Storybook site root — so an
|
|
230
|
+
agent with no MCP client can just fetch them:
|
|
231
|
+
|
|
232
|
+
| File | What it is |
|
|
233
|
+
| ----------------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
|
|
234
|
+
| [llms.txt](https://alleninstitute.github.io/cortex-ui/llms.txt) | [llms.txt](https://llmstxt.org) index: one line per component, with maturity |
|
|
235
|
+
| [llms-full.txt](https://alleninstitute.github.io/cortex-ui/llms-full.txt) | Complete plain-text component API and token reference |
|
|
236
|
+
| [components.json](https://alleninstitute.github.io/cortex-ui/components.json) | Stencil docs-json component manifest |
|
|
237
|
+
| [tokens.json](https://alleninstitute.github.io/cortex-ui/tokens.json) | Structured `--cui-*` design tokens with light/dark values |
|
|
193
238
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
- `docs/tokens.json` — structured `--cui-*` design tokens with light/dark values
|
|
239
|
+
Pointing an agent at the `llms.txt` URL from your project's `AGENTS.md` / `CLAUDE.md` is usually enough to keep it from
|
|
240
|
+
inventing props.
|
|
197
241
|
|
|
198
242
|
### Storybook MCP addon
|
|
199
243
|
|
|
@@ -266,90 +310,74 @@ pnpm install
|
|
|
266
310
|
- **Types or components look stale / missing exports** — the `dist/` output is out of date. Re-run `pnpm build:all` in this repo (or use `pnpm dev:react` + `pnpm dev:stencil` to watch). Nothing works until `dist/` exists.
|
|
267
311
|
- **Do not commit the `link:` lines** in the consuming app — they only make sense on your machine. Swap back to a normal version range before committing.
|
|
268
312
|
|
|
269
|
-
##
|
|
270
|
-
|
|
271
|
-
All three packages are versioned and published **in lockstep** under a single `v<semver>` git tag. They are not
|
|
272
|
-
independently versioned: the React wrappers are generated from the Stencil build and the MCP server bundles a snapshot
|
|
273
|
-
of the generated docs, so a component change ripples through all three. `@alleninstitute/cortex-ui-react` depends on
|
|
274
|
-
`@alleninstitute/cortex-ui` via `workspace:*`, which pnpm rewrites to the exact matching version as it packs.
|
|
313
|
+
## Changelog
|
|
275
314
|
|
|
276
|
-
|
|
277
|
-
[
|
|
315
|
+
`CHANGELOG.md` is generated from [conventional commit](https://www.conventionalcommits.org) messages by
|
|
316
|
+
[git-cliff](https://git-cliff.org), configured in [cliff.toml](cliff.toml). **Commit messages are the release notes**, so
|
|
317
|
+
a sloppy subject line ships to consumers. `chore(release):` commits are skipped, and commits that aren't conventional
|
|
318
|
+
are dropped from the changelog entirely.
|
|
278
319
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
Releasing is a deliberate, manual step — merging to `main` does not publish.
|
|
282
|
-
|
|
283
|
-
1. Run the **Release** workflow (`Actions` → `Release` → `Run workflow`) from `main`. Tick **dry-run** first if you want
|
|
284
|
-
to preview the version and changelog without touching anything.
|
|
285
|
-
2. It derives the next version from the commits since the last tag, verifies the build and tests, bumps every
|
|
286
|
-
publishable `package.json`, regenerates `CHANGELOG.md`, then commits and pushes `chore(release): v<semver>` plus the
|
|
287
|
-
`v<semver>` tag.
|
|
288
|
-
3. Pushing that tag triggers the **Publish to npm** workflow, which builds all three packages, publishes them to npm
|
|
289
|
-
(root first, since the others depend on it) with [provenance](https://docs.npmjs.com/generating-provenance-statements),
|
|
290
|
-
and opens a GitHub Release with the generated notes.
|
|
291
|
-
|
|
292
|
-
To preview locally what the next release would be:
|
|
320
|
+
Storybook renders the same file as a top-level **Release Notes** page (`src/docs/ReleaseNotes.mdx`), imported raw from
|
|
321
|
+
`CHANGELOG.md` so the published docs can't drift from the repo.
|
|
293
322
|
|
|
294
323
|
```bash
|
|
295
|
-
pnpm release:version # the version git-cliff would pick
|
|
296
|
-
pnpm changelog:unreleased # the notes for the
|
|
297
|
-
pnpm changelog #
|
|
324
|
+
pnpm release:version # the version git-cliff would pick next
|
|
325
|
+
pnpm changelog:unreleased # the notes for the commits since the last tag
|
|
326
|
+
pnpm changelog # regenerate CHANGELOG.md in full
|
|
298
327
|
```
|
|
299
328
|
|
|
300
|
-
|
|
329
|
+
Versions stay pre-1.0 while components are still `experimental` / `beta`: `cliff.toml` sets
|
|
330
|
+
`breaking_always_bump_major = false`, so while the major is `0` a breaking change bumps the **minor** (`0.1.0` → `0.2.0`)
|
|
331
|
+
rather than jumping to `1.0.0`.
|
|
332
|
+
|
|
333
|
+
### Prepublish safety
|
|
301
334
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
rather than jumping to `1.0.0`. Cutting `1.0.0` is intentional — pass it via the workflow's `version` input.
|
|
335
|
+
Every publishable package runs its own build in `prepack`, so `dist/`, the generated React source, and the MCP server's
|
|
336
|
+
bundled docs snapshot can never be packed or published stale — including from a hand-run `pnpm publish`.
|
|
305
337
|
|
|
306
|
-
|
|
338
|
+
## Releasing
|
|
307
339
|
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
340
|
+
All three packages are versioned and published **in lockstep** under a single `v<semver>` git tag. They are not
|
|
341
|
+
independently versioned: the React wrappers are generated from the Stencil build and the MCP server bundles a snapshot
|
|
342
|
+
of the generated docs, so a component change ripples through all three. `@alleninstitute/cortex-ui-react` depends on
|
|
343
|
+
`@alleninstitute/cortex-ui` via `workspace:*`, which pnpm rewrites to the exact matching version as it packs.
|
|
311
344
|
|
|
312
|
-
|
|
313
|
-
exist before it can be configured — unlike PyPI, npm cannot pre-authorize a name that has never been published
|
|
314
|
-
([npm/cli#8544](https://github.com/npm/cli/issues/8544)). Each of the three packages therefore needs one manual publish
|
|
315
|
-
first:
|
|
345
|
+
Both the version and the release notes are derived from conventional commits — see [Changelog](#changelog).
|
|
316
346
|
|
|
317
|
-
|
|
318
|
-
npm login # an account with publish rights on @alleninstitute
|
|
319
|
-
pnpm build:all
|
|
320
|
-
pnpm publish --access public --no-git-checks # @alleninstitute/cortex-ui
|
|
321
|
-
pnpm --filter @alleninstitute/cortex-ui-react publish --access public --no-git-checks
|
|
322
|
-
pnpm --filter @alleninstitute/cortex-ui-mcp publish --access public --no-git-checks
|
|
323
|
-
```
|
|
347
|
+
### Cutting a release
|
|
324
348
|
|
|
325
|
-
|
|
326
|
-
and set:
|
|
349
|
+
Releasing is a deliberate, manual step — merging to `main` does not publish.
|
|
327
350
|
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
351
|
+
1. Run the **Release** workflow (`Actions` → `Release` → `Run workflow`) from `main`. It takes no inputs — the version
|
|
352
|
+
is always derived from the commits.
|
|
353
|
+
2. It works out the next version from the commits since the last tag, bumps every publishable `package.json`,
|
|
354
|
+
regenerates `CHANGELOG.md`, then commits and pushes `chore(release): v<semver>` plus the `v<semver>` tag.
|
|
355
|
+
3. Pushing that tag triggers the **Publish to npm** workflow, which builds all three packages, publishes them to npm
|
|
356
|
+
(root first, since the others depend on it), and opens a GitHub Release with the generated notes.
|
|
334
357
|
|
|
335
|
-
|
|
358
|
+
Preview what a release would produce before running it with `pnpm release:version` and `pnpm changelog:unreleased`.
|
|
336
359
|
|
|
337
|
-
|
|
360
|
+
### How publishing is authenticated
|
|
338
361
|
|
|
339
|
-
|
|
340
|
-
protected `main` branch. Same secret name and service account as the other Allen Institute repos.
|
|
362
|
+
Already configured; here for when something needs rotating.
|
|
341
363
|
|
|
342
|
-
|
|
364
|
+
- **npm** — [trusted publishing](https://docs.npmjs.com/trusted-publishers). GitHub mints a short-lived OIDC token that
|
|
365
|
+
npm exchanges for publish credentials, so **there is no `NPM_TOKEN`**. Each of the three packages has a trusted
|
|
366
|
+
publisher pointing at `AllenInstitute/cortex-ui` + `publish.yml`, with no environment. Don't add a token.
|
|
367
|
+
- **git** — `SERVICE_ACCOUNT_SSH_KEY` holds the private half of a **write-enabled deploy key** on this repo. Deploy keys
|
|
368
|
+
can't be shared between repos, so the team Bitwarden entry _"public github ssh keys for github service user"_ keeps
|
|
369
|
+
one keypair per repo named `<repo>_deploy_key`; `cortex-ui`'s lives there. It can't be `GITHUB_TOKEN` — see the
|
|
370
|
+
comment in `release.yml`.
|
|
371
|
+
- **branch rules** — `main` requires pull requests, with `DeployKey` as a bypass actor so the release commit can land.
|
|
372
|
+
This intentionally differs from other repos that bypass via the admin role: scoping it to the deploy key means humans
|
|
373
|
+
still can't push to `main`.
|
|
343
374
|
|
|
344
|
-
|
|
345
|
-
[provenance attestations require a **public source repository**](https://github.blog/changelog/2023-07-26-publishing-with-npm-provenance-from-private-source-repositories-is-no-longer-supported/) —
|
|
346
|
-
npm dropped support for private ones in 2023. `cortex-ui` is currently private, so the publish job sets
|
|
347
|
-
`NPM_CONFIG_PROVENANCE=false` and ships without attestations.
|
|
375
|
+
### Provenance
|
|
348
376
|
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
377
|
+
We don't publish provenance attestations. The publish job sets `NPM_CONFIG_PROVENANCE=false`, which is load-bearing
|
|
378
|
+
rather than cosmetic: trusted publishing **auto-enables** provenance, and
|
|
379
|
+
[provenance requires a public source repository](https://github.blog/changelog/2023-07-26-publishing-with-npm-provenance-from-private-source-repositories-is-no-longer-supported/) —
|
|
380
|
+
so on this private repo npm would turn it on and then fail the publish. Drop that line only when the repo goes public.
|
|
353
381
|
|
|
354
382
|
### If a publish fails partway
|
|
355
383
|
|
|
@@ -359,12 +387,6 @@ re-run Release**; that would only try to cut a second version. Fix the cause, th
|
|
|
359
387
|
run. The publish step skips any package whose version is already on npm, so a re-run picks up exactly the packages that
|
|
360
388
|
did not make it.
|
|
361
389
|
|
|
362
|
-
### Prepublish safety
|
|
363
|
-
|
|
364
|
-
Every package runs its own build in `prepack`, so `dist/`, the generated React source, and the MCP docs snapshot can
|
|
365
|
-
never be published stale — including from a hand-run `pnpm publish`. The publish workflow additionally runs
|
|
366
|
-
`pnpm build:all` up front so a build failure stops the release before any package reaches npm.
|
|
367
|
-
|
|
368
390
|
## Project Structure
|
|
369
391
|
|
|
370
392
|
```
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-RBrlguTk.js');
|
|
4
4
|
|
|
5
5
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
6
6
|
/*
|
|
7
|
-
Stencil Client Patch Browser v4.
|
|
7
|
+
Stencil Client Patch Browser v4.44.0 | MIT Licensed | https://stenciljs.com
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
var patchBrowser = () => {
|
|
@@ -18,7 +18,7 @@ var patchBrowser = () => {
|
|
|
18
18
|
|
|
19
19
|
patchBrowser().then(async (options) => {
|
|
20
20
|
await index.globalScripts();
|
|
21
|
-
return index.bootstrapLazy([["cui-tag.cjs",[[1,"cui-tag",{"label":[1],"variant":[1],"size":[1]}]]]], options);
|
|
21
|
+
return index.bootstrapLazy([["cui-divider.cjs",[[1,"cui-divider",{"orientation":[513],"spacing":[513],"variant":[1],"importance":[1]}]]],["cui-icon.cjs",[[257,"cui-icon",{"icon":[1],"variant":[1],"importance":[1],"size":[1],"label":[1]},null,{"icon":[{"onIconChange":0}],"label":[{"onLabelChange":0}]}]]],["cui-progress.cjs",[[1,"cui-progress",{"label":[1],"value":[2],"max":[2],"indeterminate":[4],"size":[1],"showValue":[4,"show-value"]}]]],["cui-tag.cjs",[[1,"cui-tag",{"label":[1],"variant":[1],"size":[1]}]]]], options);
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
exports.setNonce = index.setNonce;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-RBrlguTk.js');
|
|
4
|
+
|
|
5
|
+
const cuiDividerCss = () => `:host{display:block;--cui-divider-gap:var(--cui-spacing-m);margin-block:var(--cui-divider-gap)}:host([hidden]){display:none}:host([spacing=none]){--cui-divider-gap:0}:host([spacing=small]){--cui-divider-gap:var(--cui-spacing-s)}:host([spacing=large]){--cui-divider-gap:var(--cui-spacing-l)}:host([orientation=vertical]){display:inline-flex;align-self:stretch;min-height:var(--cui-spacing-l);margin-block:0;margin-inline:var(--cui-divider-gap)}.cui-divider{box-sizing:border-box;margin:0;border:none}.cui-divider--horizontal{width:100%;height:var(--cui-border-width-s)}.cui-divider--vertical{width:var(--cui-border-width-s);height:auto;align-self:stretch}.cui-divider--base{background-color:var(--cui-base-divider-primary)}.cui-divider--base.cui-divider--secondary{background-color:var(--cui-base-divider-secondary)}.cui-divider--accent{background-color:var(--cui-accent-divider-primary-default)}.cui-divider--accent.cui-divider--secondary{background-color:var(--cui-accent-divider-secondary-default)}.cui-divider--highlight{background-color:var(--cui-highlight-divider-primary-default)}.cui-divider--highlight.cui-divider--secondary{background-color:var(--cui-highlight-divider-secondary-default)}.cui-divider--info{background-color:var(--cui-info-divider-primary-default)}.cui-divider--info.cui-divider--secondary{background-color:var(--cui-info-divider-secondary-default)}.cui-divider--negative{background-color:var(--cui-negative-divider-primary-default)}.cui-divider--negative.cui-divider--secondary{background-color:var(--cui-negative-divider-secondary-default)}.cui-divider--neutral{background-color:var(--cui-neutral-divider-primary-default)}.cui-divider--neutral.cui-divider--secondary{background-color:var(--cui-neutral-divider-secondary-default)}.cui-divider--positive{background-color:var(--cui-positive-divider-primary-default)}.cui-divider--positive.cui-divider--secondary{background-color:var(--cui-positive-divider-secondary-default)}.cui-divider--warning{background-color:var(--cui-warning-divider-primary-default)}.cui-divider--warning.cui-divider--secondary{background-color:var(--cui-warning-divider-secondary-default)}`;
|
|
6
|
+
|
|
7
|
+
const CuiDivider = class {
|
|
8
|
+
constructor(hostRef) {
|
|
9
|
+
index.registerInstance(this, hostRef);
|
|
10
|
+
// `orientation` and `spacing` are reflected because they size and space the host's own
|
|
11
|
+
// box, and only an attribute can reach `:host()` from the stylesheet. `variant` and
|
|
12
|
+
// `importance` are not: they only colour the rule, which the modifier classes handle.
|
|
13
|
+
/**
|
|
14
|
+
* Which way the rule runs. A vertical divider stretches to the height of the flex row
|
|
15
|
+
* it sits in.
|
|
16
|
+
*/
|
|
17
|
+
this.orientation = 'horizontal';
|
|
18
|
+
/** Space reserved on either side of the rule, along the axis it separates. */
|
|
19
|
+
this.spacing = 'medium';
|
|
20
|
+
/**
|
|
21
|
+
* Which intent's `divider` colour the rule is drawn in. `base` is the intent-free rule for
|
|
22
|
+
* ordinary page chrome; the seven intents tint a divider that sits inside a component
|
|
23
|
+
* already carrying that intent, such as a rule between rows of a negative-intent alert.
|
|
24
|
+
*/
|
|
25
|
+
this.variant = 'base';
|
|
26
|
+
/**
|
|
27
|
+
* Which of the two `divider` importances the rule is drawn from. Match it to the importance of
|
|
28
|
+
* the surface the divider sits on — `secondary` on a quiet tint, `primary` on a saturated fill —
|
|
29
|
+
* rather than treating it as a loudness control: on a secondary surface the primary rule is the
|
|
30
|
+
* *less* perceivable of the two. For `base`, whose surface is the page itself, `primary` is
|
|
31
|
+
* simply the stronger of the two rules.
|
|
32
|
+
*/
|
|
33
|
+
this.importance = 'primary';
|
|
34
|
+
}
|
|
35
|
+
render() {
|
|
36
|
+
return (
|
|
37
|
+
// A native <hr> carries the separator role to assistive technology for free, and
|
|
38
|
+
// is the one element that means "boundary" rather than "a box that looks like one".
|
|
39
|
+
index.h("hr", { key: 'd33f3260a5f708f379428a7d338e6329248f23ff', part: "base", class: {
|
|
40
|
+
'cui-divider': true,
|
|
41
|
+
[`cui-divider--${this.orientation}`]: true,
|
|
42
|
+
[`cui-divider--${this.variant}`]: true,
|
|
43
|
+
[`cui-divider--${this.importance}`]: true,
|
|
44
|
+
}, "aria-orientation": this.orientation === 'vertical' ? 'vertical' : undefined }));
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
CuiDivider.style = cuiDividerCss();
|
|
48
|
+
|
|
49
|
+
exports.cui_divider = CuiDivider;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-RBrlguTk.js');
|
|
4
|
+
|
|
5
|
+
const cuiIconCss = () => `@charset "UTF-8";:host{display:inline-flex}:host([hidden]){display:none}.cui-icon{display:inline-flex;align-items:center;justify-content:center;line-height:1}::slotted(:not([data-cui-icon-glyph])){display:none}.cui-icon--xxs{font-size:var(--cui-icon-size, var(--cui-font-size-xxs))}.cui-icon--xs{font-size:var(--cui-icon-size, var(--cui-font-size-xs))}.cui-icon--s{font-size:var(--cui-icon-size, var(--cui-font-size-s))}.cui-icon--m{font-size:var(--cui-icon-size, var(--cui-font-size-m))}.cui-icon--l{font-size:var(--cui-icon-size, var(--cui-font-size-l))}.cui-icon--xl{font-size:var(--cui-icon-size, var(--cui-font-size-xl))}.cui-icon--xxl{font-size:var(--cui-icon-size, var(--cui-font-size-xxl))}.cui-icon--display-s{font-size:var(--cui-icon-size, var(--cui-font-size-display-s))}.cui-icon--display-m{font-size:var(--cui-icon-size, var(--cui-font-size-display-m))}.cui-icon--display-l{font-size:var(--cui-icon-size, var(--cui-font-size-display-l))}.cui-icon--base.cui-icon--primary{color:var(--cui-icon-color, var(--cui-base-text-primary))}.cui-icon--base.cui-icon--secondary{color:var(--cui-icon-color, var(--cui-base-text-secondary))}.cui-icon--accent.cui-icon--primary{color:var(--cui-icon-color, var(--cui-accent-text-primary-default))}.cui-icon--accent.cui-icon--secondary{color:var(--cui-icon-color, var(--cui-accent-text-secondary-default))}.cui-icon--highlight.cui-icon--primary{color:var(--cui-icon-color, var(--cui-highlight-text-primary-default))}.cui-icon--highlight.cui-icon--secondary{color:var(--cui-icon-color, var(--cui-highlight-text-secondary-default))}.cui-icon--info.cui-icon--primary{color:var(--cui-icon-color, var(--cui-info-text-primary-default))}.cui-icon--info.cui-icon--secondary{color:var(--cui-icon-color, var(--cui-info-text-secondary-default))}.cui-icon--negative.cui-icon--primary{color:var(--cui-icon-color, var(--cui-negative-text-primary-default))}.cui-icon--negative.cui-icon--secondary{color:var(--cui-icon-color, var(--cui-negative-text-secondary-default))}.cui-icon--neutral.cui-icon--primary{color:var(--cui-icon-color, var(--cui-neutral-text-primary-default))}.cui-icon--neutral.cui-icon--secondary{color:var(--cui-icon-color, var(--cui-neutral-text-secondary-default))}.cui-icon--positive.cui-icon--primary{color:var(--cui-icon-color, var(--cui-positive-text-primary-default))}.cui-icon--positive.cui-icon--secondary{color:var(--cui-icon-color, var(--cui-positive-text-secondary-default))}.cui-icon--warning.cui-icon--primary{color:var(--cui-icon-color, var(--cui-warning-text-primary-default))}.cui-icon--warning.cui-icon--secondary{color:var(--cui-icon-color, var(--cui-warning-text-secondary-default))}`;
|
|
6
|
+
|
|
7
|
+
const CuiIcon = class {
|
|
8
|
+
constructor(hostRef) {
|
|
9
|
+
index.registerInstance(this, hostRef);
|
|
10
|
+
/**
|
|
11
|
+
* Semantic colour set. `base` is the intent-free choice for ordinary content and is correct on
|
|
12
|
+
* a plain page background; the intents are for an icon that sits on that intent's surface.
|
|
13
|
+
* This is styling, not semantics — never let colour be the only thing conveying meaning.
|
|
14
|
+
*/
|
|
15
|
+
this.variant = 'base';
|
|
16
|
+
/**
|
|
17
|
+
* Which rung of the `text` token family to use. It tracks the surface the icon sits on:
|
|
18
|
+
* `primary` belongs on that variant's primary surface, `secondary` on its secondary surface or
|
|
19
|
+
* on a plain background. Pairing an intent's `primary` text with a plain page background is
|
|
20
|
+
* outside the token system's design and will not be legible.
|
|
21
|
+
*/
|
|
22
|
+
this.importance = 'secondary';
|
|
23
|
+
/** Size of the glyph, from the font-size token scale. */
|
|
24
|
+
this.size = 'm';
|
|
25
|
+
}
|
|
26
|
+
connectedCallback() {
|
|
27
|
+
// Both the glyph and the host's ARIA are applied here rather than from render(): the
|
|
28
|
+
// glyph has to live in the light DOM for the consumer's document-level Font Awesome CSS
|
|
29
|
+
// to match it (selectors do not cross a shadow boundary, though @font-face and custom
|
|
30
|
+
// properties do), and setting the host's ARIA imperatively keeps it out of reach of the
|
|
31
|
+
// vdom, which on first render would otherwise overwrite a <Host> attribute with the
|
|
32
|
+
// same-named host *property* whenever a consumer also wrote that attribute in markup.
|
|
33
|
+
this.syncGlyph();
|
|
34
|
+
this.syncAria();
|
|
35
|
+
}
|
|
36
|
+
onIconChange() {
|
|
37
|
+
this.syncGlyph();
|
|
38
|
+
}
|
|
39
|
+
onLabelChange() {
|
|
40
|
+
this.syncAria();
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Creates or updates the light-DOM glyph. Queries rather than caching a node reference, so it
|
|
44
|
+
* is idempotent: connectedCallback fires again every time the host is moved in the DOM, and a
|
|
45
|
+
* cached reference can also go stale (see below).
|
|
46
|
+
*/
|
|
47
|
+
syncGlyph() {
|
|
48
|
+
var _a;
|
|
49
|
+
const existing = this.el.querySelector(':scope > [data-cui-icon-glyph]');
|
|
50
|
+
// Font Awesome's SVG-and-JS build rewrites our <i> into an <svg> that it owns, and
|
|
51
|
+
// rebuilds the class list while doing so. Rewriting that node's classes would do nothing,
|
|
52
|
+
// so drop it and let Font Awesome convert a fresh <i> instead.
|
|
53
|
+
if (existing && existing.tagName !== 'I') {
|
|
54
|
+
existing.remove();
|
|
55
|
+
}
|
|
56
|
+
let glyph = this.el.querySelector(':scope > i[data-cui-icon-glyph]');
|
|
57
|
+
if (!glyph) {
|
|
58
|
+
glyph = document.createElement('i');
|
|
59
|
+
glyph.setAttribute('data-cui-icon-glyph', '');
|
|
60
|
+
// The glyph is always hidden in its own right; the host carries the accessible name.
|
|
61
|
+
glyph.setAttribute('aria-hidden', 'true');
|
|
62
|
+
this.el.appendChild(glyph);
|
|
63
|
+
}
|
|
64
|
+
glyph.className = (_a = this.icon) !== null && _a !== void 0 ? _a : '';
|
|
65
|
+
}
|
|
66
|
+
/** An icon is either named or hidden — never both, and never named with an empty string. */
|
|
67
|
+
syncAria() {
|
|
68
|
+
var _a;
|
|
69
|
+
const name = (_a = this.label) === null || _a === void 0 ? void 0 : _a.trim();
|
|
70
|
+
if (name) {
|
|
71
|
+
this.el.setAttribute('role', 'img');
|
|
72
|
+
this.el.setAttribute('aria-label', name);
|
|
73
|
+
this.el.removeAttribute('aria-hidden');
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
this.el.setAttribute('aria-hidden', 'true');
|
|
77
|
+
this.el.removeAttribute('role');
|
|
78
|
+
this.el.removeAttribute('aria-label');
|
|
79
|
+
}
|
|
80
|
+
render() {
|
|
81
|
+
return (index.h("span", { key: '76b54ef28027419bfbb5500c5cf4a88a7d01131e', part: "base", class: {
|
|
82
|
+
'cui-icon': true,
|
|
83
|
+
[`cui-icon--${this.variant}`]: true,
|
|
84
|
+
[`cui-icon--${this.importance}`]: true,
|
|
85
|
+
[`cui-icon--${this.size}`]: true,
|
|
86
|
+
} }, index.h("slot", { key: '8c4d13ffa3b1cfe3e4d7d47c29127784d62381ff' })));
|
|
87
|
+
}
|
|
88
|
+
get el() { return index.getElement(this); }
|
|
89
|
+
static get watchers() { return {
|
|
90
|
+
"icon": [{
|
|
91
|
+
"onIconChange": 0
|
|
92
|
+
}],
|
|
93
|
+
"label": [{
|
|
94
|
+
"onLabelChange": 0
|
|
95
|
+
}]
|
|
96
|
+
}; }
|
|
97
|
+
};
|
|
98
|
+
CuiIcon.style = cuiIconCss();
|
|
99
|
+
|
|
100
|
+
exports.cui_icon = CuiIcon;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-RBrlguTk.js');
|
|
4
|
+
|
|
5
|
+
const cuiProgressCss = () => `:host{display:block;--cui-progress-track-color:var(--cui-base-bg-level-2);--cui-progress-indicator-color:var(--cui-accent-surface-primary-default)}:host([hidden]){display:none}.cui-progress{font-family:var(--cui-font-family-base);display:flex;align-items:center;gap:var(--cui-spacing-s)}.cui-progress__bar{flex:1 1 auto;display:block;width:100%;border:none;-webkit-appearance:none;appearance:none;border-radius:var(--cui-border-radius-full);background-color:var(--cui-progress-track-color);box-shadow:inset 0 0 0 var(--cui-border-width-s) var(--cui-base-border-secondary)}.cui-progress__bar::-webkit-progress-bar{border-radius:var(--cui-border-radius-full);background-color:var(--cui-progress-track-color);box-shadow:inset 0 0 0 var(--cui-border-width-s) var(--cui-base-border-secondary)}.cui-progress__bar::-webkit-progress-value{border-radius:var(--cui-border-radius-full);background-color:var(--cui-progress-indicator-color);transition:width var(--cui-transition-base)}.cui-progress__bar::-moz-progress-bar{border-radius:var(--cui-border-radius-full);background-color:var(--cui-progress-indicator-color)}.cui-progress__bar:indeterminate{background-image:linear-gradient(to right, var(--cui-progress-indicator-color), var(--cui-progress-indicator-color));background-repeat:no-repeat;background-size:40% 100%;animation:cui-progress-sweep 1.5s linear infinite}.cui-progress__bar:indeterminate::-webkit-progress-bar{background-image:linear-gradient(to right, var(--cui-progress-indicator-color), var(--cui-progress-indicator-color));background-repeat:no-repeat;background-size:40% 100%;animation:cui-progress-sweep 1.5s linear infinite}.cui-progress__bar:indeterminate::-webkit-progress-value{display:none}.cui-progress__bar:indeterminate::-moz-progress-bar{background-color:transparent}.cui-progress__value{flex:0 0 auto;color:var(--cui-base-text-secondary);font-size:var(--cui-font-size-s);font-weight:var(--cui-font-weight-medium);font-variant-numeric:tabular-nums}.cui-progress--small .cui-progress__bar{height:var(--cui-spacing-xs)}.cui-progress--medium .cui-progress__bar{height:var(--cui-spacing-s)}.cui-progress--large .cui-progress__bar{height:var(--cui-spacing-m)}@keyframes cui-progress-sweep{from{background-position-x:-66.67%}to{background-position-x:166.67%}}@media (prefers-reduced-motion: reduce){.cui-progress__bar::-webkit-progress-value{transition:none}.cui-progress__bar:indeterminate{animation-duration:3s}.cui-progress__bar:indeterminate::-webkit-progress-bar{animation-duration:3s}}`;
|
|
6
|
+
|
|
7
|
+
const CuiProgress = class {
|
|
8
|
+
constructor(hostRef) {
|
|
9
|
+
index.registerInstance(this, hostRef);
|
|
10
|
+
/** How much of the task is done, clamped to the range `0`–`max`. */
|
|
11
|
+
this.value = 0;
|
|
12
|
+
/** The value that counts as complete. */
|
|
13
|
+
this.max = 100;
|
|
14
|
+
/**
|
|
15
|
+
* Animates continuously instead of showing a value. Use it only while the total amount
|
|
16
|
+
* of work is genuinely unknown — prefer a real `value` whenever the work reports one.
|
|
17
|
+
*/
|
|
18
|
+
this.indeterminate = false;
|
|
19
|
+
/** Thickness of the bar. */
|
|
20
|
+
this.size = 'medium';
|
|
21
|
+
/** Renders the completed percentage as text beside the bar. Ignored when indeterminate. */
|
|
22
|
+
this.showValue = false;
|
|
23
|
+
}
|
|
24
|
+
/** `max` is only meaningful above zero; anything else falls back to a percentage scale. */
|
|
25
|
+
get resolvedMax() {
|
|
26
|
+
return Number.isFinite(this.max) && this.max > 0 ? this.max : 100;
|
|
27
|
+
}
|
|
28
|
+
get clampedValue() {
|
|
29
|
+
if (!Number.isFinite(this.value))
|
|
30
|
+
return 0;
|
|
31
|
+
return Math.min(Math.max(this.value, 0), this.resolvedMax);
|
|
32
|
+
}
|
|
33
|
+
get percent() {
|
|
34
|
+
return (this.clampedValue / this.resolvedMax) * 100;
|
|
35
|
+
}
|
|
36
|
+
render() {
|
|
37
|
+
const { indeterminate, showValue } = this;
|
|
38
|
+
return (index.h("div", { key: '546c0fb27b6e91a1d153d01ae154c272be633b14', part: "base", class: {
|
|
39
|
+
'cui-progress': true,
|
|
40
|
+
[`cui-progress--${this.size}`]: true,
|
|
41
|
+
} }, index.h("progress", { key: '313a769b9ea6c2059816e40c744a74749a55c07b', part: "bar", class: "cui-progress__bar", "aria-label": this.label, max: this.resolvedMax, value: indeterminate ? undefined : this.clampedValue }), showValue && !indeterminate && (index.h("span", { key: '1a2edab01738734b397b426d826cfa2dcd4cf89b', part: "value", class: "cui-progress__value" }, Math.round(this.percent), "%"))));
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
CuiProgress.style = cuiProgressCss();
|
|
45
|
+
|
|
46
|
+
exports.cui_progress = CuiProgress;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-RBrlguTk.js');
|
|
4
4
|
|
|
5
|
-
const cuiTagCss = () => `:host{display:inline-block}.cui-tag{font-family:var(--cui-font-family-base);display:inline-flex;align-items:center;justify-content:center;border-radius:var(--cui-radius-
|
|
5
|
+
const cuiTagCss = () => `:host{display:inline-block}.cui-tag{font-family:var(--cui-font-family-base);display:inline-flex;align-items:center;justify-content:center;border-radius:var(--cui-border-radius-m);font-weight:var(--cui-font-weight-semibold);white-space:nowrap}.cui-tag--small{padding:var(--cui-spacing-xxs) var(--cui-spacing-s);font-size:var(--cui-font-size-xs)}.cui-tag--medium{padding:var(--cui-spacing-xs) var(--cui-spacing-m);font-size:var(--cui-font-size-s)}.cui-tag--accent{background-color:var(--cui-accent-surface-secondary-default);color:var(--cui-accent-text-secondary-default)}.cui-tag--highlight{background-color:var(--cui-highlight-surface-secondary-default);color:var(--cui-highlight-text-secondary-default)}.cui-tag--info{background-color:var(--cui-info-surface-secondary-default);color:var(--cui-info-text-secondary-default)}.cui-tag--negative{background-color:var(--cui-negative-surface-secondary-default);color:var(--cui-negative-text-secondary-default)}.cui-tag--neutral{background-color:var(--cui-neutral-surface-secondary-default);color:var(--cui-neutral-text-secondary-default)}.cui-tag--positive{background-color:var(--cui-positive-surface-secondary-default);color:var(--cui-positive-text-secondary-default)}.cui-tag--warning{background-color:var(--cui-warning-surface-secondary-default);color:var(--cui-warning-text-secondary-default)}`;
|
|
6
6
|
|
|
7
7
|
const CuiTag = class {
|
|
8
8
|
constructor(hostRef) {
|
|
9
9
|
index.registerInstance(this, hostRef);
|
|
10
10
|
this.label = '';
|
|
11
|
-
this.variant = '
|
|
11
|
+
this.variant = 'neutral';
|
|
12
12
|
this.size = 'medium';
|
|
13
13
|
}
|
|
14
14
|
render() {
|
|
15
|
-
return (index.h("span", { key: '
|
|
15
|
+
return (index.h("span", { key: '35b8ea2176d1923abcda801fee775a9cd46a2fec', class: {
|
|
16
16
|
'cui-tag': true,
|
|
17
17
|
[`cui-tag--${this.variant}`]: true,
|
|
18
18
|
[`cui-tag--${this.size}`]: true,
|