@atlasauth/embed 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +39 -0
- package/dist/appearance.d.ts +6 -0
- package/dist/appearance.js +14 -0
- package/dist/appearance.js.map +1 -1
- package/dist/embed.js +17 -8
- package/dist/styles.d.ts +1 -1
- package/dist/styles.js +15 -6
- package/dist/styles.js.map +1 -1
- package/dist/widget/captcha.d.ts +12 -18
- package/dist/widget/captcha.js +14 -188
- package/dist/widget/captcha.js.map +1 -1
- package/dist/widget.js +2 -0
- package/dist/widget.js.map +1 -1
- package/package.json +4 -3
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# @atlasauth/embed changelog
|
|
2
|
+
|
|
3
|
+
## 0.2.1
|
|
4
|
+
- The widget's captcha loader/renderer now comes from `@atlasauth/js` (the same one the React
|
|
5
|
+
components use). No behaviour change; a failed provider script load is now retried on the next
|
|
6
|
+
attempt instead of failing until reload.
|
|
7
|
+
|
|
8
|
+
- **Accessibility.** The primary button label colour is picked for contrast from the primary colour
|
|
9
|
+
(white or near-black) instead of a fixed white; override it with the new `--atlas-embed-color-text-on-primary`
|
|
10
|
+
CSS variable. Buttons, social buttons, links and toggles show a solid 2px `:focus-visible` outline
|
|
11
|
+
(`--atlas-embed-color-focus-ring`, default the primary). Text fields and the social search box are 16px, so
|
|
12
|
+
iOS Safari no longer zooms on focus.
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## 0.2.0
|
|
16
|
+
- **Design system.** `<atlas-sign-in>` / `<atlas-sign-up>` and `mount()` apply the design configured in
|
|
17
|
+
the Atlas dashboard (from `/v1/appearance`): palette, radius, font, button/input style, shadow,
|
|
18
|
+
density and social layout map onto the widget's tokens and interaction settings.
|
|
19
|
+
- **New inline `appearance.preset` and `appearance.design`** (and `data-atlas-preset` on the element) —
|
|
20
|
+
the same settings and semantics as `@atlasauth/react`: tenant branding < dashboard design < `preset`
|
|
21
|
+
< `variables` < `design`. Opt out of the dashboard design with `appearance.instanceDesign: false`.
|
|
22
|
+
- The widget root carries the stable `data-atlas-*` design attributes (the widget keeps styling itself
|
|
23
|
+
through its `--atlas-embed-*` tokens; it does not ship the `--atlas-*` design stylesheet).
|
|
24
|
+
- Without a design, theming is unchanged.
|
|
25
|
+
- New dependency: `@atlasauth/design` — only its zod-free runtime entry is bundled into `embed.js`
|
|
26
|
+
(about +21 KB minified).
|
|
27
|
+
|
|
28
|
+
## 0.1.2
|
|
29
|
+
- **Fixed: provider icons.** Social-button provider icons now carry an intrinsic 18px size, so they no longer collapse to 0px where no CSS sizes them. The widget's own styles still size them per button size.
|
|
30
|
+
|
|
31
|
+
## 0.1.1
|
|
32
|
+
- First published release.
|
|
33
|
+
- **Framework-agnostic sign-in widget.** Use the `<atlas-sign-in>` / `<atlas-sign-up>` custom elements (register them with `defineElements()`), or mount imperatively with `mountSignIn()` / `mountSignUp()`. The standalone `embed.js` bundle registers the elements and exposes `window.Atlas` for script-tag use; `publishable-key`, `frontend-api` and `redirect` can be set on the elements or the script tag (`readScriptTag()`, `setScriptDefaults()`).
|
|
34
|
+
- **Sign-in and sign-up flows.** Email + password on one screen, email / SMS verification codes with a segmented code input, forgot-password and reset, show / hide password, "remember me", trusted-device ("remember this device") for two-factor, configurable sign-up fields (including long text, date, radio and multi-select), and Terms / Privacy consent on sign-up.
|
|
35
|
+
- **Passkeys.** "Sign in with a passkey", including browser autofill (conditional UI).
|
|
36
|
+
- **Social sign-in.** Brand-logo provider buttons with configurable variant, size, layout and labels, search for long provider lists, a scrollable carousel, Google's official sign-in button, Bluesky handle sign-in, and a "Sign in with Atlas" button with a popup flow.
|
|
37
|
+
- **CAPTCHA** widgets are rendered for flows that require them.
|
|
38
|
+
- **Appearance.** The widget follows the instance's branding and appearance settings (design tokens, button effects, a customizable loading state). Helpers and types such as `resolveTokens()`, `cssVariables()`, `resolveSocialButtons()`, `providerIcon()`, `WidgetAppearance` and `SocialButtonsConfig` are exported for module users.
|
|
39
|
+
- Redirect targets are checked with `validateRedirect()`.
|
package/dist/appearance.d.ts
CHANGED
|
@@ -292,6 +292,12 @@ export declare function tokensFromAppearance(appearance: PublicAppearance | null
|
|
|
292
292
|
export declare function resolveTokens(appearance: PublicAppearance | null, override?: WidgetAppearance): Required<DesignTokens>;
|
|
293
293
|
/** Tokens as `--atlas-embed-*` custom properties for the root element. */
|
|
294
294
|
export declare function cssVariables(tokens: Required<DesignTokens>): Record<string, string>;
|
|
295
|
+
/**
|
|
296
|
+
* Label colour for the primary button: white or near-black, whichever contrasts
|
|
297
|
+
* more with the primary (a fixed white label is unreadable on a light brand
|
|
298
|
+
* colour). White when the primary cannot be evaluated (`var(--brand)`).
|
|
299
|
+
*/
|
|
300
|
+
export declare function textOnPrimary(primary: string): string;
|
|
295
301
|
/** Our base class plus the page's override, appended so theirs wins on ties. */
|
|
296
302
|
export declare function classFor(element: ElementKey, base: string, override?: WidgetAppearance): string;
|
|
297
303
|
/**
|
package/dist/appearance.js
CHANGED
|
@@ -20,9 +20,11 @@ exports.resolveSocialButtons = resolveSocialButtons;
|
|
|
20
20
|
exports.tokensFromAppearance = tokensFromAppearance;
|
|
21
21
|
exports.resolveTokens = resolveTokens;
|
|
22
22
|
exports.cssVariables = cssVariables;
|
|
23
|
+
exports.textOnPrimary = textOnPrimary;
|
|
23
24
|
exports.classFor = classFor;
|
|
24
25
|
exports.orderedProviders = orderedProviders;
|
|
25
26
|
exports.providerLabel = providerLabel;
|
|
27
|
+
const runtime_1 = require("@atlasauth/design/runtime");
|
|
26
28
|
const CODE_INPUT_STYLES = ['boxes', 'single'];
|
|
27
29
|
/** Resolve the code-input style: inline override wins, then server, then `boxes`. */
|
|
28
30
|
function resolveCodeInput(server, inline) {
|
|
@@ -147,6 +149,18 @@ function cssVariables(tokens) {
|
|
|
147
149
|
}
|
|
148
150
|
return vars;
|
|
149
151
|
}
|
|
152
|
+
/**
|
|
153
|
+
* Label colour for the primary button: white or near-black, whichever contrasts
|
|
154
|
+
* more with the primary (a fixed white label is unreadable on a light brand
|
|
155
|
+
* colour). White when the primary cannot be evaluated (`var(--brand)`).
|
|
156
|
+
*/
|
|
157
|
+
function textOnPrimary(primary) {
|
|
158
|
+
const parsed = (0, runtime_1.parseCssColor)(primary);
|
|
159
|
+
if (!parsed)
|
|
160
|
+
return '#ffffff';
|
|
161
|
+
const hex = (0, runtime_1.toHex)(parsed);
|
|
162
|
+
return (0, runtime_1.contrastRatio)('#ffffff', hex) >= (0, runtime_1.contrastRatio)('#111111', hex) ? '#ffffff' : '#111111';
|
|
163
|
+
}
|
|
150
164
|
/** Our base class plus the page's override, appended so theirs wins on ties. */
|
|
151
165
|
function classFor(element, base, override) {
|
|
152
166
|
const extra = override?.elements?.[element];
|
package/dist/appearance.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appearance.js","sourceRoot":"","sources":["../src/appearance.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;
|
|
1
|
+
{"version":3,"file":"appearance.js","sourceRoot":"","sources":["../src/appearance.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;AAgEH,4CAMC;AA2FD,gDAuBC;AAqBD,oDAeC;AAkJD,oDAYC;AAOD,sCAUC;AAGD,oCAMC;AAOD,sCAKC;AAGD,4BAOC;AAUD,4CAgBC;AAuBD,sCAMC;AA/dD,uDAAgF;AA2DhF,MAAM,iBAAiB,GAA8B,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;AAEzE,qFAAqF;AACrF,SAAgB,gBAAgB,CAC9B,MAAkC,EAClC,MAAkC;IAElC,KAAK,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC;QAAE,IAAI,CAAC,IAAI,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC;YAAE,OAAO,CAAC,CAAC;IACnF,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;GAIG;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