[ui] Domi UI: vendor @domi/ui v1.0.2 (domi-design tools/vendor.mjs, MPL-2.0, unedited)
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
# Changelog
|
||||
|
||||
## 1.0.2 (2026-11-22)
|
||||
|
||||
- Licensed under the Mozilla Public License 2.0 (was unlicensed), so a public Domi app may carry a copy (Mark allowed
|
||||
it for Rosea). `LICENSE` and `CHANGELOG.md` ship with the package; INTEGRATE.md gains "Vendoring". No code or
|
||||
visual change.
|
||||
|
||||
## 1.0.1 (2026-11-22)
|
||||
|
||||
- Fix: the primary leaf's hover gradient lightened every stop by mixing in white, which dropped a white label below
|
||||
4.5:1 on the top stop (Arena Domi 3.94:1; also Atrium Domi, Liber, Calenda and other white-label leaves). The hover
|
||||
stops are now computed per app and theme in the token build (`--domi-leaf-hover-hi|mid|lo-<app>`), keep the
|
||||
1.0.0 mix where the label still reads, and are checked to 4.5:1 like the resting stops. Leaves with a dark label
|
||||
look exactly as before. Reported by the Arena Domi session.
|
||||
|
||||
## 1.0.0 (2026-11-22)
|
||||
|
||||
First release.
|
||||
|
||||
- Audit of every Domi app's styles (docs/AUDIT.md, audit/raw.json).
|
||||
- Palette of 29 apps by role, from their code (Arena Domi: a proposed teal, it has no code yet); shared dark theme (ink) and a new light theme (parchment) with every
|
||||
accent derived to WCAG AA; rooms keep each app's own dark ground. CSS, JSON, WPF XAML; PALETTE.md with contrast.
|
||||
- Foundation tokens: type (Cinzel, Cormorant Garamond, Manrope from npm), space, radius, sizes with a 48 dp touch
|
||||
floor, motion with reduced motion.
|
||||
- Components (Svelte 5 and plain CSS): Button (plate, primary leaf, quiet, danger, armed confirm; loading, success,
|
||||
error; glint, press sink, seal impression; keyboard press), TextField with the integrated send seal (send, search,
|
||||
save, next; single and multi-line; sending, sent, error; Enter and Shift+Enter; soft keyboard rule), Checkbox,
|
||||
Radio, Switch, Select, Segmented, Icon.
|
||||
- Legacy aliases per app (`@domi/ui/legacy/<app>.css`) and MIGRATION.md.
|
||||
- Showcase; unit tests; screenshot tests per component and state (baselines attached to the release).
|
||||
|
||||
Not in 1.0: the desktop window frame (`.win`, `WindowFrame.svelte`), dialogs, menus, non-text inputs (number
|
||||
stepper, date, colour).
|
||||
@@ -0,0 +1,373 @@
|
||||
Mozilla Public License Version 2.0
|
||||
==================================
|
||||
|
||||
1. Definitions
|
||||
--------------
|
||||
|
||||
1.1. "Contributor"
|
||||
means each individual or legal entity that creates, contributes to
|
||||
the creation of, or owns Covered Software.
|
||||
|
||||
1.2. "Contributor Version"
|
||||
means the combination of the Contributions of others (if any) used
|
||||
by a Contributor and that particular Contributor's Contribution.
|
||||
|
||||
1.3. "Contribution"
|
||||
means Covered Software of a particular Contributor.
|
||||
|
||||
1.4. "Covered Software"
|
||||
means Source Code Form to which the initial Contributor has attached
|
||||
the notice in Exhibit A, the Executable Form of such Source Code
|
||||
Form, and Modifications of such Source Code Form, in each case
|
||||
including portions thereof.
|
||||
|
||||
1.5. "Incompatible With Secondary Licenses"
|
||||
means
|
||||
|
||||
(a) that the initial Contributor has attached the notice described
|
||||
in Exhibit B to the Covered Software; or
|
||||
|
||||
(b) that the Covered Software was made available under the terms of
|
||||
version 1.1 or earlier of the License, but not also under the
|
||||
terms of a Secondary License.
|
||||
|
||||
1.6. "Executable Form"
|
||||
means any form of the work other than Source Code Form.
|
||||
|
||||
1.7. "Larger Work"
|
||||
means a work that combines Covered Software with other material, in
|
||||
a separate file or files, that is not Covered Software.
|
||||
|
||||
1.8. "License"
|
||||
means this document.
|
||||
|
||||
1.9. "Licensable"
|
||||
means having the right to grant, to the maximum extent possible,
|
||||
whether at the time of the initial grant or subsequently, any and
|
||||
all of the rights conveyed by this License.
|
||||
|
||||
1.10. "Modifications"
|
||||
means any of the following:
|
||||
|
||||
(a) any file in Source Code Form that results from an addition to,
|
||||
deletion from, or modification of the contents of Covered
|
||||
Software; or
|
||||
|
||||
(b) any new file in Source Code Form that contains any Covered
|
||||
Software.
|
||||
|
||||
1.11. "Patent Claims" of a Contributor
|
||||
means any patent claim(s), including without limitation, method,
|
||||
process, and apparatus claims, in any patent Licensable by such
|
||||
Contributor that would be infringed, but for the grant of the
|
||||
License, by the making, using, selling, offering for sale, having
|
||||
made, import, or transfer of either its Contributions or its
|
||||
Contributor Version.
|
||||
|
||||
1.12. "Secondary License"
|
||||
means either the GNU General Public License, Version 2.0, the GNU
|
||||
Lesser General Public License, Version 2.1, the GNU Affero General
|
||||
Public License, Version 3.0, or any later versions of those
|
||||
licenses.
|
||||
|
||||
1.13. "Source Code Form"
|
||||
means the form of the work preferred for making modifications.
|
||||
|
||||
1.14. "You" (or "Your")
|
||||
means an individual or a legal entity exercising rights under this
|
||||
License. For legal entities, "You" includes any entity that
|
||||
controls, is controlled by, or is under common control with You. For
|
||||
purposes of this definition, "control" means (a) the power, direct
|
||||
or indirect, to cause the direction or management of such entity,
|
||||
whether by contract or otherwise, or (b) ownership of more than
|
||||
fifty percent (50%) of the outstanding shares or beneficial
|
||||
ownership of such entity.
|
||||
|
||||
2. License Grants and Conditions
|
||||
--------------------------------
|
||||
|
||||
2.1. Grants
|
||||
|
||||
Each Contributor hereby grants You a world-wide, royalty-free,
|
||||
non-exclusive license:
|
||||
|
||||
(a) under intellectual property rights (other than patent or trademark)
|
||||
Licensable by such Contributor to use, reproduce, make available,
|
||||
modify, display, perform, distribute, and otherwise exploit its
|
||||
Contributions, either on an unmodified basis, with Modifications, or
|
||||
as part of a Larger Work; and
|
||||
|
||||
(b) under Patent Claims of such Contributor to make, use, sell, offer
|
||||
for sale, have made, import, and otherwise transfer either its
|
||||
Contributions or its Contributor Version.
|
||||
|
||||
2.2. Effective Date
|
||||
|
||||
The licenses granted in Section 2.1 with respect to any Contribution
|
||||
become effective for each Contribution on the date the Contributor first
|
||||
distributes such Contribution.
|
||||
|
||||
2.3. Limitations on Grant Scope
|
||||
|
||||
The licenses granted in this Section 2 are the only rights granted under
|
||||
this License. No additional rights or licenses will be implied from the
|
||||
distribution or licensing of Covered Software under this License.
|
||||
Notwithstanding Section 2.1(b) above, no patent license is granted by a
|
||||
Contributor:
|
||||
|
||||
(a) for any code that a Contributor has removed from Covered Software;
|
||||
or
|
||||
|
||||
(b) for infringements caused by: (i) Your and any other third party's
|
||||
modifications of Covered Software, or (ii) the combination of its
|
||||
Contributions with other software (except as part of its Contributor
|
||||
Version); or
|
||||
|
||||
(c) under Patent Claims infringed by Covered Software in the absence of
|
||||
its Contributions.
|
||||
|
||||
This License does not grant any rights in the trademarks, service marks,
|
||||
or logos of any Contributor (except as may be necessary to comply with
|
||||
the notice requirements in Section 3.4).
|
||||
|
||||
2.4. Subsequent Licenses
|
||||
|
||||
No Contributor makes additional grants as a result of Your choice to
|
||||
distribute the Covered Software under a subsequent version of this
|
||||
License (see Section 10.2) or under the terms of a Secondary License (if
|
||||
permitted under the terms of Section 3.3).
|
||||
|
||||
2.5. Representation
|
||||
|
||||
Each Contributor represents that the Contributor believes its
|
||||
Contributions are its original creation(s) or it has sufficient rights
|
||||
to grant the rights to its Contributions conveyed by this License.
|
||||
|
||||
2.6. Fair Use
|
||||
|
||||
This License is not intended to limit any rights You have under
|
||||
applicable copyright doctrines of fair use, fair dealing, or other
|
||||
equivalents.
|
||||
|
||||
2.7. Conditions
|
||||
|
||||
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
|
||||
in Section 2.1.
|
||||
|
||||
3. Responsibilities
|
||||
-------------------
|
||||
|
||||
3.1. Distribution of Source Form
|
||||
|
||||
All distribution of Covered Software in Source Code Form, including any
|
||||
Modifications that You create or to which You contribute, must be under
|
||||
the terms of this License. You must inform recipients that the Source
|
||||
Code Form of the Covered Software is governed by the terms of this
|
||||
License, and how they can obtain a copy of this License. You may not
|
||||
attempt to alter or restrict the recipients' rights in the Source Code
|
||||
Form.
|
||||
|
||||
3.2. Distribution of Executable Form
|
||||
|
||||
If You distribute Covered Software in Executable Form then:
|
||||
|
||||
(a) such Covered Software must also be made available in Source Code
|
||||
Form, as described in Section 3.1, and You must inform recipients of
|
||||
the Executable Form how they can obtain a copy of such Source Code
|
||||
Form by reasonable means in a timely manner, at a charge no more
|
||||
than the cost of distribution to the recipient; and
|
||||
|
||||
(b) You may distribute such Executable Form under the terms of this
|
||||
License, or sublicense it under different terms, provided that the
|
||||
license for the Executable Form does not attempt to limit or alter
|
||||
the recipients' rights in the Source Code Form under this License.
|
||||
|
||||
3.3. Distribution of a Larger Work
|
||||
|
||||
You may create and distribute a Larger Work under terms of Your choice,
|
||||
provided that You also comply with the requirements of this License for
|
||||
the Covered Software. If the Larger Work is a combination of Covered
|
||||
Software with a work governed by one or more Secondary Licenses, and the
|
||||
Covered Software is not Incompatible With Secondary Licenses, this
|
||||
License permits You to additionally distribute such Covered Software
|
||||
under the terms of such Secondary License(s), so that the recipient of
|
||||
the Larger Work may, at their option, further distribute the Covered
|
||||
Software under the terms of either this License or such Secondary
|
||||
License(s).
|
||||
|
||||
3.4. Notices
|
||||
|
||||
You may not remove or alter the substance of any license notices
|
||||
(including copyright notices, patent notices, disclaimers of warranty,
|
||||
or limitations of liability) contained within the Source Code Form of
|
||||
the Covered Software, except that You may alter any license notices to
|
||||
the extent required to remedy known factual inaccuracies.
|
||||
|
||||
3.5. Application of Additional Terms
|
||||
|
||||
You may choose to offer, and to charge a fee for, warranty, support,
|
||||
indemnity or liability obligations to one or more recipients of Covered
|
||||
Software. However, You may do so only on Your own behalf, and not on
|
||||
behalf of any Contributor. You must make it absolutely clear that any
|
||||
such warranty, support, indemnity, or liability obligation is offered by
|
||||
You alone, and You hereby agree to indemnify every Contributor for any
|
||||
liability incurred by such Contributor as a result of warranty, support,
|
||||
indemnity or liability terms You offer. You may include additional
|
||||
disclaimers of warranty and limitations of liability specific to any
|
||||
jurisdiction.
|
||||
|
||||
4. Inability to Comply Due to Statute or Regulation
|
||||
---------------------------------------------------
|
||||
|
||||
If it is impossible for You to comply with any of the terms of this
|
||||
License with respect to some or all of the Covered Software due to
|
||||
statute, judicial order, or regulation then You must: (a) comply with
|
||||
the terms of this License to the maximum extent possible; and (b)
|
||||
describe the limitations and the code they affect. Such description must
|
||||
be placed in a text file included with all distributions of the Covered
|
||||
Software under this License. Except to the extent prohibited by statute
|
||||
or regulation, such description must be sufficiently detailed for a
|
||||
recipient of ordinary skill to be able to understand it.
|
||||
|
||||
5. Termination
|
||||
--------------
|
||||
|
||||
5.1. The rights granted under this License will terminate automatically
|
||||
if You fail to comply with any of its terms. However, if You become
|
||||
compliant, then the rights granted under this License from a particular
|
||||
Contributor are reinstated (a) provisionally, unless and until such
|
||||
Contributor explicitly and finally terminates Your grants, and (b) on an
|
||||
ongoing basis, if such Contributor fails to notify You of the
|
||||
non-compliance by some reasonable means prior to 60 days after You have
|
||||
come back into compliance. Moreover, Your grants from a particular
|
||||
Contributor are reinstated on an ongoing basis if such Contributor
|
||||
notifies You of the non-compliance by some reasonable means, this is the
|
||||
first time You have received notice of non-compliance with this License
|
||||
from such Contributor, and You become compliant prior to 30 days after
|
||||
Your receipt of the notice.
|
||||
|
||||
5.2. If You initiate litigation against any entity by asserting a patent
|
||||
infringement claim (excluding declaratory judgment actions,
|
||||
counter-claims, and cross-claims) alleging that a Contributor Version
|
||||
directly or indirectly infringes any patent, then the rights granted to
|
||||
You by any and all Contributors for the Covered Software under Section
|
||||
2.1 of this License shall terminate.
|
||||
|
||||
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
|
||||
end user license agreements (excluding distributors and resellers) which
|
||||
have been validly granted by You or Your distributors under this License
|
||||
prior to termination shall survive termination.
|
||||
|
||||
************************************************************************
|
||||
* *
|
||||
* 6. Disclaimer of Warranty *
|
||||
* ------------------------- *
|
||||
* *
|
||||
* Covered Software is provided under this License on an "as is" *
|
||||
* basis, without warranty of any kind, either expressed, implied, or *
|
||||
* statutory, including, without limitation, warranties that the *
|
||||
* Covered Software is free of defects, merchantable, fit for a *
|
||||
* particular purpose or non-infringing. The entire risk as to the *
|
||||
* quality and performance of the Covered Software is with You. *
|
||||
* Should any Covered Software prove defective in any respect, You *
|
||||
* (not any Contributor) assume the cost of any necessary servicing, *
|
||||
* repair, or correction. This disclaimer of warranty constitutes an *
|
||||
* essential part of this License. No use of any Covered Software is *
|
||||
* authorized under this License except under this disclaimer. *
|
||||
* *
|
||||
************************************************************************
|
||||
|
||||
************************************************************************
|
||||
* *
|
||||
* 7. Limitation of Liability *
|
||||
* -------------------------- *
|
||||
* *
|
||||
* Under no circumstances and under no legal theory, whether tort *
|
||||
* (including negligence), contract, or otherwise, shall any *
|
||||
* Contributor, or anyone who distributes Covered Software as *
|
||||
* permitted above, be liable to You for any direct, indirect, *
|
||||
* special, incidental, or consequential damages of any character *
|
||||
* including, without limitation, damages for lost profits, loss of *
|
||||
* goodwill, work stoppage, computer failure or malfunction, or any *
|
||||
* and all other commercial damages or losses, even if such party *
|
||||
* shall have been informed of the possibility of such damages. This *
|
||||
* limitation of liability shall not apply to liability for death or *
|
||||
* personal injury resulting from such party's negligence to the *
|
||||
* extent applicable law prohibits such limitation. Some *
|
||||
* jurisdictions do not allow the exclusion or limitation of *
|
||||
* incidental or consequential damages, so this exclusion and *
|
||||
* limitation may not apply to You. *
|
||||
* *
|
||||
************************************************************************
|
||||
|
||||
8. Litigation
|
||||
-------------
|
||||
|
||||
Any litigation relating to this License may be brought only in the
|
||||
courts of a jurisdiction where the defendant maintains its principal
|
||||
place of business and such litigation shall be governed by laws of that
|
||||
jurisdiction, without reference to its conflict-of-law provisions.
|
||||
Nothing in this Section shall prevent a party's ability to bring
|
||||
cross-claims or counter-claims.
|
||||
|
||||
9. Miscellaneous
|
||||
----------------
|
||||
|
||||
This License represents the complete agreement concerning the subject
|
||||
matter hereof. If any provision of this License is held to be
|
||||
unenforceable, such provision shall be reformed only to the extent
|
||||
necessary to make it enforceable. Any law or regulation which provides
|
||||
that the language of a contract shall be construed against the drafter
|
||||
shall not be used to construe this License against a Contributor.
|
||||
|
||||
10. Versions of the License
|
||||
---------------------------
|
||||
|
||||
10.1. New Versions
|
||||
|
||||
Mozilla Foundation is the license steward. Except as provided in Section
|
||||
10.3, no one other than the license steward has the right to modify or
|
||||
publish new versions of this License. Each version will be given a
|
||||
distinguishing version number.
|
||||
|
||||
10.2. Effect of New Versions
|
||||
|
||||
You may distribute the Covered Software under the terms of the version
|
||||
of the License under which You originally received the Covered Software,
|
||||
or under the terms of any subsequent version published by the license
|
||||
steward.
|
||||
|
||||
10.3. Modified Versions
|
||||
|
||||
If you create software not governed by this License, and you want to
|
||||
create a new license for such software, you may create and use a
|
||||
modified version of this License if you rename the license and remove
|
||||
any references to the name of the license steward (except to note that
|
||||
such modified license differs from this License).
|
||||
|
||||
10.4. Distributing Source Code Form that is Incompatible With Secondary
|
||||
Licenses
|
||||
|
||||
If You choose to distribute Source Code Form that is Incompatible With
|
||||
Secondary Licenses under the terms of this version of the License, the
|
||||
notice described in Exhibit B of this License must be attached.
|
||||
|
||||
Exhibit A - Source Code Form License Notice
|
||||
-------------------------------------------
|
||||
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
If it is not possible or desirable to put the notice in a particular
|
||||
file, then You may include the notice in a location (such as a LICENSE
|
||||
file in a relevant directory) where a recipient would be likely to look
|
||||
for such a notice.
|
||||
|
||||
You may add additional accurate notices of copyright ownership.
|
||||
|
||||
Exhibit B - "Incompatible With Secondary Licenses" Notice
|
||||
---------------------------------------------------------
|
||||
|
||||
This Source Code Form is "Incompatible With Secondary Licenses", as
|
||||
defined by the Mozilla Public License, v. 2.0.
|
||||
@@ -0,0 +1 @@
|
||||
v1.0.2
|
||||
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"name": "@domi/ui",
|
||||
"version": "1.0.2",
|
||||
"description": "The Domi design system: tokens for every Domi app, struck buttons and fields with an integrated send button, Svelte 5 components. Vendored copy of v1.0.2: do not edit here; change domi-design and vendor the next tag.",
|
||||
"license": "MPL-2.0",
|
||||
"type": "module",
|
||||
"svelte": "./src/index.ts",
|
||||
"types": "./src/index.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./src/index.ts",
|
||||
"svelte": "./src/index.ts",
|
||||
"default": "./src/index.ts"
|
||||
},
|
||||
"./tokens": {
|
||||
"types": "./src/tokens/generated.ts",
|
||||
"default": "./src/tokens/generated.ts"
|
||||
},
|
||||
"./domi.css": "./src/css/domi.css",
|
||||
"./tokens.css": "./src/css/tokens.css",
|
||||
"./base.css": "./src/css/base.css",
|
||||
"./components.css": "./src/css/components.css",
|
||||
"./fonts.css": "./src/css/fonts.css",
|
||||
"./legacy/*": "./src/css/legacy/*"
|
||||
},
|
||||
"sideEffects": [
|
||||
"**/*.css"
|
||||
],
|
||||
"peerDependencies": {
|
||||
"svelte": "^5.20.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@fontsource-variable/cinzel": "5.3.0",
|
||||
"@fontsource-variable/cormorant-garamond": "5.3.0",
|
||||
"@fontsource-variable/manrope": "5.3.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,151 @@
|
||||
<script lang="ts">
|
||||
import type { Snippet } from 'svelte';
|
||||
import type { HTMLButtonAttributes } from 'svelte/elements';
|
||||
import Icon from './Icon.svelte';
|
||||
import Strike from './Strike.svelte';
|
||||
import { strike } from '../lib/strike';
|
||||
import { failureText, type ButtonState } from '../lib/keys';
|
||||
import type { IconName } from '../lib/icons';
|
||||
|
||||
interface Props extends Omit<HTMLButtonAttributes, 'onclick' | 'class' | 'children'> {
|
||||
/** plate: every ordinary action. primary: the one leaf per screen. quiet: toolbars and third actions. danger: deletes. */
|
||||
variant?: 'plate' | 'primary' | 'quiet' | 'danger';
|
||||
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
||||
icon?: IconName;
|
||||
/** Icon only: the label becomes the accessible name and the tooltip. */
|
||||
iconOnly?: boolean;
|
||||
/** The words on the button. Required for iconOnly (it is the accessible name), else use children. */
|
||||
label?: string;
|
||||
block?: boolean;
|
||||
/** Set to drive the state yourself. Left unset, a Promise returned by onclick drives it. */
|
||||
status?: ButtonState;
|
||||
/** May return a Promise: the button shows loading, then success (briefly) or error. */
|
||||
onclick?: (event: MouseEvent) => unknown;
|
||||
/**
|
||||
* Two-step confirmation for danger: the first press arms the button and shows this text ("Press again to
|
||||
* delete"); a second press within confirmFor ms runs onclick. Escape, blur or the timeout disarms it.
|
||||
*/
|
||||
confirm?: string;
|
||||
confirmFor?: number;
|
||||
/** Announced while working, when done, and when it failed (unless the error is a DomiError with its own text). */
|
||||
busyText?: string;
|
||||
doneText?: string;
|
||||
failText?: string;
|
||||
/** Showcase and tests only: show hover, press or focus without the pointer. */
|
||||
force?: string;
|
||||
class?: string;
|
||||
children?: Snippet;
|
||||
}
|
||||
|
||||
let {
|
||||
variant = 'plate',
|
||||
size = 'md',
|
||||
icon,
|
||||
iconOnly = false,
|
||||
label,
|
||||
block = false,
|
||||
status,
|
||||
onclick,
|
||||
confirm,
|
||||
confirmFor = 4000,
|
||||
busyText = 'Working',
|
||||
doneText = 'Done',
|
||||
failText = 'That did not work. Try again.',
|
||||
force,
|
||||
class: cls = '',
|
||||
disabled = false,
|
||||
type = 'button',
|
||||
children,
|
||||
...rest
|
||||
}: Props = $props();
|
||||
|
||||
let auto = $state<ButtonState>('idle');
|
||||
let armed = $state(false);
|
||||
let said = $state('');
|
||||
let timer: ReturnType<typeof setTimeout> | undefined;
|
||||
let armTimer: ReturnType<typeof setTimeout> | undefined;
|
||||
const shown = $derived<ButtonState>(status ?? auto);
|
||||
const busy = $derived(shown === 'loading');
|
||||
|
||||
function hold(): number {
|
||||
const v = getComputedStyle(document.documentElement).getPropertyValue('--domi-dur-hold');
|
||||
return Math.max(900, parseFloat(v) || 1400);
|
||||
}
|
||||
|
||||
function disarm() {
|
||||
armed = false;
|
||||
clearTimeout(armTimer);
|
||||
}
|
||||
|
||||
async function press(event: MouseEvent) {
|
||||
if (disabled || busy) {
|
||||
event.preventDefault();
|
||||
return;
|
||||
}
|
||||
if (confirm && !armed) {
|
||||
armed = true;
|
||||
said = confirm;
|
||||
clearTimeout(armTimer);
|
||||
armTimer = setTimeout(disarm, confirmFor);
|
||||
return;
|
||||
}
|
||||
disarm();
|
||||
const result = onclick?.(event);
|
||||
const thenable = result != null && typeof (result as PromiseLike<unknown>).then === 'function';
|
||||
if (!thenable || status !== undefined) return;
|
||||
clearTimeout(timer);
|
||||
auto = 'loading';
|
||||
said = busyText;
|
||||
try {
|
||||
await result;
|
||||
auto = 'success';
|
||||
said = doneText;
|
||||
timer = setTimeout(() => (auto = 'idle'), hold());
|
||||
} catch (err) {
|
||||
auto = 'error';
|
||||
said = failureText(err, failText);
|
||||
}
|
||||
}
|
||||
|
||||
$effect(() => () => {
|
||||
clearTimeout(timer);
|
||||
clearTimeout(armTimer);
|
||||
});
|
||||
</script>
|
||||
|
||||
<button
|
||||
{...rest}
|
||||
{type}
|
||||
{disabled}
|
||||
class={[
|
||||
'domi-btn',
|
||||
variant !== 'plate' && `domi-btn--${variant}`,
|
||||
size !== 'md' && `domi-btn--${size}`,
|
||||
iconOnly && 'domi-btn--icon',
|
||||
block && 'domi-btn--block',
|
||||
cls,
|
||||
]}
|
||||
data-state={shown === 'idle' ? undefined : shown}
|
||||
data-armed={armed ? '' : undefined}
|
||||
data-force={force}
|
||||
aria-busy={busy ? 'true' : undefined}
|
||||
aria-disabled={busy ? 'true' : undefined}
|
||||
aria-label={iconOnly ? (armed ? confirm : label) : undefined}
|
||||
title={iconOnly ? (armed ? confirm : label) : undefined}
|
||||
onclick={press}
|
||||
onkeydown={(e) => e.key === 'Escape' && armed && disarm()}
|
||||
onblur={disarm}
|
||||
use:strike
|
||||
>
|
||||
<span class="domi-btn__label">
|
||||
{#if shown === 'error'}<Icon name="alert" />{:else if icon}<Icon name={icon} />{/if}
|
||||
{#if !iconOnly}
|
||||
{#if armed}{confirm}{:else if children}{@render children()}{:else}{label}{/if}
|
||||
{/if}
|
||||
</span>
|
||||
<span class="domi-btn__state domi-btn__state--loading"><Strike /></span>
|
||||
<span class="domi-btn__state domi-btn__state--success">
|
||||
{#if shown === 'success'}<Icon name="check" draw />{/if}
|
||||
</span>
|
||||
</button>
|
||||
<span class="domi-sr" role="status">{said}</span>
|
||||
@@ -0,0 +1,59 @@
|
||||
<script lang="ts">
|
||||
import type { Snippet } from 'svelte';
|
||||
import { icons } from '../lib/icons';
|
||||
|
||||
interface Props {
|
||||
checked?: boolean;
|
||||
/** Part of a group is chosen: shows a bar and reads as "mixed". */
|
||||
indeterminate?: boolean;
|
||||
label?: string;
|
||||
hint?: string;
|
||||
name?: string;
|
||||
value?: string;
|
||||
disabled?: boolean;
|
||||
required?: boolean;
|
||||
onchange?: (checked: boolean) => void;
|
||||
force?: string;
|
||||
class?: string;
|
||||
children?: Snippet;
|
||||
}
|
||||
let {
|
||||
checked = $bindable(false),
|
||||
indeterminate = $bindable(false),
|
||||
label,
|
||||
hint,
|
||||
name,
|
||||
value,
|
||||
disabled = false,
|
||||
required = false,
|
||||
onchange,
|
||||
force,
|
||||
class: cls = '',
|
||||
children,
|
||||
}: Props = $props();
|
||||
const uid = $props.id();
|
||||
</script>
|
||||
|
||||
<label class={['domi-choice', cls]} data-force={force}>
|
||||
<span class="domi-choice__control">
|
||||
<input
|
||||
class="domi-choice__input"
|
||||
type="checkbox"
|
||||
bind:checked
|
||||
bind:indeterminate
|
||||
{name}
|
||||
{value}
|
||||
{disabled}
|
||||
{required}
|
||||
aria-describedby={hint ? `domi-hint-${uid}` : undefined}
|
||||
onchange={() => onchange?.(checked)}
|
||||
/>
|
||||
<svg class="domi-choice__mark" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
||||
<path d={indeterminate ? icons.minus : icons.check} />
|
||||
</svg>
|
||||
</span>
|
||||
<span class="domi-choice__text">
|
||||
<span>{#if children}{@render children()}{:else}{label}{/if}</span>
|
||||
{#if hint}<span class="domi-choice__hint" id={`domi-hint-${uid}`}>{hint}</span>{/if}
|
||||
</span>
|
||||
</label>
|
||||
@@ -0,0 +1,22 @@
|
||||
<script lang="ts">
|
||||
import { icons, type IconName } from '../lib/icons';
|
||||
|
||||
interface Props {
|
||||
name: IconName;
|
||||
/** Draws the path in one stroke when it appears (the check of a finished action). */
|
||||
draw?: boolean;
|
||||
class?: string;
|
||||
}
|
||||
let { name, draw = false, class: cls = '' }: Props = $props();
|
||||
</script>
|
||||
|
||||
<svg
|
||||
class={['domi-icon', draw && 'domi-check-draw', cls]}
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="1.8"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
aria-hidden="true"
|
||||
focusable="false"><path d={icons[name]} /></svg>
|
||||
@@ -0,0 +1,39 @@
|
||||
<script lang="ts">
|
||||
import type { Snippet } from 'svelte';
|
||||
|
||||
interface Props {
|
||||
/** The group's chosen value. Bind the same variable on every radio of the group: bind:group. */
|
||||
group?: string;
|
||||
value: string;
|
||||
name: string;
|
||||
label?: string;
|
||||
hint?: string;
|
||||
disabled?: boolean;
|
||||
onchange?: (value: string) => void;
|
||||
force?: string;
|
||||
class?: string;
|
||||
children?: Snippet;
|
||||
}
|
||||
let { group = $bindable(''), value, name, label, hint, disabled = false, onchange, force, class: cls = '', children }: Props = $props();
|
||||
const uid = $props.id();
|
||||
</script>
|
||||
|
||||
<label class={['domi-choice', 'domi-choice--radio', cls]} data-force={force}>
|
||||
<span class="domi-choice__control">
|
||||
<input
|
||||
class="domi-choice__input"
|
||||
type="radio"
|
||||
bind:group
|
||||
{value}
|
||||
{name}
|
||||
{disabled}
|
||||
aria-describedby={hint ? `domi-hint-${uid}` : undefined}
|
||||
onchange={() => onchange?.(value)}
|
||||
/>
|
||||
<span class="domi-choice__mark" aria-hidden="true"></span>
|
||||
</span>
|
||||
<span class="domi-choice__text">
|
||||
<span>{#if children}{@render children()}{:else}{label}{/if}</span>
|
||||
{#if hint}<span class="domi-choice__hint" id={`domi-hint-${uid}`}>{hint}</span>{/if}
|
||||
</span>
|
||||
</label>
|
||||
@@ -0,0 +1,62 @@
|
||||
<script lang="ts">
|
||||
import Icon from './Icon.svelte';
|
||||
import { strike } from '../lib/strike';
|
||||
import type { DomiOption } from '../types';
|
||||
|
||||
interface Props {
|
||||
value?: string;
|
||||
/** Names the group for a screen reader: "View". */
|
||||
label: string;
|
||||
options: DomiOption[];
|
||||
disabled?: boolean;
|
||||
onchange?: (value: string) => void;
|
||||
/** Showcase only: value → forced state for that segment. */
|
||||
force?: Record<string, string>;
|
||||
class?: string;
|
||||
}
|
||||
let { value = $bindable(''), label, options, disabled = false, onchange, force = {}, class: cls = '' }: Props = $props();
|
||||
let group: HTMLDivElement | undefined = $state();
|
||||
|
||||
const enabled = $derived(options.filter((o) => !o.disabled && !disabled));
|
||||
|
||||
function choose(v: string) {
|
||||
if (v === value) return;
|
||||
value = v;
|
||||
onchange?.(v);
|
||||
}
|
||||
|
||||
// A radio group: one tab stop; arrows move the choice and the focus, Home and End jump.
|
||||
function keydown(e: KeyboardEvent) {
|
||||
const i = enabled.findIndex((o) => o.value === value);
|
||||
let j = i;
|
||||
if (e.key === 'ArrowRight' || e.key === 'ArrowDown') j = (i + 1) % enabled.length;
|
||||
else if (e.key === 'ArrowLeft' || e.key === 'ArrowUp') j = (i - 1 + enabled.length) % enabled.length;
|
||||
else if (e.key === 'Home') j = 0;
|
||||
else if (e.key === 'End') j = enabled.length - 1;
|
||||
else return;
|
||||
e.preventDefault();
|
||||
const next = enabled[j];
|
||||
if (!next) return;
|
||||
choose(next.value);
|
||||
group?.querySelector<HTMLButtonElement>(`[data-value="${CSS.escape(next.value)}"]`)?.focus();
|
||||
}
|
||||
</script>
|
||||
|
||||
<div bind:this={group} class={['domi-segmented', cls]} role="radiogroup" aria-label={label} tabindex="-1" onkeydown={keydown}>
|
||||
{#each options as o (o.value)}
|
||||
<button
|
||||
type="button"
|
||||
role="radio"
|
||||
class="domi-segmented__item"
|
||||
data-value={o.value}
|
||||
data-force={force[o.value]}
|
||||
aria-checked={o.value === value}
|
||||
tabindex={o.value === value || (!value && o === enabled[0]) ? 0 : -1}
|
||||
disabled={disabled || o.disabled}
|
||||
onclick={() => choose(o.value)}
|
||||
use:strike
|
||||
>
|
||||
{#if o.icon}<Icon name={o.icon} />{/if}{o.label}
|
||||
</button>
|
||||
{/each}
|
||||
</div>
|
||||
@@ -0,0 +1,44 @@
|
||||
<script lang="ts">
|
||||
import Icon from './Icon.svelte';
|
||||
import type { DomiOption } from '../types';
|
||||
|
||||
interface Props {
|
||||
/** Left unset, the first option is chosen. */
|
||||
value?: string;
|
||||
label: string;
|
||||
hideLabel?: boolean;
|
||||
options: DomiOption[];
|
||||
hint?: string;
|
||||
name?: string;
|
||||
disabled?: boolean;
|
||||
required?: boolean;
|
||||
onchange?: (value: string) => void;
|
||||
force?: string;
|
||||
class?: string;
|
||||
}
|
||||
let { value = $bindable(), label, hideLabel = false, options, hint, name, disabled = false, required = false, onchange, force, class: cls = '' }: Props = $props();
|
||||
const uid = $props.id();
|
||||
</script>
|
||||
|
||||
<!-- A native select: on Android and iOS it opens the system picker, which is the right control for a thumb. -->
|
||||
<div class={['domi-field', cls]}>
|
||||
<label class={['domi-field__label', hideLabel && 'domi-sr']} for={`domi-select-${uid}`}>{label}</label>
|
||||
<div class="domi-select" data-force={force}>
|
||||
<select
|
||||
class="domi-select__input"
|
||||
id={`domi-select-${uid}`}
|
||||
bind:value
|
||||
{name}
|
||||
{disabled}
|
||||
{required}
|
||||
aria-describedby={hint ? `domi-hint-${uid}` : undefined}
|
||||
onchange={() => onchange?.(value ?? '')}
|
||||
>
|
||||
{#each options as o (o.value)}
|
||||
<option value={o.value} disabled={o.disabled}>{o.label}</option>
|
||||
{/each}
|
||||
</select>
|
||||
<Icon name="chevron-down" />
|
||||
</div>
|
||||
{#if hint}<p class="domi-field__hint" id={`domi-hint-${uid}`}>{hint}</p>{/if}
|
||||
</div>
|
||||
@@ -0,0 +1,2 @@
|
||||
<!-- The loading mark: three Roman interpuncts struck in turn. Decorative; the state is announced in words. -->
|
||||
<span class="domi-strike" aria-hidden="true"><i></i><i></i><i></i></span>
|
||||
@@ -0,0 +1,23 @@
|
||||
<script lang="ts">
|
||||
interface Props {
|
||||
checked?: boolean;
|
||||
/** Says what is on: "Sync over mobile data". The switch reads as on or off after it. */
|
||||
label: string;
|
||||
disabled?: boolean;
|
||||
onchange?: (checked: boolean) => void;
|
||||
force?: string;
|
||||
class?: string;
|
||||
}
|
||||
let { checked = $bindable(false), label, disabled = false, onchange, force, class: cls = '' }: Props = $props();
|
||||
|
||||
function toggle() {
|
||||
if (disabled) return;
|
||||
checked = !checked;
|
||||
onchange?.(checked);
|
||||
}
|
||||
</script>
|
||||
|
||||
<button type="button" role="switch" class={['domi-switch', cls]} aria-checked={checked} {disabled} data-force={force} onclick={toggle}>
|
||||
<span class="domi-switch__track" aria-hidden="true"><span class="domi-switch__knob"></span></span>
|
||||
<span>{label}</span>
|
||||
</button>
|
||||
@@ -0,0 +1,324 @@
|
||||
<script lang="ts">
|
||||
import type { HTMLInputAttributes } from 'svelte/elements';
|
||||
import Icon from './Icon.svelte';
|
||||
import Strike from './Strike.svelte';
|
||||
import { strike } from '../lib/strike';
|
||||
import { canSend, enterAction, failureText, isSoftKeyboard, type FieldState } from '../lib/keys';
|
||||
import type { IconName } from '../lib/icons';
|
||||
|
||||
type Action = 'send' | 'search' | 'next' | 'save';
|
||||
|
||||
interface Props {
|
||||
/** The text. Bind it: bind:value. */
|
||||
value?: string;
|
||||
/** The visible label. Every field has one; hideLabel keeps it for screen readers only (a chat composer). */
|
||||
label: string;
|
||||
hideLabel?: boolean;
|
||||
hint?: string;
|
||||
/** An error you show (validation). The field also shows its own when onsend fails. */
|
||||
error?: string;
|
||||
placeholder?: string;
|
||||
type?: 'text' | 'email' | 'url' | 'password' | 'search' | 'tel' | 'number';
|
||||
/** A multi-line field that grows with its text up to `rows` lines. */
|
||||
multiline?: boolean;
|
||||
rows?: number;
|
||||
/**
|
||||
* What the seal does. send (arrow): sends and clears. search (glass): searches. save (check): saves and keeps
|
||||
* the text. next (chevron): in a form, goes to the next field; the last field of a form uses send or save.
|
||||
*/
|
||||
action?: Action;
|
||||
/** The seal's accessible name, the words a screen reader says: "Send message", "Search books". */
|
||||
actionLabel?: string;
|
||||
/** Runs on Enter or the seal. Return a Promise to show sending, then sent or the error. */
|
||||
onsend?: (value: string) => unknown;
|
||||
/** Empty the field after a successful send. Default: true for send, false otherwise. */
|
||||
clearOnSend?: boolean;
|
||||
enterSends?: 'auto' | 'always' | 'never';
|
||||
/** Set to drive the state yourself. */
|
||||
status?: FieldState;
|
||||
sendingText?: string;
|
||||
sentText?: string;
|
||||
failText?: string;
|
||||
size?: 'md' | 'lg';
|
||||
optional?: boolean;
|
||||
disabled?: boolean;
|
||||
readonly?: boolean;
|
||||
required?: boolean;
|
||||
name?: string;
|
||||
id?: string;
|
||||
autocomplete?: HTMLInputAttributes['autocomplete'];
|
||||
inputmode?: HTMLInputAttributes['inputmode'];
|
||||
maxlength?: number;
|
||||
spellcheck?: boolean;
|
||||
autofocus?: boolean;
|
||||
/** Showcase and tests only: 'hover', 'focus' on the field, 'press'/'hover'/'focus' on the seal via sendForce. */
|
||||
force?: string;
|
||||
sendForce?: string;
|
||||
class?: string;
|
||||
/** The input element, for focusing it from outside. */
|
||||
input?: HTMLInputElement | HTMLTextAreaElement | null;
|
||||
}
|
||||
|
||||
let {
|
||||
value = $bindable(''),
|
||||
label,
|
||||
hideLabel = false,
|
||||
hint,
|
||||
error,
|
||||
placeholder,
|
||||
type = 'text',
|
||||
multiline = false,
|
||||
rows = 6,
|
||||
action = 'send',
|
||||
actionLabel,
|
||||
onsend,
|
||||
clearOnSend,
|
||||
enterSends = 'auto',
|
||||
status,
|
||||
sendingText,
|
||||
sentText,
|
||||
failText,
|
||||
size = 'md',
|
||||
optional = false,
|
||||
disabled = false,
|
||||
readonly = false,
|
||||
required = false,
|
||||
name,
|
||||
id,
|
||||
autocomplete,
|
||||
inputmode,
|
||||
maxlength,
|
||||
spellcheck,
|
||||
autofocus = false,
|
||||
force,
|
||||
sendForce,
|
||||
class: cls = '',
|
||||
input = $bindable(null),
|
||||
}: Props = $props();
|
||||
|
||||
const uid = $props.id();
|
||||
const fieldId = $derived(id ?? `domi-field-${uid}`);
|
||||
const hintId = `domi-hint-${uid}`;
|
||||
const errorId = `domi-error-${uid}`;
|
||||
|
||||
const words: Record<Action, { label: string; icon: IconName; key: 'send' | 'search' | 'next' | 'done'; busy: string; done: string; fail: string }> = {
|
||||
send: { label: 'Send', icon: 'send', key: 'send', busy: 'Sending', done: 'Sent', fail: 'Could not send. Try again.' },
|
||||
search: { label: 'Search', icon: 'search', key: 'search', busy: 'Searching', done: 'Searched', fail: 'Could not search. Try again.' },
|
||||
save: { label: 'Save', icon: 'save', key: 'done', busy: 'Saving', done: 'Saved', fail: 'Could not save. Try again.' },
|
||||
next: { label: 'Next field', icon: 'next', key: 'next', busy: 'Checking', done: '', fail: 'Check this field.' },
|
||||
};
|
||||
const w = $derived(words[action]);
|
||||
|
||||
let auto = $state<FieldState>('idle');
|
||||
let failure = $state('');
|
||||
let said = $state('');
|
||||
let revealed = $state(false);
|
||||
let timer: ReturnType<typeof setTimeout> | undefined;
|
||||
|
||||
const shown = $derived<FieldState>(status ?? auto);
|
||||
const empty = $derived(value.trim().length === 0);
|
||||
const sendable = $derived(canSend(value, shown, disabled || readonly));
|
||||
// While sending and just after, the seal stays lit (with the interpuncts, then the check) though it cannot be pressed.
|
||||
const lit = $derived(sendable || shown === 'sending' || shown === 'sent');
|
||||
const message = $derived(error ?? (shown === 'error' ? failure : ''));
|
||||
const described = $derived([hint && hintId, message && errorId].filter(Boolean).join(' ') || undefined);
|
||||
const inputType = $derived(type === 'password' && revealed ? 'text' : type);
|
||||
const clears = $derived(clearOnSend ?? action === 'send');
|
||||
|
||||
function hold(): number {
|
||||
const v = getComputedStyle(document.documentElement).getPropertyValue('--domi-dur-hold');
|
||||
return Math.max(900, parseFloat(v) || 1400);
|
||||
}
|
||||
|
||||
function nextField(from: HTMLElement) {
|
||||
const scope = from.closest('form') ?? document;
|
||||
const all = [...scope.querySelectorAll<HTMLElement>('.domi-field__input, input, textarea, select')].filter(
|
||||
(el) => !el.hasAttribute('disabled') && el.getAttribute('type') !== 'hidden',
|
||||
);
|
||||
const i = all.indexOf(from);
|
||||
all[i + 1]?.focus();
|
||||
}
|
||||
|
||||
async function submit() {
|
||||
if (!sendable || !input) return;
|
||||
const el = input;
|
||||
const text = value;
|
||||
clearTimeout(timer);
|
||||
failure = '';
|
||||
if (!onsend) {
|
||||
// No handler: behave like the form's own submit (or, for next, move on).
|
||||
if (action === 'next') nextField(el);
|
||||
else el.form?.requestSubmit();
|
||||
return;
|
||||
}
|
||||
const result = onsend(text);
|
||||
const thenable = result != null && typeof (result as PromiseLike<unknown>).then === 'function';
|
||||
if (status !== undefined) return;
|
||||
if (!thenable) return done(el);
|
||||
auto = 'sending';
|
||||
said = sendingText ?? w.busy;
|
||||
try {
|
||||
await result;
|
||||
done(el);
|
||||
} catch (err) {
|
||||
auto = 'error';
|
||||
failure = failureText(err, failText ?? w.fail);
|
||||
said = failure;
|
||||
el.focus();
|
||||
}
|
||||
}
|
||||
|
||||
function done(el: HTMLInputElement | HTMLTextAreaElement) {
|
||||
if (clears) value = '';
|
||||
if (action === 'next') {
|
||||
auto = 'idle';
|
||||
nextField(el);
|
||||
return;
|
||||
}
|
||||
auto = 'sent';
|
||||
said = sentText ?? w.done;
|
||||
timer = setTimeout(() => (auto = 'idle'), hold());
|
||||
if (document.activeElement !== el && el.isConnected) el.focus();
|
||||
}
|
||||
|
||||
function keydown(e: KeyboardEvent) {
|
||||
if (e.key === 'Escape' && shown === 'error' && status === undefined) {
|
||||
auto = 'idle';
|
||||
failure = '';
|
||||
return;
|
||||
}
|
||||
const r = enterAction(e, { multiline, enterSends, softKeyboard: isSoftKeyboard() });
|
||||
if (r === 'send') {
|
||||
e.preventDefault();
|
||||
if (shown !== 'sending') void submit();
|
||||
} else if (r === 'ignore' && e.key === 'Enter' && e.altKey && !multiline) {
|
||||
// Alt+Enter must not submit the form. An Enter that ends an input method's composition is left alone.
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
function typed() {
|
||||
if (shown === 'error' && status === undefined) {
|
||||
auto = 'idle';
|
||||
failure = '';
|
||||
}
|
||||
if (shown === 'sent' && status === undefined) auto = 'idle';
|
||||
grow();
|
||||
}
|
||||
|
||||
// field-sizing: content grows the textarea in Chromium (WebView2, Android WebView); elsewhere, grow it here.
|
||||
const sizesItself = typeof CSS !== 'undefined' && CSS.supports?.('field-sizing', 'content');
|
||||
function grow() {
|
||||
if (!multiline || sizesItself || !input) return;
|
||||
input.style.height = 'auto';
|
||||
input.style.height = `${input.scrollHeight}px`;
|
||||
}
|
||||
$effect(() => {
|
||||
void value;
|
||||
grow();
|
||||
});
|
||||
$effect(() => () => clearTimeout(timer));
|
||||
$effect(() => {
|
||||
if (autofocus) input?.focus();
|
||||
});
|
||||
|
||||
function focusInput(e: MouseEvent) {
|
||||
if (e.target === e.currentTarget) input?.focus();
|
||||
}
|
||||
</script>
|
||||
|
||||
<div
|
||||
class={['domi-field', multiline && 'domi-field--multiline', size === 'lg' && 'domi-field--lg', cls]}
|
||||
data-state={shown === 'idle' ? undefined : shown}
|
||||
data-empty={empty ? '' : undefined}
|
||||
data-disabled={disabled ? '' : undefined}
|
||||
>
|
||||
<label class={['domi-field__label', hideLabel && 'domi-sr']} for={fieldId}>
|
||||
{label}{#if optional}<span class="domi-field__optional">{" (optional)"}</span>{/if}
|
||||
</label>
|
||||
<!-- svelte-ignore a11y_click_events_have_key_events a11y_no_static_element_interactions -->
|
||||
<div class="domi-field__well" role="presentation" data-force={force} onclick={focusInput}>
|
||||
{#if multiline}
|
||||
<textarea
|
||||
bind:this={input}
|
||||
bind:value
|
||||
class="domi-field__input"
|
||||
id={fieldId}
|
||||
{name}
|
||||
{placeholder}
|
||||
{disabled}
|
||||
readonly={readonly || shown === 'sending'}
|
||||
{required}
|
||||
{maxlength}
|
||||
{spellcheck}
|
||||
rows="1"
|
||||
style:--_rows-max={rows}
|
||||
enterkeyhint={w.key === 'done' ? 'done' : 'enter'}
|
||||
aria-invalid={message ? 'true' : undefined}
|
||||
aria-describedby={described}
|
||||
onkeydown={keydown}
|
||||
oninput={typed}
|
||||
></textarea>
|
||||
{:else}
|
||||
<input
|
||||
bind:this={input}
|
||||
bind:value
|
||||
class="domi-field__input"
|
||||
id={fieldId}
|
||||
type={inputType}
|
||||
{name}
|
||||
{placeholder}
|
||||
{disabled}
|
||||
readonly={readonly || shown === 'sending'}
|
||||
{required}
|
||||
{maxlength}
|
||||
{spellcheck}
|
||||
{autocomplete}
|
||||
{inputmode}
|
||||
enterkeyhint={w.key === 'done' ? 'done' : w.key}
|
||||
aria-invalid={message ? 'true' : undefined}
|
||||
aria-describedby={described}
|
||||
onkeydown={keydown}
|
||||
oninput={typed}
|
||||
/>
|
||||
{/if}
|
||||
{#if type === 'password'}
|
||||
<button
|
||||
type="button"
|
||||
class="domi-field__tool"
|
||||
aria-label={revealed ? 'Hide password' : 'Show password'}
|
||||
aria-pressed={revealed}
|
||||
aria-controls={fieldId}
|
||||
{disabled}
|
||||
onclick={() => (revealed = !revealed)}
|
||||
>
|
||||
<Icon name={revealed ? 'eye-off' : 'eye'} />
|
||||
</button>
|
||||
{/if}
|
||||
<button
|
||||
type="button"
|
||||
class="domi-send"
|
||||
aria-label={actionLabel ?? w.label}
|
||||
aria-disabled={lit ? undefined : 'true'}
|
||||
aria-busy={shown === 'sending' ? 'true' : undefined}
|
||||
aria-controls={fieldId}
|
||||
tabindex={lit ? undefined : -1}
|
||||
title={actionLabel ?? w.label}
|
||||
data-state={shown === 'sending' ? 'sending' : undefined}
|
||||
data-force={sendForce}
|
||||
onclick={() => void submit()}
|
||||
use:strike
|
||||
>
|
||||
{#if shown === 'sending'}
|
||||
<Strike />
|
||||
{:else if shown === 'sent'}
|
||||
<Icon name="check" draw />
|
||||
{:else}
|
||||
<Icon name={w.icon} />
|
||||
{/if}
|
||||
</button>
|
||||
</div>
|
||||
{#if hint}<p class="domi-field__hint" id={hintId}>{hint}</p>{/if}
|
||||
{#if message}<p class="domi-field__error" id={errorId}><Icon name="alert" />{message}</p>{/if}
|
||||
<span class="domi-sr" role="status">{said}</span>
|
||||
</div>
|
||||
@@ -0,0 +1,229 @@
|
||||
/*
|
||||
* @domi/ui base: the tokens derived from the roles, the touch floor, focus, and the motion every component shares.
|
||||
* Load after tokens.css. Hand-written; the roles come from tokens.css.
|
||||
*
|
||||
* Derived tokens are declared on every element that can change roles (the root, data-domi-app, data-domi-room),
|
||||
* because a custom property holding var() is resolved where it is declared: declared on :root only, a tile with
|
||||
* data-domi-app="culina" would keep the root's tint.
|
||||
*/
|
||||
:root,
|
||||
[data-domi-app],
|
||||
[data-domi-room] {
|
||||
--domi-tint: color-mix(in srgb, var(--domi-accent) 13%, transparent);
|
||||
--domi-tint-strong: color-mix(in srgb, var(--domi-accent) 22%, transparent);
|
||||
--domi-edge-accent: color-mix(in srgb, var(--domi-accent) 55%, transparent);
|
||||
--domi-edge-danger: color-mix(in srgb, var(--domi-danger) 60%, transparent);
|
||||
--domi-edge-ok: color-mix(in srgb, var(--domi-ok) 60%, transparent);
|
||||
--domi-tint-danger: color-mix(in srgb, var(--domi-danger) 9%, transparent);
|
||||
--domi-halo: 0 0 0 4px color-mix(in srgb, var(--domi-accent) 22%, transparent);
|
||||
|
||||
/* The leaf: the app's metal beaten thin over the one primary action of a screen. */
|
||||
--domi-leaf: linear-gradient(180deg, var(--domi-leaf-hi) 0%, var(--domi-leaf-mid) 52%, var(--domi-leaf-lo) 100%);
|
||||
/* Hover stops come from the token build, checked so the label keeps 4.5:1 (v1.0.1). */
|
||||
--domi-leaf-hover: linear-gradient(180deg, var(--domi-leaf-hover-hi) 0%, var(--domi-leaf-hover-mid) 52%, var(--domi-leaf-hover-lo) 100%);
|
||||
--domi-leaf-press: linear-gradient(180deg, var(--domi-leaf-lo) 0%, var(--domi-leaf-mid) 60%, var(--domi-leaf-hi) 100%);
|
||||
--domi-leaf-bevel: 0 0 0 1px color-mix(in srgb, var(--domi-leaf-edge) 24%, transparent),
|
||||
0 14px 34px -14px color-mix(in srgb, var(--domi-leaf-mid) 70%, transparent),
|
||||
inset 0 1px 0 color-mix(in srgb, var(--domi-leaf-hi) 40%, white), inset 0 -2px 0 color-mix(in srgb, var(--domi-leaf-lo) 62%, black);
|
||||
--domi-leaf-bevel-press: 0 0 0 1px color-mix(in srgb, var(--domi-leaf-edge) 24%, transparent),
|
||||
0 6px 16px -10px color-mix(in srgb, var(--domi-leaf-mid) 55%, transparent),
|
||||
inset 0 2px 4px color-mix(in srgb, var(--domi-leaf-lo) 50%, black);
|
||||
|
||||
/* The plate: every other button, struck from the ground's own stone. */
|
||||
--domi-plate: linear-gradient(180deg, var(--domi-plate-top), var(--domi-plate-bottom));
|
||||
--domi-plate-hover: linear-gradient(180deg, var(--domi-plate-top-hover), var(--domi-plate-bottom-hover));
|
||||
--domi-plate-press: linear-gradient(180deg, var(--domi-plate-bottom), var(--domi-plate-top));
|
||||
--domi-sheen: color-mix(in srgb, var(--domi-fg) 10%, transparent);
|
||||
--domi-sheen-strong: color-mix(in srgb, var(--domi-fg) 18%, transparent);
|
||||
--domi-glint: color-mix(in srgb, white 22%, transparent);
|
||||
--domi-glint-leaf: color-mix(in srgb, white 42%, transparent);
|
||||
--domi-impression: color-mix(in srgb, var(--domi-fg) 22%, transparent);
|
||||
--domi-impression-leaf: color-mix(in srgb, var(--domi-leaf-lo) 55%, black);
|
||||
--domi-plate-shadow: inset 0 1px 0 var(--domi-sheen), inset 0 -1px 0 rgb(0 0 0 / 0.45), 0 1px 0 rgb(0 0 0 / 0.55),
|
||||
0 8px 18px -12px rgb(0 0 0 / 0.9);
|
||||
--domi-plate-shadow-hover: inset 0 1px 0 var(--domi-sheen-strong), inset 0 -1px 0 rgb(0 0 0 / 0.45), 0 1px 0 rgb(0 0 0 / 0.55),
|
||||
0 10px 22px -12px rgb(0 0 0 / 0.95);
|
||||
--domi-plate-shadow-press: inset 0 2px 5px rgb(0 0 0 / 0.65), inset 0 -1px 0 var(--domi-sheen);
|
||||
|
||||
/* A field is cut into the stone. */
|
||||
--domi-carved: inset 0 2px 6px rgb(0 0 0 / 0.55), inset 0 -1px 0 var(--domi-sheen);
|
||||
--domi-dialog-shadow: 0 40px 100px -40px rgb(0 0 0 / 0.95);
|
||||
}
|
||||
|
||||
/* On parchment the light falls the same way, but the shade is umber and softer. */
|
||||
:root[data-domi-theme='light'],
|
||||
:root[data-domi-theme='light'] [data-domi-app],
|
||||
:root[data-domi-theme='light'] [data-domi-room] {
|
||||
--domi-sheen: rgb(255 255 255 / 0.85);
|
||||
--domi-sheen-strong: rgb(255 255 255 / 1);
|
||||
--domi-glint: rgb(255 255 255 / 0.7);
|
||||
--domi-impression: color-mix(in srgb, var(--domi-fg) 14%, transparent);
|
||||
--domi-plate-shadow: inset 0 1px 0 var(--domi-sheen), inset 0 -1px 0 rgb(90 66 30 / 0.16), 0 1px 0 rgb(90 66 30 / 0.12),
|
||||
0 8px 16px -12px rgb(90 66 30 / 0.45);
|
||||
--domi-plate-shadow-hover: inset 0 1px 0 var(--domi-sheen-strong), inset 0 -1px 0 rgb(90 66 30 / 0.18), 0 1px 0 rgb(90 66 30 / 0.14),
|
||||
0 10px 20px -12px rgb(90 66 30 / 0.5);
|
||||
--domi-plate-shadow-press: inset 0 2px 5px rgb(90 66 30 / 0.28), inset 0 -1px 0 var(--domi-sheen);
|
||||
--domi-carved: inset 0 2px 5px rgb(90 66 30 / 0.16), inset 0 -1px 0 var(--domi-sheen);
|
||||
--domi-dialog-shadow: 0 30px 80px -36px rgb(90 66 30 / 0.55);
|
||||
}
|
||||
@media (prefers-color-scheme: light) {
|
||||
:root[data-domi-theme='auto'],
|
||||
:root[data-domi-theme='auto'] [data-domi-app],
|
||||
:root[data-domi-theme='auto'] [data-domi-room] {
|
||||
--domi-sheen: rgb(255 255 255 / 0.85);
|
||||
--domi-sheen-strong: rgb(255 255 255 / 1);
|
||||
--domi-glint: rgb(255 255 255 / 0.7);
|
||||
--domi-impression: color-mix(in srgb, var(--domi-fg) 14%, transparent);
|
||||
--domi-plate-shadow: inset 0 1px 0 var(--domi-sheen), inset 0 -1px 0 rgb(90 66 30 / 0.16), 0 1px 0 rgb(90 66 30 / 0.12),
|
||||
0 8px 16px -12px rgb(90 66 30 / 0.45);
|
||||
--domi-plate-shadow-hover: inset 0 1px 0 var(--domi-sheen-strong), inset 0 -1px 0 rgb(90 66 30 / 0.18),
|
||||
0 1px 0 rgb(90 66 30 / 0.14), 0 10px 20px -12px rgb(90 66 30 / 0.5);
|
||||
--domi-plate-shadow-press: inset 0 2px 5px rgb(90 66 30 / 0.28), inset 0 -1px 0 var(--domi-sheen);
|
||||
--domi-carved: inset 0 2px 5px rgb(90 66 30 / 0.16), inset 0 -1px 0 var(--domi-sheen);
|
||||
--domi-dialog-shadow: 0 30px 80px -36px rgb(90 66 30 / 0.55);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* The touch floor. On a coarse pointer (Android, a touch screen) every control is at least 48 px and every field
|
||||
* 56 px; on a mouse and keyboard the desktop sizes hold. data-domi-density forces one or the other.
|
||||
*/
|
||||
:root {
|
||||
--domi-target: 0px;
|
||||
--domi-field-target: 0px;
|
||||
--domi-send-target: 0px;
|
||||
}
|
||||
@media (pointer: coarse) {
|
||||
:root {
|
||||
--domi-target: var(--domi-size-touch);
|
||||
--domi-field-target: var(--domi-size-field-touch);
|
||||
--domi-send-target: var(--domi-size-send-touch);
|
||||
}
|
||||
}
|
||||
:root[data-domi-density='touch'] {
|
||||
--domi-target: var(--domi-size-touch);
|
||||
--domi-field-target: var(--domi-size-field-touch);
|
||||
--domi-send-target: var(--domi-size-send-touch);
|
||||
}
|
||||
:root[data-domi-density='pointer'] {
|
||||
--domi-target: 0px;
|
||||
--domi-field-target: 0px;
|
||||
--domi-send-target: 0px;
|
||||
}
|
||||
|
||||
/* A page that opts in to the Domi ground. */
|
||||
.domi-page {
|
||||
min-height: 100%;
|
||||
margin: 0;
|
||||
background: var(--domi-bg);
|
||||
color: var(--domi-fg);
|
||||
font: 400 var(--domi-text-md) / var(--domi-leading-md) var(--domi-font-hand);
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
.domi-wordmark {
|
||||
font-family: var(--domi-font-inscription);
|
||||
font-weight: 500;
|
||||
letter-spacing: var(--domi-tracking-inscription);
|
||||
color: var(--domi-accent-strong);
|
||||
}
|
||||
|
||||
/* Hidden from sight, read by a screen reader: state announcements. */
|
||||
.domi-sr {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
margin: -1px;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
clip-path: inset(50%);
|
||||
white-space: nowrap;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
/* Shared motion. Every keyframe moves something (transform, or the chisel line's position) or fades a decorative
|
||||
layer; none animates a colour. */
|
||||
@keyframes domi-glint {
|
||||
from {
|
||||
transform: translateX(-130%) skewX(-18deg);
|
||||
}
|
||||
to {
|
||||
transform: translateX(130%) skewX(-18deg);
|
||||
}
|
||||
}
|
||||
@keyframes domi-impress {
|
||||
from {
|
||||
transform: scale(0.2);
|
||||
opacity: 0.9;
|
||||
}
|
||||
to {
|
||||
transform: scale(1);
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
@keyframes domi-strike {
|
||||
0%,
|
||||
60%,
|
||||
100% {
|
||||
transform: translateY(0) scale(0.7);
|
||||
}
|
||||
25% {
|
||||
transform: translateY(2px) scale(1.15);
|
||||
}
|
||||
}
|
||||
@keyframes domi-shake {
|
||||
0%,
|
||||
100% {
|
||||
transform: translateX(0);
|
||||
}
|
||||
20%,
|
||||
60% {
|
||||
transform: translateX(-4px);
|
||||
}
|
||||
40%,
|
||||
80% {
|
||||
transform: translateX(4px);
|
||||
}
|
||||
}
|
||||
/* The chisel line runs inside the field (background-position, so nothing leaves the field). */
|
||||
@keyframes domi-carve {
|
||||
from {
|
||||
background-position: -70% 0;
|
||||
}
|
||||
to {
|
||||
background-position: 170% 0;
|
||||
}
|
||||
}
|
||||
@keyframes domi-draw {
|
||||
from {
|
||||
stroke-dashoffset: 24;
|
||||
}
|
||||
to {
|
||||
stroke-dashoffset: 0;
|
||||
}
|
||||
}
|
||||
@keyframes domi-rise {
|
||||
from {
|
||||
transform: translateY(3px) scale(0.86);
|
||||
}
|
||||
to {
|
||||
transform: none;
|
||||
}
|
||||
}
|
||||
|
||||
/* Reduced motion: nothing moves, nothing is hidden for it; every state is still shown, at once. */
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
animation-duration: 0ms !important;
|
||||
animation-iteration-count: 1 !important;
|
||||
transition-duration: 0ms !important;
|
||||
}
|
||||
}
|
||||
:root[data-domi-motion='reduce'] *,
|
||||
:root[data-domi-motion='reduce'] *::before,
|
||||
:root[data-domi-motion='reduce'] *::after {
|
||||
animation-duration: 0ms !important;
|
||||
animation-iteration-count: 1 !important;
|
||||
transition-duration: 0ms !important;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,7 @@
|
||||
/* @domi/ui, everything: fonts, tokens, base, components. Import once at the app root.
|
||||
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not
|
||||
distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
@import './fonts.css';
|
||||
@import './tokens.css';
|
||||
@import './base.css';
|
||||
@import './components.css';
|
||||
@@ -0,0 +1,9 @@
|
||||
/*
|
||||
* The three Domi faces, bundled from npm (@fontsource-variable, SIL Open Font License 1.1). Nothing is fetched at
|
||||
* run time. A bundler (Vite) resolves these imports; for a stack without one, copy the woff2 files named in
|
||||
* docs/INTEGRATE.md and point @font-face at them. Families: 'Cinzel Variable', 'Cormorant Garamond Variable',
|
||||
* 'Manrope Variable'; the token stacks fall back to the plain names the apps used before.
|
||||
*/
|
||||
@import '@fontsource-variable/cinzel/wght.css';
|
||||
@import '@fontsource-variable/cormorant-garamond/wght.css';
|
||||
@import '@fontsource-variable/manrope/wght.css';
|
||||
@@ -0,0 +1,24 @@
|
||||
/* amicitia's token names before @domi/ui, as aliases. GENERATED by tools/build-legacy.mjs: do not edit. */
|
||||
/* Load after @domi/ui/domi.css. Temporary: rename usages to --domi-* and drop this file. */
|
||||
:root {
|
||||
--ground: var(--domi-bg);
|
||||
--colonnade: var(--domi-chrome);
|
||||
--surface: var(--domi-panel);
|
||||
--surface-2: var(--domi-hover);
|
||||
--hairline: var(--domi-line);
|
||||
--control-edge: var(--domi-edge);
|
||||
--text: var(--domi-fg);
|
||||
--text-2: var(--domi-fg-2);
|
||||
--muted: var(--domi-muted);
|
||||
--disabled: var(--domi-disabled);
|
||||
--accent: var(--domi-accent);
|
||||
--accent-strong: var(--domi-accent-strong);
|
||||
--primary-high: var(--domi-leaf-hi);
|
||||
--primary-mid: var(--domi-leaf-mid);
|
||||
--primary-low: var(--domi-leaf-lo);
|
||||
--primary-edge: var(--domi-leaf-edge);
|
||||
--on-primary: var(--domi-leaf-fg);
|
||||
--second: var(--domi-second);
|
||||
--danger: var(--domi-danger);
|
||||
--ok: var(--domi-ok);
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/* arca's token names before @domi/ui, as aliases. GENERATED by tools/build-legacy.mjs: do not edit. */
|
||||
/* Load after @domi/ui/domi.css. Temporary: rename usages to --domi-* and drop this file. */
|
||||
:root {
|
||||
--bg: var(--domi-bg);
|
||||
--chrome: var(--domi-chrome);
|
||||
--chrome-top: var(--domi-chrome-top);
|
||||
--panel: var(--domi-panel);
|
||||
--hover: var(--domi-hover);
|
||||
--line: var(--domi-line);
|
||||
--edge: var(--domi-edge);
|
||||
--field: var(--domi-field);
|
||||
--fg: var(--domi-fg);
|
||||
--fg-2: var(--domi-fg-2);
|
||||
--muted: var(--domi-muted);
|
||||
--disabled: var(--domi-disabled);
|
||||
--plate-top: var(--domi-plate-top);
|
||||
--plate-bottom: var(--domi-plate-bottom);
|
||||
--plate-top-hover: var(--domi-plate-top-hover);
|
||||
--plate-bottom-hover: var(--domi-plate-bottom-hover);
|
||||
--accent: var(--domi-accent);
|
||||
--accent-strong: var(--domi-accent-strong);
|
||||
--accent-fg: var(--domi-leaf-fg);
|
||||
--leaf: var(--domi-leaf);
|
||||
--leaf-edge: var(--domi-leaf-edge);
|
||||
--rim-top: var(--domi-rim);
|
||||
--second: var(--domi-second);
|
||||
--danger: var(--domi-danger);
|
||||
--danger-fg: var(--domi-danger-fg);
|
||||
--ok: var(--domi-ok);
|
||||
--warning: var(--domi-warning);
|
||||
--tint: var(--domi-tint);
|
||||
--halo: var(--domi-halo);
|
||||
--sheen: var(--domi-sheen);
|
||||
--sheen-strong: var(--domi-sheen-strong);
|
||||
--leaf-hover: var(--domi-leaf-hover);
|
||||
--leaf-press: var(--domi-leaf-press);
|
||||
--leaf-bevel: var(--domi-leaf-bevel);
|
||||
--leaf-bevel-press: var(--domi-leaf-bevel-press);
|
||||
--edge-accent: var(--domi-edge-accent);
|
||||
--edge-danger: var(--domi-edge-danger);
|
||||
--tint-danger: var(--domi-tint-danger);
|
||||
--primary-fill: var(--domi-leaf);
|
||||
--primary-edge: var(--domi-leaf-edge);
|
||||
--inscription: var(--domi-font-inscription);
|
||||
--book: var(--domi-font-book);
|
||||
--hand: var(--domi-font-hand);
|
||||
--code: var(--domi-font-code);
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/* atrium's token names before @domi/ui, as aliases. GENERATED by tools/build-legacy.mjs: do not edit. */
|
||||
/* Load after @domi/ui/domi.css. Temporary: rename usages to --domi-* and drop this file. */
|
||||
:root {
|
||||
--bg: var(--domi-bg);
|
||||
--chrome: var(--domi-chrome);
|
||||
--chrome-top: var(--domi-chrome-top);
|
||||
--panel: var(--domi-panel);
|
||||
--hover: var(--domi-hover);
|
||||
--line: var(--domi-line);
|
||||
--edge: var(--domi-edge);
|
||||
--field: var(--domi-field);
|
||||
--fg: var(--domi-fg);
|
||||
--fg-2: var(--domi-fg-2);
|
||||
--muted: var(--domi-muted);
|
||||
--disabled: var(--domi-disabled);
|
||||
--plate-top: var(--domi-plate-top);
|
||||
--plate-bottom: var(--domi-plate-bottom);
|
||||
--plate-top-hover: var(--domi-plate-top-hover);
|
||||
--plate-bottom-hover: var(--domi-plate-bottom-hover);
|
||||
--accent: var(--domi-accent);
|
||||
--accent-strong: var(--domi-accent-strong);
|
||||
--accent-fg: var(--domi-leaf-fg);
|
||||
--leaf: var(--domi-leaf);
|
||||
--leaf-edge: var(--domi-leaf-edge);
|
||||
--rim-top: var(--domi-rim);
|
||||
--second: var(--domi-second);
|
||||
--danger: var(--domi-danger);
|
||||
--danger-fg: var(--domi-danger-fg);
|
||||
--ok: var(--domi-ok);
|
||||
--warning: var(--domi-warning);
|
||||
--tint: var(--domi-tint);
|
||||
--halo: var(--domi-halo);
|
||||
--sheen: var(--domi-sheen);
|
||||
--sheen-strong: var(--domi-sheen-strong);
|
||||
--leaf-hover: var(--domi-leaf-hover);
|
||||
--leaf-press: var(--domi-leaf-press);
|
||||
--leaf-bevel: var(--domi-leaf-bevel);
|
||||
--leaf-bevel-press: var(--domi-leaf-bevel-press);
|
||||
--edge-accent: var(--domi-edge-accent);
|
||||
--edge-danger: var(--domi-edge-danger);
|
||||
--tint-danger: var(--domi-tint-danger);
|
||||
--primary-fill: var(--domi-leaf);
|
||||
--primary-edge: var(--domi-leaf-edge);
|
||||
--inscription: var(--domi-font-inscription);
|
||||
--book: var(--domi-font-book);
|
||||
--hand: var(--domi-font-hand);
|
||||
--code: var(--domi-font-code);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
/* aula's token names before @domi/ui, as aliases. GENERATED by tools/build-legacy.mjs: do not edit. */
|
||||
/* Load after @domi/ui/domi.css. Temporary: rename usages to --domi-* and drop this file. */
|
||||
:root {
|
||||
--bg: var(--domi-bg);
|
||||
--chrome: var(--domi-chrome);
|
||||
--panel: var(--domi-panel);
|
||||
--line: var(--domi-line);
|
||||
--edge: var(--domi-edge);
|
||||
--field: var(--domi-field);
|
||||
--fg: var(--domi-fg);
|
||||
--fg-2: var(--domi-fg-2);
|
||||
--muted: var(--domi-muted);
|
||||
--accent: var(--domi-accent);
|
||||
--accent-strong: var(--domi-accent-strong);
|
||||
--p-leaf1: var(--domi-leaf-hi);
|
||||
--p-leaf2: var(--domi-leaf-mid);
|
||||
--p-leaf3: var(--domi-leaf-lo);
|
||||
--p-leaf-edge: var(--domi-leaf-edge);
|
||||
--p-on-leaf: var(--domi-leaf-fg);
|
||||
--second: var(--domi-second);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/* calenda's token names before @domi/ui, as aliases. GENERATED by tools/build-legacy.mjs: do not edit. */
|
||||
/* Load after @domi/ui/domi.css. Temporary: rename usages to --domi-* and drop this file. */
|
||||
:root {
|
||||
--bg: var(--domi-bg);
|
||||
--sidebar: var(--domi-chrome);
|
||||
--surface: var(--domi-panel);
|
||||
--surface-2: var(--domi-hover);
|
||||
--line: var(--domi-line);
|
||||
--line-control: var(--domi-edge);
|
||||
--text: var(--domi-fg);
|
||||
--muted: var(--domi-muted);
|
||||
--accent-strong: var(--domi-accent);
|
||||
--accent-edge: var(--domi-leaf-hi);
|
||||
--accent: var(--domi-leaf-mid);
|
||||
--lacquer-deep: var(--domi-leaf-lo);
|
||||
--bronze: var(--domi-leaf-edge);
|
||||
--on-accent: var(--domi-leaf-fg);
|
||||
--person-text: var(--domi-second);
|
||||
--danger: var(--domi-danger);
|
||||
--on-danger: var(--domi-danger-fg);
|
||||
--warning: var(--domi-warning);
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/* culina's token names before @domi/ui, as aliases. GENERATED by tools/build-legacy.mjs: do not edit. */
|
||||
/* Load after @domi/ui/domi.css. Temporary: rename usages to --domi-* and drop this file. */
|
||||
:root {
|
||||
--bg: var(--domi-bg);
|
||||
--chrome: var(--domi-chrome);
|
||||
--chrome-top: var(--domi-chrome-top);
|
||||
--panel: var(--domi-panel);
|
||||
--hover: var(--domi-hover);
|
||||
--line: var(--domi-line);
|
||||
--edge: var(--domi-edge);
|
||||
--field: var(--domi-field);
|
||||
--fg: var(--domi-fg);
|
||||
--fg-2: var(--domi-fg-2);
|
||||
--muted: var(--domi-muted);
|
||||
--disabled: var(--domi-disabled);
|
||||
--plate-top: var(--domi-plate-top);
|
||||
--plate-bottom: var(--domi-plate-bottom);
|
||||
--plate-top-hover: var(--domi-plate-top-hover);
|
||||
--plate-bottom-hover: var(--domi-plate-bottom-hover);
|
||||
--accent: var(--domi-accent);
|
||||
--accent-strong: var(--domi-accent-strong);
|
||||
--accent-fg: var(--domi-leaf-fg);
|
||||
--leaf: var(--domi-leaf);
|
||||
--leaf-edge: var(--domi-leaf-edge);
|
||||
--rim-top: var(--domi-rim);
|
||||
--second: var(--domi-second);
|
||||
--danger: var(--domi-danger);
|
||||
--danger-fg: var(--domi-danger-fg);
|
||||
--ok: var(--domi-ok);
|
||||
--warning: var(--domi-warning);
|
||||
--tint: var(--domi-tint);
|
||||
--halo: var(--domi-halo);
|
||||
--sheen: var(--domi-sheen);
|
||||
--sheen-strong: var(--domi-sheen-strong);
|
||||
--leaf-hover: var(--domi-leaf-hover);
|
||||
--leaf-press: var(--domi-leaf-press);
|
||||
--leaf-bevel: var(--domi-leaf-bevel);
|
||||
--leaf-bevel-press: var(--domi-leaf-bevel-press);
|
||||
--edge-accent: var(--domi-edge-accent);
|
||||
--edge-danger: var(--domi-edge-danger);
|
||||
--tint-danger: var(--domi-tint-danger);
|
||||
--primary-fill: var(--domi-leaf);
|
||||
--primary-edge: var(--domi-leaf-edge);
|
||||
--inscription: var(--domi-font-inscription);
|
||||
--book: var(--domi-font-book);
|
||||
--hand: var(--domi-font-hand);
|
||||
--code: var(--domi-font-code);
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/* custos's token names before @domi/ui, as aliases. GENERATED by tools/build-legacy.mjs: do not edit. */
|
||||
/* Load after @domi/ui/domi.css. Temporary: rename usages to --domi-* and drop this file. */
|
||||
:root {
|
||||
--bg: var(--domi-bg);
|
||||
--chrome: var(--domi-chrome);
|
||||
--chrome-top: var(--domi-chrome-top);
|
||||
--panel: var(--domi-panel);
|
||||
--hover: var(--domi-hover);
|
||||
--line: var(--domi-line);
|
||||
--edge: var(--domi-edge);
|
||||
--field: var(--domi-field);
|
||||
--fg: var(--domi-fg);
|
||||
--fg-2: var(--domi-fg-2);
|
||||
--muted: var(--domi-muted);
|
||||
--disabled: var(--domi-disabled);
|
||||
--plate-top: var(--domi-plate-top);
|
||||
--plate-bottom: var(--domi-plate-bottom);
|
||||
--plate-top-hover: var(--domi-plate-top-hover);
|
||||
--plate-bottom-hover: var(--domi-plate-bottom-hover);
|
||||
--accent: var(--domi-accent);
|
||||
--accent-strong: var(--domi-accent-strong);
|
||||
--accent-fg: var(--domi-leaf-fg);
|
||||
--leaf: var(--domi-leaf);
|
||||
--leaf-edge: var(--domi-leaf-edge);
|
||||
--rim-top: var(--domi-rim);
|
||||
--second: var(--domi-second);
|
||||
--danger: var(--domi-danger);
|
||||
--danger-fg: var(--domi-danger-fg);
|
||||
--ok: var(--domi-ok);
|
||||
--warning: var(--domi-warning);
|
||||
--tint: var(--domi-tint);
|
||||
--halo: var(--domi-halo);
|
||||
--sheen: var(--domi-sheen);
|
||||
--sheen-strong: var(--domi-sheen-strong);
|
||||
--leaf-hover: var(--domi-leaf-hover);
|
||||
--leaf-press: var(--domi-leaf-press);
|
||||
--leaf-bevel: var(--domi-leaf-bevel);
|
||||
--leaf-bevel-press: var(--domi-leaf-bevel-press);
|
||||
--edge-accent: var(--domi-edge-accent);
|
||||
--edge-danger: var(--domi-edge-danger);
|
||||
--tint-danger: var(--domi-tint-danger);
|
||||
--primary-fill: var(--domi-leaf);
|
||||
--primary-edge: var(--domi-leaf-edge);
|
||||
--inscription: var(--domi-font-inscription);
|
||||
--book: var(--domi-font-book);
|
||||
--hand: var(--domi-font-hand);
|
||||
--code: var(--domi-font-code);
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/* domi-office's token names before @domi/ui, as aliases. GENERATED by tools/build-legacy.mjs: do not edit. */
|
||||
/* Load after @domi/ui/domi.css. Temporary: rename usages to --domi-* and drop this file. */
|
||||
:root {
|
||||
--bg: var(--domi-bg);
|
||||
--chrome: var(--domi-chrome);
|
||||
--chrome-top: var(--domi-chrome-top);
|
||||
--panel: var(--domi-panel);
|
||||
--hover: var(--domi-hover);
|
||||
--line: var(--domi-line);
|
||||
--edge: var(--domi-edge);
|
||||
--field: var(--domi-field);
|
||||
--fg: var(--domi-fg);
|
||||
--fg-2: var(--domi-fg-2);
|
||||
--muted: var(--domi-muted);
|
||||
--disabled: var(--domi-disabled);
|
||||
--plate-top: var(--domi-plate-top);
|
||||
--plate-bottom: var(--domi-plate-bottom);
|
||||
--plate-top-hover: var(--domi-plate-top-hover);
|
||||
--plate-bottom-hover: var(--domi-plate-bottom-hover);
|
||||
--accent: var(--domi-accent);
|
||||
--accent-strong: var(--domi-accent-strong);
|
||||
--accent-fg: var(--domi-leaf-fg);
|
||||
--leaf: var(--domi-leaf);
|
||||
--leaf-edge: var(--domi-leaf-edge);
|
||||
--rim-top: var(--domi-rim);
|
||||
--second: var(--domi-second);
|
||||
--danger: var(--domi-danger);
|
||||
--danger-fg: var(--domi-danger-fg);
|
||||
--ok: var(--domi-ok);
|
||||
--warning: var(--domi-warning);
|
||||
--tint: var(--domi-tint);
|
||||
--halo: var(--domi-halo);
|
||||
--sheen: var(--domi-sheen);
|
||||
--sheen-strong: var(--domi-sheen-strong);
|
||||
--leaf-hover: var(--domi-leaf-hover);
|
||||
--leaf-press: var(--domi-leaf-press);
|
||||
--leaf-bevel: var(--domi-leaf-bevel);
|
||||
--leaf-bevel-press: var(--domi-leaf-bevel-press);
|
||||
--edge-accent: var(--domi-edge-accent);
|
||||
--edge-danger: var(--domi-edge-danger);
|
||||
--tint-danger: var(--domi-tint-danger);
|
||||
--primary-fill: var(--domi-leaf);
|
||||
--primary-edge: var(--domi-leaf-edge);
|
||||
--inscription: var(--domi-font-inscription);
|
||||
--book: var(--domi-font-book);
|
||||
--hand: var(--domi-font-hand);
|
||||
--code: var(--domi-font-code);
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/* epistula's token names before @domi/ui, as aliases. GENERATED by tools/build-legacy.mjs: do not edit. */
|
||||
/* Load after @domi/ui/domi.css. Temporary: rename usages to --domi-* and drop this file. */
|
||||
:root {
|
||||
--bg: var(--domi-bg);
|
||||
--chrome: var(--domi-chrome);
|
||||
--chrome-top: var(--domi-chrome-top);
|
||||
--panel: var(--domi-panel);
|
||||
--hover: var(--domi-hover);
|
||||
--line: var(--domi-line);
|
||||
--edge: var(--domi-edge);
|
||||
--field: var(--domi-field);
|
||||
--fg: var(--domi-fg);
|
||||
--fg-2: var(--domi-fg-2);
|
||||
--muted: var(--domi-muted);
|
||||
--disabled: var(--domi-disabled);
|
||||
--plate-top: var(--domi-plate-top);
|
||||
--plate-bottom: var(--domi-plate-bottom);
|
||||
--plate-top-hover: var(--domi-plate-top-hover);
|
||||
--plate-bottom-hover: var(--domi-plate-bottom-hover);
|
||||
--accent: var(--domi-accent);
|
||||
--accent-strong: var(--domi-accent-strong);
|
||||
--accent-fg: var(--domi-leaf-fg);
|
||||
--leaf: var(--domi-leaf);
|
||||
--leaf-edge: var(--domi-leaf-edge);
|
||||
--rim-top: var(--domi-rim);
|
||||
--second: var(--domi-second);
|
||||
--danger: var(--domi-danger);
|
||||
--danger-fg: var(--domi-danger-fg);
|
||||
--ok: var(--domi-ok);
|
||||
--warning: var(--domi-warning);
|
||||
--tint: var(--domi-tint);
|
||||
--halo: var(--domi-halo);
|
||||
--sheen: var(--domi-sheen);
|
||||
--sheen-strong: var(--domi-sheen-strong);
|
||||
--leaf-hover: var(--domi-leaf-hover);
|
||||
--leaf-press: var(--domi-leaf-press);
|
||||
--leaf-bevel: var(--domi-leaf-bevel);
|
||||
--leaf-bevel-press: var(--domi-leaf-bevel-press);
|
||||
--edge-accent: var(--domi-edge-accent);
|
||||
--edge-danger: var(--domi-edge-danger);
|
||||
--tint-danger: var(--domi-tint-danger);
|
||||
--primary-fill: var(--domi-leaf);
|
||||
--primary-edge: var(--domi-leaf-edge);
|
||||
--inscription: var(--domi-font-inscription);
|
||||
--book: var(--domi-font-book);
|
||||
--hand: var(--domi-font-hand);
|
||||
--code: var(--domi-font-code);
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/* fabrica's token names before @domi/ui, as aliases. GENERATED by tools/build-legacy.mjs: do not edit. */
|
||||
/* Load after @domi/ui/domi.css. Temporary: rename usages to --domi-* and drop this file. */
|
||||
:root {
|
||||
--bg: var(--domi-bg);
|
||||
--chrome: var(--domi-chrome);
|
||||
--chrome-top: var(--domi-chrome-top);
|
||||
--panel: var(--domi-panel);
|
||||
--hover: var(--domi-hover);
|
||||
--line: var(--domi-line);
|
||||
--edge: var(--domi-edge);
|
||||
--field: var(--domi-field);
|
||||
--fg: var(--domi-fg);
|
||||
--fg-2: var(--domi-fg-2);
|
||||
--muted: var(--domi-muted);
|
||||
--disabled: var(--domi-disabled);
|
||||
--plate-top: var(--domi-plate-top);
|
||||
--plate-bottom: var(--domi-plate-bottom);
|
||||
--plate-top-hover: var(--domi-plate-top-hover);
|
||||
--plate-bottom-hover: var(--domi-plate-bottom-hover);
|
||||
--accent: var(--domi-accent);
|
||||
--accent-strong: var(--domi-accent-strong);
|
||||
--accent-fg: var(--domi-leaf-fg);
|
||||
--leaf: var(--domi-leaf);
|
||||
--leaf-edge: var(--domi-leaf-edge);
|
||||
--rim-top: var(--domi-rim);
|
||||
--second: var(--domi-second);
|
||||
--danger: var(--domi-danger);
|
||||
--danger-fg: var(--domi-danger-fg);
|
||||
--ok: var(--domi-ok);
|
||||
--warning: var(--domi-warning);
|
||||
--tint: var(--domi-tint);
|
||||
--halo: var(--domi-halo);
|
||||
--sheen: var(--domi-sheen);
|
||||
--sheen-strong: var(--domi-sheen-strong);
|
||||
--leaf-hover: var(--domi-leaf-hover);
|
||||
--leaf-press: var(--domi-leaf-press);
|
||||
--leaf-bevel: var(--domi-leaf-bevel);
|
||||
--leaf-bevel-press: var(--domi-leaf-bevel-press);
|
||||
--edge-accent: var(--domi-edge-accent);
|
||||
--edge-danger: var(--domi-edge-danger);
|
||||
--tint-danger: var(--domi-tint-danger);
|
||||
--primary-fill: var(--domi-leaf);
|
||||
--primary-edge: var(--domi-leaf-edge);
|
||||
--inscription: var(--domi-font-inscription);
|
||||
--book: var(--domi-font-book);
|
||||
--hand: var(--domi-font-hand);
|
||||
--code: var(--domi-font-code);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/* famulus's token names before @domi/ui, as aliases. GENERATED by tools/build-legacy.mjs: do not edit. */
|
||||
/* Load after @domi/ui/domi.css. Temporary: rename usages to --domi-* and drop this file. */
|
||||
:root {
|
||||
--famulus-ground: var(--domi-bg);
|
||||
--famulus-night-high: var(--domi-chrome);
|
||||
--famulus-surface: var(--domi-panel);
|
||||
--famulus-row-hover: var(--domi-hover);
|
||||
--famulus-line: var(--domi-line);
|
||||
--famulus-field: var(--domi-field);
|
||||
--famulus-text: var(--domi-fg);
|
||||
--famulus-soft: var(--domi-fg-2);
|
||||
--famulus-quiet: var(--domi-muted);
|
||||
--famulus-quieter: var(--domi-disabled);
|
||||
--famulus-gold: var(--domi-accent);
|
||||
--famulus-gold-bright: var(--domi-accent-strong);
|
||||
--famulus-leaf-light: var(--domi-leaf-hi);
|
||||
--famulus-leaf-mid: var(--domi-leaf-mid);
|
||||
--famulus-leaf-shadow: var(--domi-leaf-lo);
|
||||
--famulus-glint: var(--domi-leaf-edge);
|
||||
--famulus-on-gold: var(--domi-leaf-fg);
|
||||
--famulus-gold-deep: var(--domi-rim);
|
||||
--famulus-moonlight: var(--domi-second);
|
||||
--famulus-sage: var(--domi-ok);
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/* fiscus's token names before @domi/ui, as aliases. GENERATED by tools/build-legacy.mjs: do not edit. */
|
||||
/* Load after @domi/ui/domi.css. Temporary: rename usages to --domi-* and drop this file. */
|
||||
:root {
|
||||
--bg: var(--domi-bg);
|
||||
--chrome: var(--domi-chrome);
|
||||
--chrome-top: var(--domi-chrome-top);
|
||||
--panel: var(--domi-panel);
|
||||
--hover: var(--domi-hover);
|
||||
--line: var(--domi-line);
|
||||
--edge: var(--domi-edge);
|
||||
--field: var(--domi-field);
|
||||
--fg: var(--domi-fg);
|
||||
--fg-2: var(--domi-fg-2);
|
||||
--muted: var(--domi-muted);
|
||||
--disabled: var(--domi-disabled);
|
||||
--plate-top: var(--domi-plate-top);
|
||||
--plate-bottom: var(--domi-plate-bottom);
|
||||
--plate-top-hover: var(--domi-plate-top-hover);
|
||||
--plate-bottom-hover: var(--domi-plate-bottom-hover);
|
||||
--accent: var(--domi-accent);
|
||||
--accent-strong: var(--domi-accent-strong);
|
||||
--accent-fg: var(--domi-leaf-fg);
|
||||
--leaf: var(--domi-leaf);
|
||||
--leaf-edge: var(--domi-leaf-edge);
|
||||
--rim-top: var(--domi-rim);
|
||||
--second: var(--domi-second);
|
||||
--danger: var(--domi-danger);
|
||||
--danger-fg: var(--domi-danger-fg);
|
||||
--ok: var(--domi-ok);
|
||||
--warning: var(--domi-warning);
|
||||
--tint: var(--domi-tint);
|
||||
--halo: var(--domi-halo);
|
||||
--sheen: var(--domi-sheen);
|
||||
--sheen-strong: var(--domi-sheen-strong);
|
||||
--leaf-hover: var(--domi-leaf-hover);
|
||||
--leaf-press: var(--domi-leaf-press);
|
||||
--leaf-bevel: var(--domi-leaf-bevel);
|
||||
--leaf-bevel-press: var(--domi-leaf-bevel-press);
|
||||
--edge-accent: var(--domi-edge-accent);
|
||||
--edge-danger: var(--domi-edge-danger);
|
||||
--tint-danger: var(--domi-tint-danger);
|
||||
--primary-fill: var(--domi-leaf);
|
||||
--primary-edge: var(--domi-leaf-edge);
|
||||
--inscription: var(--domi-font-inscription);
|
||||
--book: var(--domi-font-book);
|
||||
--hand: var(--domi-font-hand);
|
||||
--code: var(--domi-font-code);
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/* fundamentum's token names before @domi/ui, as aliases. GENERATED by tools/build-legacy.mjs: do not edit. */
|
||||
/* Load after @domi/ui/domi.css. Temporary: rename usages to --domi-* and drop this file. */
|
||||
.theme-fundamentum {
|
||||
--bg: var(--domi-bg);
|
||||
--chrome: var(--domi-chrome);
|
||||
--chrome-top: var(--domi-chrome-top);
|
||||
--panel: var(--domi-panel);
|
||||
--hover: var(--domi-hover);
|
||||
--line: var(--domi-line);
|
||||
--edge: var(--domi-edge);
|
||||
--field: var(--domi-field);
|
||||
--fg: var(--domi-fg);
|
||||
--fg-2: var(--domi-fg-2);
|
||||
--muted: var(--domi-muted);
|
||||
--disabled: var(--domi-disabled);
|
||||
--plate-top: var(--domi-plate-top);
|
||||
--plate-bottom: var(--domi-plate-bottom);
|
||||
--plate-top-hover: var(--domi-plate-top-hover);
|
||||
--plate-bottom-hover: var(--domi-plate-bottom-hover);
|
||||
--accent: var(--domi-accent);
|
||||
--accent-strong: var(--domi-accent-strong);
|
||||
--accent-fg: var(--domi-leaf-fg);
|
||||
--leaf: var(--domi-leaf);
|
||||
--leaf-edge: var(--domi-leaf-edge);
|
||||
--rim-top: var(--domi-rim);
|
||||
--second: var(--domi-second);
|
||||
--danger: var(--domi-danger);
|
||||
--danger-fg: var(--domi-danger-fg);
|
||||
--ok: var(--domi-ok);
|
||||
--warning: var(--domi-warning);
|
||||
--tint: var(--domi-tint);
|
||||
--halo: var(--domi-halo);
|
||||
--sheen: var(--domi-sheen);
|
||||
--sheen-strong: var(--domi-sheen-strong);
|
||||
--leaf-hover: var(--domi-leaf-hover);
|
||||
--leaf-press: var(--domi-leaf-press);
|
||||
--leaf-bevel: var(--domi-leaf-bevel);
|
||||
--leaf-bevel-press: var(--domi-leaf-bevel-press);
|
||||
--edge-accent: var(--domi-edge-accent);
|
||||
--edge-danger: var(--domi-edge-danger);
|
||||
--tint-danger: var(--domi-tint-danger);
|
||||
--primary-fill: var(--domi-leaf);
|
||||
--primary-edge: var(--domi-leaf-edge);
|
||||
--inscription: var(--domi-font-inscription);
|
||||
--book: var(--domi-font-book);
|
||||
--hand: var(--domi-font-hand);
|
||||
--code: var(--domi-font-code);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/* ianitor's token names before @domi/ui, as aliases. GENERATED by tools/build-legacy.mjs: do not edit. */
|
||||
/* Load after @domi/ui/domi.css. Temporary: rename usages to --domi-* and drop this file. */
|
||||
.ia {
|
||||
--ground: var(--domi-bg);
|
||||
--colonnade: var(--domi-chrome);
|
||||
--surface: var(--domi-panel);
|
||||
--surface-2: var(--domi-hover);
|
||||
--hairline: var(--domi-line);
|
||||
--control-edge: var(--domi-edge);
|
||||
--text: var(--domi-fg);
|
||||
--text-2: var(--domi-fg-2);
|
||||
--muted: var(--domi-muted);
|
||||
--disabled: var(--domi-disabled);
|
||||
--accent: var(--domi-accent);
|
||||
--accent-strong: var(--domi-accent-strong);
|
||||
--primary-high: var(--domi-leaf-hi);
|
||||
--primary-mid: var(--domi-leaf-mid);
|
||||
--primary-low: var(--domi-leaf-lo);
|
||||
--primary-edge: var(--domi-leaf-edge);
|
||||
--on-primary: var(--domi-leaf-fg);
|
||||
--second: var(--domi-second);
|
||||
--danger: var(--domi-danger);
|
||||
--on-danger: var(--domi-danger-fg);
|
||||
--healthy: var(--domi-ok);
|
||||
--degraded: var(--domi-warning);
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/* lapilli's token names before @domi/ui, as aliases. GENERATED by tools/build-legacy.mjs: do not edit. */
|
||||
/* Load after @domi/ui/domi.css. Temporary: rename usages to --domi-* and drop this file. */
|
||||
:root {
|
||||
--bg: var(--domi-bg);
|
||||
--chrome: var(--domi-chrome);
|
||||
--chrome-top: var(--domi-chrome-top);
|
||||
--panel: var(--domi-panel);
|
||||
--hover: var(--domi-hover);
|
||||
--line: var(--domi-line);
|
||||
--edge: var(--domi-edge);
|
||||
--field: var(--domi-field);
|
||||
--fg: var(--domi-fg);
|
||||
--fg-2: var(--domi-fg-2);
|
||||
--muted: var(--domi-muted);
|
||||
--disabled: var(--domi-disabled);
|
||||
--plate-top: var(--domi-plate-top);
|
||||
--plate-bottom: var(--domi-plate-bottom);
|
||||
--plate-top-hover: var(--domi-plate-top-hover);
|
||||
--plate-bottom-hover: var(--domi-plate-bottom-hover);
|
||||
--accent: var(--domi-accent);
|
||||
--accent-strong: var(--domi-accent-strong);
|
||||
--accent-fg: var(--domi-leaf-fg);
|
||||
--leaf: var(--domi-leaf);
|
||||
--leaf-edge: var(--domi-leaf-edge);
|
||||
--rim-top: var(--domi-rim);
|
||||
--second: var(--domi-second);
|
||||
--danger: var(--domi-danger);
|
||||
--danger-fg: var(--domi-danger-fg);
|
||||
--ok: var(--domi-ok);
|
||||
--warning: var(--domi-warning);
|
||||
--tint: var(--domi-tint);
|
||||
--halo: var(--domi-halo);
|
||||
--sheen: var(--domi-sheen);
|
||||
--sheen-strong: var(--domi-sheen-strong);
|
||||
--leaf-hover: var(--domi-leaf-hover);
|
||||
--leaf-press: var(--domi-leaf-press);
|
||||
--leaf-bevel: var(--domi-leaf-bevel);
|
||||
--leaf-bevel-press: var(--domi-leaf-bevel-press);
|
||||
--edge-accent: var(--domi-edge-accent);
|
||||
--edge-danger: var(--domi-edge-danger);
|
||||
--tint-danger: var(--domi-tint-danger);
|
||||
--primary-fill: var(--domi-leaf);
|
||||
--primary-edge: var(--domi-leaf-edge);
|
||||
--inscription: var(--domi-font-inscription);
|
||||
--book: var(--domi-font-book);
|
||||
--hand: var(--domi-font-hand);
|
||||
--code: var(--domi-font-code);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/* liber's token names before @domi/ui, as aliases. GENERATED by tools/build-legacy.mjs: do not edit. */
|
||||
/* Load after @domi/ui/domi.css. Temporary: rename usages to --domi-* and drop this file. */
|
||||
:root {
|
||||
--lb-ground: var(--domi-bg);
|
||||
--lb-colonnade: var(--domi-chrome);
|
||||
--lb-surface: var(--domi-panel);
|
||||
--lb-surface-2: var(--domi-hover);
|
||||
--lb-hairline: var(--domi-line);
|
||||
--lb-control-edge: var(--domi-edge);
|
||||
--lb-text: var(--domi-fg);
|
||||
--lb-text-2: var(--domi-fg-2);
|
||||
--lb-muted: var(--domi-muted);
|
||||
--lb-disabled: var(--domi-disabled);
|
||||
--lb-accent: var(--domi-accent);
|
||||
--lb-accent-strong: var(--domi-accent-strong);
|
||||
--lb-primary-high: var(--domi-leaf-hi);
|
||||
--lb-primary-mid: var(--domi-leaf-mid);
|
||||
--lb-primary-low: var(--domi-leaf-lo);
|
||||
--lb-primary-edge: var(--domi-leaf-edge);
|
||||
--lb-on-primary: var(--domi-leaf-fg);
|
||||
--lb-copper: var(--domi-second);
|
||||
--lb-danger: var(--domi-danger);
|
||||
--lb-success: var(--domi-ok);
|
||||
--lb-warning: var(--domi-warning);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
/* ludus's token names before @domi/ui, as aliases. GENERATED by tools/build-legacy.mjs: do not edit. */
|
||||
/* Load after @domi/ui/domi.css. Temporary: rename usages to --domi-* and drop this file. */
|
||||
:root {
|
||||
--lu-ground-app: var(--domi-bg);
|
||||
--lu-ground-sunken: var(--domi-chrome);
|
||||
--lu-ground-card: var(--domi-panel);
|
||||
--lu-surface: var(--domi-hover);
|
||||
--lu-hairline: var(--domi-line);
|
||||
--lu-blue-border: var(--domi-edge);
|
||||
--lu-ground-deepest: var(--domi-field);
|
||||
--lu-text-primary: var(--domi-fg);
|
||||
--lu-text-body: var(--domi-fg-2);
|
||||
--lu-text-secondary: var(--domi-muted);
|
||||
--lu-text-tertiary: var(--domi-disabled);
|
||||
--lu-primary-accent: var(--domi-accent);
|
||||
--lu-primary-bright: var(--domi-leaf-hi);
|
||||
--lu-primary: var(--domi-leaf-mid);
|
||||
--lu-primary-mid: var(--domi-leaf-lo);
|
||||
--lu-gold: var(--domi-leaf-edge);
|
||||
--lu-text-on-primary: var(--domi-leaf-fg);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/* medicus's token names before @domi/ui, as aliases. GENERATED by tools/build-legacy.mjs: do not edit. */
|
||||
/* Load after @domi/ui/domi.css. Temporary: rename usages to --domi-* and drop this file. */
|
||||
:root {
|
||||
--md-bg: var(--domi-bg);
|
||||
--md-sidebar: var(--domi-chrome);
|
||||
--md-surface: var(--domi-panel);
|
||||
--md-surface-2: var(--domi-hover);
|
||||
--md-border: var(--domi-line);
|
||||
--md-control-edge: var(--domi-edge);
|
||||
--md-text: var(--domi-fg);
|
||||
--md-text-2: var(--domi-fg-2);
|
||||
--md-text-muted: var(--domi-muted);
|
||||
--md-text-disabled: var(--domi-disabled);
|
||||
--md-accent: var(--domi-accent);
|
||||
--md-accent-strong: var(--domi-accent-strong);
|
||||
--md-primary-high: var(--domi-leaf-hi);
|
||||
--md-primary-mid: var(--domi-leaf-mid);
|
||||
--md-primary-low: var(--domi-leaf-lo);
|
||||
--md-primary-edge: var(--domi-leaf-edge);
|
||||
--md-on-primary: var(--domi-leaf-fg);
|
||||
--md-red-fill-edge: var(--domi-rim);
|
||||
--md-secondary-text: var(--domi-second);
|
||||
--md-danger: var(--domi-danger);
|
||||
--md-on-danger: var(--domi-danger-fg);
|
||||
--md-success: var(--domi-ok);
|
||||
--md-warning: var(--domi-warning);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
/* memoria's token names before @domi/ui, as aliases. GENERATED by tools/build-legacy.mjs: do not edit. */
|
||||
/* Load after @domi/ui/domi.css. Temporary: rename usages to --domi-* and drop this file. */
|
||||
:root {
|
||||
--memoria-bg: var(--domi-bg);
|
||||
--memoria-colonnade: var(--domi-chrome);
|
||||
--memoria-surface: var(--domi-panel);
|
||||
--memoria-raised: var(--domi-hover);
|
||||
--memoria-line: var(--domi-line);
|
||||
--memoria-edge: var(--domi-edge);
|
||||
--memoria-ink: var(--domi-fg);
|
||||
--memoria-ink-quiet: var(--domi-fg-2);
|
||||
--memoria-muted: var(--domi-muted);
|
||||
--memoria-accent: var(--domi-accent);
|
||||
--memoria-aerugo-strong: var(--domi-accent-strong);
|
||||
--memoria-leaf: var(--domi-leaf);
|
||||
--memoria-aerugo-ink: var(--domi-leaf-fg);
|
||||
--memoria-aerugo-deep: var(--domi-rim);
|
||||
--memoria-purpura: var(--domi-second);
|
||||
--memoria-danger: var(--domi-danger);
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/* pictor's token names before @domi/ui, as aliases. GENERATED by tools/build-legacy.mjs: do not edit. */
|
||||
/* Load after @domi/ui/domi.css. Temporary: rename usages to --domi-* and drop this file. */
|
||||
:root {
|
||||
--bg: var(--domi-bg);
|
||||
--chrome: var(--domi-chrome);
|
||||
--chrome-top: var(--domi-chrome-top);
|
||||
--panel: var(--domi-panel);
|
||||
--hover: var(--domi-hover);
|
||||
--line: var(--domi-line);
|
||||
--edge: var(--domi-edge);
|
||||
--field: var(--domi-field);
|
||||
--fg: var(--domi-fg);
|
||||
--fg-2: var(--domi-fg-2);
|
||||
--muted: var(--domi-muted);
|
||||
--disabled: var(--domi-disabled);
|
||||
--plate-top: var(--domi-plate-top);
|
||||
--plate-bottom: var(--domi-plate-bottom);
|
||||
--plate-top-hover: var(--domi-plate-top-hover);
|
||||
--plate-bottom-hover: var(--domi-plate-bottom-hover);
|
||||
--accent: var(--domi-accent);
|
||||
--accent-strong: var(--domi-accent-strong);
|
||||
--accent-fg: var(--domi-leaf-fg);
|
||||
--leaf: var(--domi-leaf);
|
||||
--leaf-edge: var(--domi-leaf-edge);
|
||||
--rim-top: var(--domi-rim);
|
||||
--second: var(--domi-second);
|
||||
--danger: var(--domi-danger);
|
||||
--danger-fg: var(--domi-danger-fg);
|
||||
--ok: var(--domi-ok);
|
||||
--warning: var(--domi-warning);
|
||||
--tint: var(--domi-tint);
|
||||
--halo: var(--domi-halo);
|
||||
--sheen: var(--domi-sheen);
|
||||
--sheen-strong: var(--domi-sheen-strong);
|
||||
--leaf-hover: var(--domi-leaf-hover);
|
||||
--leaf-press: var(--domi-leaf-press);
|
||||
--leaf-bevel: var(--domi-leaf-bevel);
|
||||
--leaf-bevel-press: var(--domi-leaf-bevel-press);
|
||||
--edge-accent: var(--domi-edge-accent);
|
||||
--edge-danger: var(--domi-edge-danger);
|
||||
--tint-danger: var(--domi-tint-danger);
|
||||
--primary-fill: var(--domi-leaf);
|
||||
--primary-edge: var(--domi-leaf-edge);
|
||||
--inscription: var(--domi-font-inscription);
|
||||
--book: var(--domi-font-book);
|
||||
--hand: var(--domi-font-hand);
|
||||
--code: var(--domi-font-code);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
/* postea's token names before @domi/ui, as aliases. GENERATED by tools/build-legacy.mjs: do not edit. */
|
||||
/* Load after @domi/ui/domi.css. Temporary: rename usages to --domi-* and drop this file. */
|
||||
:root {
|
||||
--postea-color-bg-app: var(--domi-bg);
|
||||
--postea-color-bg-panel: var(--domi-chrome);
|
||||
--postea-color-bg-surface: var(--domi-panel);
|
||||
--postea-color-rule-base: var(--domi-line);
|
||||
--postea-color-accent-dim: var(--domi-edge);
|
||||
--postea-color-text-heading: var(--domi-fg);
|
||||
--postea-color-text-soft: var(--domi-fg-2);
|
||||
--postea-color-text-muted: var(--domi-muted);
|
||||
--postea-color-text-faint: var(--domi-disabled);
|
||||
--postea-color-accent-base: var(--domi-accent);
|
||||
--postea-color-accent-bright: var(--domi-accent-strong);
|
||||
--postea-color-primary-base: var(--domi-leaf-mid);
|
||||
--postea-color-primary-deep: var(--domi-leaf-lo);
|
||||
--postea-color-accent-mid: var(--domi-leaf-edge);
|
||||
--postea-color-gold-base: var(--domi-second);
|
||||
--postea-color-risk-onDark: var(--domi-danger);
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/* respicio's token names before @domi/ui, as aliases. GENERATED by tools/build-legacy.mjs: do not edit. */
|
||||
/* Load after @domi/ui/domi.css. Temporary: rename usages to --domi-* and drop this file. */
|
||||
:root {
|
||||
--bg: var(--domi-bg);
|
||||
--colonnade: var(--domi-chrome);
|
||||
--surface: var(--domi-panel);
|
||||
--surface-2: var(--domi-hover);
|
||||
--border: var(--domi-line);
|
||||
--field-edge: var(--domi-edge);
|
||||
--text: var(--domi-fg);
|
||||
--text-2: var(--domi-fg-2);
|
||||
--muted: var(--domi-muted);
|
||||
--disabled: var(--domi-disabled);
|
||||
--accent: var(--domi-accent);
|
||||
--accent-strong: var(--domi-accent-strong);
|
||||
--leaf-mid: var(--domi-leaf-mid);
|
||||
--leaf-low: var(--domi-leaf-lo);
|
||||
--leaf-edge: var(--domi-leaf-edge);
|
||||
--ink: var(--domi-leaf-fg);
|
||||
--info: var(--domi-second);
|
||||
--danger: var(--domi-danger);
|
||||
--ok: var(--domi-ok);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
/* tabula's token names before @domi/ui, as aliases. GENERATED by tools/build-legacy.mjs: do not edit. */
|
||||
/* Load after @domi/ui/domi.css. Temporary: rename usages to --domi-* and drop this file. */
|
||||
:root {
|
||||
--tbl-window: var(--domi-bg);
|
||||
--tbl-panel: var(--domi-chrome);
|
||||
--tbl-card: var(--domi-panel);
|
||||
--tbl-rule: var(--domi-line);
|
||||
--tbl-gold-dim: var(--domi-edge);
|
||||
--tbl-field: var(--domi-field);
|
||||
--tbl-ink: var(--domi-fg);
|
||||
--tbl-ink-dim: var(--domi-fg-2);
|
||||
--tbl-ink-muted: var(--domi-muted);
|
||||
--tbl-ink-faint: var(--domi-disabled);
|
||||
--tbl-gold: var(--domi-accent);
|
||||
--tbl-gold-light: var(--domi-accent-strong);
|
||||
--tbl-gold-deep: var(--domi-leaf-lo);
|
||||
--tbl-gold-pale: var(--domi-leaf-edge);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/* tectum's token names before @domi/ui, as aliases. GENERATED by tools/build-legacy.mjs: do not edit. */
|
||||
/* Load after @domi/ui/domi.css. Temporary: rename usages to --domi-* and drop this file. */
|
||||
:root {
|
||||
--td-bg: var(--domi-bg);
|
||||
--td-sidebar: var(--domi-chrome);
|
||||
--td-surface: var(--domi-panel);
|
||||
--td-surface-2: var(--domi-hover);
|
||||
--td-border: var(--domi-line);
|
||||
--td-control-edge: var(--domi-edge);
|
||||
--td-text: var(--domi-fg);
|
||||
--td-text-2: var(--domi-fg-2);
|
||||
--td-text-muted: var(--domi-muted);
|
||||
--td-accent: var(--domi-accent);
|
||||
--td-accent-hover: var(--domi-accent-strong);
|
||||
--td-leaf-high: var(--domi-leaf-hi);
|
||||
--td-leaf-mid: var(--domi-leaf-mid);
|
||||
--td-leaf-low: var(--domi-leaf-lo);
|
||||
--td-leaf-edge: var(--domi-leaf-edge);
|
||||
--td-on-accent: var(--domi-leaf-fg);
|
||||
--td-legal: var(--domi-second);
|
||||
--td-danger: var(--domi-danger);
|
||||
--td-success: var(--domi-ok);
|
||||
--td-warning: var(--domi-warning);
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,20 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
// @domi/ui: import the components here and the styles once, at the app root:
|
||||
// import '@domi/ui/domi.css';
|
||||
// import { Button, TextField } from '@domi/ui';
|
||||
export { default as Button } from './components/Button.svelte';
|
||||
export { default as TextField } from './components/TextField.svelte';
|
||||
export { default as Checkbox } from './components/Checkbox.svelte';
|
||||
export { default as Radio } from './components/Radio.svelte';
|
||||
export { default as Switch } from './components/Switch.svelte';
|
||||
export { default as Select } from './components/Select.svelte';
|
||||
export { default as Segmented } from './components/Segmented.svelte';
|
||||
export { default as Icon } from './components/Icon.svelte';
|
||||
export { default as Strike } from './components/Strike.svelte';
|
||||
|
||||
export { strike } from './lib/strike';
|
||||
export { icons, type IconName } from './lib/icons';
|
||||
export { enterAction, canSend, isSoftKeyboard, failureText, DomiError } from './lib/keys';
|
||||
export type { EnterKey, EnterContext, EnterResult, FieldState, ButtonState } from './lib/keys';
|
||||
export type { DomiOption, ButtonVariant, ControlSize, FieldAction, DomiTheme, DomiDensity } from './types';
|
||||
export { tokens, appIds, type DomiAppId } from './tokens/generated';
|
||||
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* The Domi icon set: 24-unit stroke paths, drawn with stroke="currentColor", 1.8 wide, round caps and joins.
|
||||
* Icons sit beside words; an icon alone always comes with an accessible name on its button.
|
||||
*/
|
||||
export const icons = {
|
||||
send: 'M4.5 12h13M12.5 6.5 18 12l-5.5 5.5',
|
||||
search: 'M10.5 17a6.5 6.5 0 1 0 0-13 6.5 6.5 0 0 0 0 13ZM15.5 15.5 20 20',
|
||||
next: 'M6 9.5 12 15l6-5.5',
|
||||
save: 'M5 12.5 10 17.5 19 7',
|
||||
check: 'M5 12.5 10 17.5 19 7',
|
||||
close: 'M6.5 6.5 17.5 17.5M17.5 6.5 6.5 17.5',
|
||||
plus: 'M12 5v14M5 12h14',
|
||||
minus: 'M5 12h14',
|
||||
trash: 'M5 7h14M10 7V5h4v2M7 7l1 12h8l1-12M10.5 10.5v5.5M13.5 10.5v5.5',
|
||||
alert: 'M12 4 21 19.5H3L12 4ZM12 10v4.5M12 17.2v.1',
|
||||
info: 'M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18ZM12 11v5.5M12 7.8v.1',
|
||||
eye: 'M2.5 12S6 5.5 12 5.5 21.5 12 21.5 12 18 18.5 12 18.5 2.5 12 2.5 12ZM12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z',
|
||||
'eye-off': 'M4 4l16 16M9.9 5.8A8.8 8.8 0 0 1 12 5.5c6 0 9.5 6.5 9.5 6.5a16 16 0 0 1-3 3.8M6.5 7.3A15.6 15.6 0 0 0 2.5 12S6 18.5 12 18.5c1.7 0 3.2-.5 4.4-1.2M10 10a3 3 0 0 0 4 4',
|
||||
'chevron-down': 'M6 9.5 12 15l6-5.5',
|
||||
'chevron-right': 'M9.5 6 15 12l-5.5 6',
|
||||
'arrow-left': 'M19.5 12h-13M11.5 6.5 6 12l5.5 5.5',
|
||||
retry: 'M4.5 12a7.5 7.5 0 1 0 2.2-5.3M4.5 4.5v4h4',
|
||||
edit: 'M4.5 19.5 5.5 15 15.5 5a2.1 2.1 0 0 1 3 3l-10 10-4 1.5ZM13.5 7l3 3',
|
||||
copy: 'M9 9h10.5v10.5H9zM15 9V4.5H4.5V15H9',
|
||||
lock: 'M6 11h12v9H6zM8.5 11V8a3.5 3.5 0 1 1 7 0v3',
|
||||
} as const;
|
||||
|
||||
export type IconName = keyof typeof icons;
|
||||
@@ -0,0 +1,67 @@
|
||||
/** What Enter does in a field with a send button. Pure, so the flow is tested without a browser. */
|
||||
export type EnterResult = 'send' | 'newline' | 'ignore';
|
||||
|
||||
export interface EnterKey {
|
||||
key: string;
|
||||
shiftKey?: boolean;
|
||||
ctrlKey?: boolean;
|
||||
metaKey?: boolean;
|
||||
altKey?: boolean;
|
||||
/** True while an input method (Chinese, Japanese, a phone keyboard's suggestion) is composing. */
|
||||
isComposing?: boolean;
|
||||
keyCode?: number;
|
||||
}
|
||||
|
||||
export interface EnterContext {
|
||||
multiline: boolean;
|
||||
/**
|
||||
* 'auto' (default): Enter sends, except in a multi-line field on a touch-only device, where a soft keyboard has
|
||||
* no Shift: there Enter makes a new line and the seal sends. 'always': Enter always sends (Shift+Enter is a new
|
||||
* line). 'never': Enter never sends (a multi-line field for long writing; Ctrl/Cmd+Enter still sends).
|
||||
*/
|
||||
enterSends?: 'auto' | 'always' | 'never';
|
||||
/** True on a device whose only pointer is coarse (a phone). */
|
||||
softKeyboard?: boolean;
|
||||
}
|
||||
|
||||
export function enterAction(e: EnterKey, ctx: EnterContext): EnterResult {
|
||||
if (e.key !== 'Enter') return 'ignore';
|
||||
// keyCode 229 is the IME's own Enter on some Android keyboards and Safari.
|
||||
if (e.isComposing || e.keyCode === 229) return 'ignore';
|
||||
if (e.ctrlKey || e.metaKey) return 'send';
|
||||
if (!ctx.multiline) return e.altKey ? 'ignore' : 'send';
|
||||
if (e.shiftKey || e.altKey) return 'newline';
|
||||
const mode = ctx.enterSends ?? 'auto';
|
||||
if (mode === 'never') return 'newline';
|
||||
if (mode === 'auto' && ctx.softKeyboard) return 'newline';
|
||||
return 'send';
|
||||
}
|
||||
|
||||
/** A field can send when it holds more than white space and is not already busy. */
|
||||
export function canSend(value: string, state: FieldState, disabled = false): boolean {
|
||||
return !disabled && state !== 'sending' && value.trim().length > 0;
|
||||
}
|
||||
|
||||
export type FieldState = 'idle' | 'sending' | 'sent' | 'error';
|
||||
export type ButtonState = 'idle' | 'loading' | 'success' | 'error';
|
||||
|
||||
/** Only a phone-like device: no fine pointer anywhere. Safe to call during SSR. */
|
||||
export function isSoftKeyboard(): boolean {
|
||||
if (typeof matchMedia !== 'function') return false;
|
||||
return matchMedia('(pointer: coarse)').matches && !matchMedia('(any-pointer: fine)').matches;
|
||||
}
|
||||
|
||||
/** The plain message for a failed send: the error's own text when it is meant for people, else a default. */
|
||||
export function failureText(err: unknown, fallback: string): string {
|
||||
if (err instanceof DomiError) return err.message;
|
||||
if (typeof err === 'string' && err.trim()) return err;
|
||||
return fallback;
|
||||
}
|
||||
|
||||
/** Throw this from onsend / onclick to show its message to the person. Any other error shows the default. */
|
||||
export class DomiError extends Error {
|
||||
constructor(message: string) {
|
||||
super(message);
|
||||
this.name = 'DomiError';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
import type { Action } from 'svelte/action';
|
||||
|
||||
/**
|
||||
* The press flow of every Domi button: on pointer down it places the seal impression where the press landed
|
||||
* (--_px, --_py) and replays it (data-struck); Enter and Space show the sunk plate while held (data-pressed), so a
|
||||
* keyboard press looks like a pointer press. Reduced motion is handled in CSS (no impression, no movement).
|
||||
*/
|
||||
export const strike: Action<HTMLElement> = (node) => {
|
||||
const replay = (x: string, y: string) => {
|
||||
node.style.setProperty('--_px', x);
|
||||
node.style.setProperty('--_py', y);
|
||||
node.removeAttribute('data-struck');
|
||||
// Force a style flush so the animation restarts on a quick second press.
|
||||
void node.offsetWidth;
|
||||
node.setAttribute('data-struck', '');
|
||||
};
|
||||
const down = (e: PointerEvent) => {
|
||||
if (e.button !== 0 || isInert(node)) return;
|
||||
const r = node.getBoundingClientRect();
|
||||
replay(`${e.clientX - r.left}px`, `${e.clientY - r.top}px`);
|
||||
};
|
||||
const keydown = (e: KeyboardEvent) => {
|
||||
if ((e.key === 'Enter' || e.key === ' ') && !e.repeat && !isInert(node)) {
|
||||
node.setAttribute('data-pressed', '');
|
||||
replay('50%', '50%');
|
||||
}
|
||||
};
|
||||
const release = () => node.removeAttribute('data-pressed');
|
||||
const end = (e: AnimationEvent) => {
|
||||
if (e.target === node && e.pseudoElement === '::after') node.removeAttribute('data-struck');
|
||||
};
|
||||
node.addEventListener('pointerdown', down);
|
||||
node.addEventListener('keydown', keydown);
|
||||
node.addEventListener('keyup', release);
|
||||
node.addEventListener('blur', release);
|
||||
node.addEventListener('animationend', end);
|
||||
return {
|
||||
destroy() {
|
||||
node.removeEventListener('pointerdown', down);
|
||||
node.removeEventListener('keydown', keydown);
|
||||
node.removeEventListener('keyup', release);
|
||||
node.removeEventListener('blur', release);
|
||||
node.removeEventListener('animationend', end);
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
function isInert(node: HTMLElement): boolean {
|
||||
return (node as HTMLButtonElement).disabled === true || node.getAttribute('aria-disabled') === 'true';
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,15 @@
|
||||
import type { IconName } from './lib/icons';
|
||||
|
||||
/** One choice of a Select or a Segmented control. */
|
||||
export interface DomiOption {
|
||||
value: string;
|
||||
label: string;
|
||||
icon?: IconName;
|
||||
disabled?: boolean;
|
||||
}
|
||||
|
||||
export type ButtonVariant = 'plate' | 'primary' | 'quiet' | 'danger';
|
||||
export type ControlSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
||||
export type FieldAction = 'send' | 'search' | 'next' | 'save';
|
||||
export type DomiTheme = 'dark' | 'light' | 'auto';
|
||||
export type DomiDensity = 'pointer' | 'touch';
|
||||
Reference in New Issue
Block a user