@brad-frost-web/eddie-recipes 0.38.0 → 0.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -1
- package/recipes/common/newsletter-signup/newsletter-signup.d.ts +76 -0
- package/recipes/common/newsletter-signup/newsletter-signup.d.ts.map +1 -0
- package/recipes/common/newsletter-signup/newsletter-signup.js +74 -0
- package/recipes/common/search-form/search-form.d.ts +79 -0
- package/recipes/common/search-form/search-form.d.ts.map +1 -0
- package/recipes/common/search-form/search-form.js +81 -0
- package/recipes/common/stat-card/stat-card.d.ts +65 -0
- package/recipes/common/stat-card/stat-card.d.ts.map +1 -0
- package/recipes/common/stat-card/stat-card.js +68 -0
- package/recipes/common/transport-button/transport-button.js +5 -5
- package/recipes/tools/theme-customizer/theme-customizer.d.ts +16 -3
- package/recipes/tools/theme-customizer/theme-customizer.d.ts.map +1 -1
- package/recipes/tools/theme-customizer/theme-customizer.js +124 -120
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brad-frost-web/eddie-recipes",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.40.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
"scripts": {
|
|
11
11
|
"build": "vite build",
|
|
12
12
|
"build:cdn": "vite build --config vite.config.cdn.ts",
|
|
13
|
+
"test": "vitest run --project unit",
|
|
14
|
+
"test:watch": "vitest --project unit",
|
|
13
15
|
"plop": "plop recipe"
|
|
14
16
|
},
|
|
15
17
|
"dependencies": {
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { EdElement } from '@brad-frost-web/eddie-web-components/components/EdElement';
|
|
2
|
+
/**
|
|
3
|
+
* A newsletter signup recipe: `ed-single-field-form` configured for email capture.
|
|
4
|
+
*
|
|
5
|
+
* Composes the generic single-field-form base with newsletter-specific
|
|
6
|
+
* defaults — a required `type="email"` input with `autocomplete="email"`,
|
|
7
|
+
* an "Email address" label, a "Subscribe" submit button, and an `email`
|
|
8
|
+
* parameter name. Point `action` at your email service provider's endpoint
|
|
9
|
+
* for a native POST submission, or omit it and listen for the `submit`
|
|
10
|
+
* custom event to hand the address to your provider's API in JavaScript.
|
|
11
|
+
*
|
|
12
|
+
* Replaces the interim "borrow the search bar" workaround (see issue #1167).
|
|
13
|
+
*
|
|
14
|
+
* @use Newsletter or mailing-list signup on marketing pages, footers, and promo blocks
|
|
15
|
+
* @use Native submission to an email service provider — set `action` and `method`
|
|
16
|
+
* @use JavaScript-driven signup — omit `action` and handle the `submit` event
|
|
17
|
+
*
|
|
18
|
+
* @dontuse For multi-field signup flows (name + email + preferences) — compose a full form from `ed-text-field` and friends
|
|
19
|
+
* @dontuse For search — use `ed-r-search-form`
|
|
20
|
+
*
|
|
21
|
+
* @a11y The email field is required and typed, so submission runs native constraint validation with the browser's accessible error UI
|
|
22
|
+
* @a11y Always provide a descriptive `label` even when using `hideLabel` — the label is visually hidden but remains accessible to screen readers
|
|
23
|
+
* @a11y The `placeholder` is supplementary, not a substitute for the label
|
|
24
|
+
*/
|
|
25
|
+
export declare class EdRNewsletterSignup extends EdElement {
|
|
26
|
+
static get styles(): import('lit').CSSResult;
|
|
27
|
+
/**
|
|
28
|
+
* The unique id of the field
|
|
29
|
+
*/
|
|
30
|
+
fieldId?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Label of the email field
|
|
33
|
+
*/
|
|
34
|
+
label: string;
|
|
35
|
+
/**
|
|
36
|
+
* Visually hide the label from the UI
|
|
37
|
+
*/
|
|
38
|
+
hideLabel?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Input value
|
|
41
|
+
*/
|
|
42
|
+
value: string;
|
|
43
|
+
/**
|
|
44
|
+
* Placeholder text
|
|
45
|
+
*/
|
|
46
|
+
placeholder?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Name attribute the email address is submitted under
|
|
49
|
+
*/
|
|
50
|
+
name: string;
|
|
51
|
+
/**
|
|
52
|
+
* Signup endpoint URL (e.g. your email service provider's form action).
|
|
53
|
+
* When set, submission is a native form submission. When omitted, handle
|
|
54
|
+
* the `submit` custom event.
|
|
55
|
+
*/
|
|
56
|
+
action?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Form method used with `action`
|
|
59
|
+
*/
|
|
60
|
+
method: 'get' | 'post';
|
|
61
|
+
/**
|
|
62
|
+
* Subscribe button text
|
|
63
|
+
*/
|
|
64
|
+
buttonText: string;
|
|
65
|
+
/**
|
|
66
|
+
* Knockout color variant for dark backgrounds
|
|
67
|
+
*/
|
|
68
|
+
knockout?: boolean;
|
|
69
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
70
|
+
}
|
|
71
|
+
declare global {
|
|
72
|
+
interface HTMLElementTagNameMap {
|
|
73
|
+
'ed-r-newsletter-signup': EdRNewsletterSignup;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=newsletter-signup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"newsletter-signup.d.ts","sourceRoot":"","sources":["../../../../../packages/eddie-recipes/recipes/common/newsletter-signup/newsletter-signup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,2DAA2D,CAAC;AACtF,OAAO,qFAAqF,CAAC;AAM7F;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,mBAAoB,SAAQ,SAAS;IAChD,MAAM,KAAK,MAAM,4BAEhB;IAED;;OAEG;IAEH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IAEH,KAAK,EAAE,MAAM,CAAmB;IAEhC;;OAEG;IAEH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;OAEG;IAEH,KAAK,EAAE,MAAM,CAAM;IAEnB;;OAEG;IAEH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IAEH,IAAI,EAAE,MAAM,CAAW;IAEvB;;;;OAIG;IAEH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IAEH,MAAM,EAAE,KAAK,GAAG,MAAM,CAAU;IAEhC;;OAEG;IAEH,UAAU,EAAE,MAAM,CAAe;IAEjC;;OAEG;IAEH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,MAAM;CAsBP;AAID,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,wBAAwB,EAAE,mBAAmB,CAAC;KAC/C;CACF"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { EdElement as d } from "@brad-frost-web/eddie-web-components/components/EdElement";
|
|
2
|
+
import "@brad-frost-web/eddie-web-components/components/single-field-form/single-field-form";
|
|
3
|
+
import { unsafeCSS as h, html as m } from "lit";
|
|
4
|
+
import { property as t } from "lit/decorators.js";
|
|
5
|
+
import { ifDefined as n } from "lit-html/directives/if-defined.js";
|
|
6
|
+
const u = '@charset "UTF-8";:root,:host{--size-base-unit: .5rem}*,::slotted(*),*:before,*:after{box-sizing:border-box}h1,h2,h3,h4,h5,h6{margin:0}.ed-r-newsletter-signup{display:block}';
|
|
7
|
+
var c = Object.defineProperty, o = (i, s, a, f) => {
|
|
8
|
+
for (var r = void 0, l = i.length - 1, p; l >= 0; l--)
|
|
9
|
+
(p = i[l]) && (r = p(s, a, r) || r);
|
|
10
|
+
return r && c(s, a, r), r;
|
|
11
|
+
};
|
|
12
|
+
class e extends d {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments), this.label = "Email address", this.value = "", this.name = "email", this.method = "post", this.buttonText = "Subscribe";
|
|
15
|
+
}
|
|
16
|
+
static get styles() {
|
|
17
|
+
return h(u);
|
|
18
|
+
}
|
|
19
|
+
render() {
|
|
20
|
+
const s = this.componentClassNames("ed-r-newsletter-signup");
|
|
21
|
+
return m`
|
|
22
|
+
<ed-single-field-form
|
|
23
|
+
class="${s}"
|
|
24
|
+
type="email"
|
|
25
|
+
autocomplete="email"
|
|
26
|
+
required
|
|
27
|
+
fieldId="${n(this.fieldId)}"
|
|
28
|
+
label="${this.label}"
|
|
29
|
+
?hideLabel=${this.hideLabel}
|
|
30
|
+
.value=${this.value}
|
|
31
|
+
placeholder="${n(this.placeholder)}"
|
|
32
|
+
name="${this.name}"
|
|
33
|
+
action="${n(this.action)}"
|
|
34
|
+
method="${this.method}"
|
|
35
|
+
buttonText="${this.buttonText}"
|
|
36
|
+
?knockout=${this.knockout}
|
|
37
|
+
></ed-single-field-form>
|
|
38
|
+
`;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
o([
|
|
42
|
+
t()
|
|
43
|
+
], e.prototype, "fieldId");
|
|
44
|
+
o([
|
|
45
|
+
t()
|
|
46
|
+
], e.prototype, "label");
|
|
47
|
+
o([
|
|
48
|
+
t({ type: Boolean })
|
|
49
|
+
], e.prototype, "hideLabel");
|
|
50
|
+
o([
|
|
51
|
+
t()
|
|
52
|
+
], e.prototype, "value");
|
|
53
|
+
o([
|
|
54
|
+
t()
|
|
55
|
+
], e.prototype, "placeholder");
|
|
56
|
+
o([
|
|
57
|
+
t()
|
|
58
|
+
], e.prototype, "name");
|
|
59
|
+
o([
|
|
60
|
+
t()
|
|
61
|
+
], e.prototype, "action");
|
|
62
|
+
o([
|
|
63
|
+
t()
|
|
64
|
+
], e.prototype, "method");
|
|
65
|
+
o([
|
|
66
|
+
t()
|
|
67
|
+
], e.prototype, "buttonText");
|
|
68
|
+
o([
|
|
69
|
+
t({ type: Boolean })
|
|
70
|
+
], e.prototype, "knockout");
|
|
71
|
+
customElements.define("ed-r-newsletter-signup", e);
|
|
72
|
+
export {
|
|
73
|
+
e as EdRNewsletterSignup
|
|
74
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { EdElement } from '@brad-frost-web/eddie-web-components/components/EdElement';
|
|
2
|
+
/**
|
|
3
|
+
* A search form recipe: `ed-single-field-form` configured for search.
|
|
4
|
+
*
|
|
5
|
+
* Composes the generic single-field-form base with search-specific defaults —
|
|
6
|
+
* a `type="search"` input, a "Search" submit button, a clear control while
|
|
7
|
+
* the field has content, and a `q` parameter name. Point `action` at your
|
|
8
|
+
* search endpoint for a native GET submission (`/search?q=…`), or omit it
|
|
9
|
+
* and listen for the `submit` custom event to run search in JavaScript.
|
|
10
|
+
*
|
|
11
|
+
* This recipe supersedes the legacy `ed-search-form` core component, which
|
|
12
|
+
* is deprecated (see issue #1167).
|
|
13
|
+
*
|
|
14
|
+
* @use Site-wide or section-level search where users type a query and trigger a search action
|
|
15
|
+
* @use Native search submission — set `action` to your search results endpoint
|
|
16
|
+
* @use JavaScript-driven search — omit `action` and handle the `submit` event
|
|
17
|
+
*
|
|
18
|
+
* @dontuse As a generic text input — use `ed-text-field` for standard form fields
|
|
19
|
+
* @dontuse For non-search single-field patterns — compose `ed-single-field-form` directly or use a purpose-specific recipe like `ed-r-newsletter-signup`
|
|
20
|
+
*
|
|
21
|
+
* @a11y Always provide a descriptive `label` even when using `hideLabel` — the label is visually hidden but remains accessible to screen readers
|
|
22
|
+
* @a11y The `placeholder` is supplementary, not a substitute for the label
|
|
23
|
+
*/
|
|
24
|
+
export declare class EdRSearchForm extends EdElement {
|
|
25
|
+
static get styles(): import('lit').CSSResult;
|
|
26
|
+
/**
|
|
27
|
+
* The unique id of the field
|
|
28
|
+
*/
|
|
29
|
+
fieldId?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Label of the search field
|
|
32
|
+
*/
|
|
33
|
+
label: string;
|
|
34
|
+
/**
|
|
35
|
+
* Visually hide the label from the UI
|
|
36
|
+
*/
|
|
37
|
+
hideLabel?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Input value
|
|
40
|
+
*/
|
|
41
|
+
value: string;
|
|
42
|
+
/**
|
|
43
|
+
* Placeholder text
|
|
44
|
+
*/
|
|
45
|
+
placeholder?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Name attribute the query is submitted under
|
|
48
|
+
*/
|
|
49
|
+
name: string;
|
|
50
|
+
/**
|
|
51
|
+
* Search endpoint URL. When set, submission is a native GET submission
|
|
52
|
+
* (e.g. `/search?q=…`). When omitted, handle the `submit` custom event.
|
|
53
|
+
*/
|
|
54
|
+
action?: string;
|
|
55
|
+
/**
|
|
56
|
+
* Search button text
|
|
57
|
+
*/
|
|
58
|
+
buttonText: string;
|
|
59
|
+
/**
|
|
60
|
+
* Text for the clear button within the input
|
|
61
|
+
*/
|
|
62
|
+
clearButtonText: string;
|
|
63
|
+
/**
|
|
64
|
+
* Knockout color variant for dark backgrounds
|
|
65
|
+
*/
|
|
66
|
+
knockout?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Focus the search input. Public hook for parent patterns that reveal the
|
|
69
|
+
* form (e.g. a header search panel) and need to move focus into it.
|
|
70
|
+
*/
|
|
71
|
+
focusField(): void;
|
|
72
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
73
|
+
}
|
|
74
|
+
declare global {
|
|
75
|
+
interface HTMLElementTagNameMap {
|
|
76
|
+
'ed-r-search-form': EdRSearchForm;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=search-form.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-form.d.ts","sourceRoot":"","sources":["../../../../../packages/eddie-recipes/recipes/common/search-form/search-form.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,2DAA2D,CAAC;AACtF,OAAO,qFAAqF,CAAC;AAM7F;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAAa,aAAc,SAAQ,SAAS;IAC1C,MAAM,KAAK,MAAM,4BAEhB;IAED;;OAEG;IAEH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IAEH,KAAK,EAAE,MAAM,CAAY;IAEzB;;OAEG;IAEH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;OAEG;IAEH,KAAK,EAAE,MAAM,CAAM;IAEnB;;OAEG;IAEH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IAEH,IAAI,EAAE,MAAM,CAAO;IAEnB;;;OAGG;IAEH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IAEH,UAAU,EAAE,MAAM,CAAY;IAE9B;;OAEG;IAEH,eAAe,EAAE,MAAM,CAAW;IAElC;;OAEG;IAEH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;OAGG;IACH,UAAU;IAIV,MAAM;CAsBP;AAID,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,kBAAkB,EAAE,aAAa,CAAC;KACnC;CACF"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { EdElement as p } from "@brad-frost-web/eddie-web-components/components/EdElement";
|
|
2
|
+
import "@brad-frost-web/eddie-web-components/components/single-field-form/single-field-form";
|
|
3
|
+
import { unsafeCSS as d, html as c } from "lit";
|
|
4
|
+
import { property as t } from "lit/decorators.js";
|
|
5
|
+
import { ifDefined as i } from "lit-html/directives/if-defined.js";
|
|
6
|
+
const m = '@charset "UTF-8";:root,:host{--size-base-unit: .5rem}*,::slotted(*),*:before,*:after{box-sizing:border-box}h1,h2,h3,h4,h5,h6{margin:0}.ed-r-search-form{display:block}';
|
|
7
|
+
var f = Object.defineProperty, o = (l, s, n, u) => {
|
|
8
|
+
for (var r = void 0, a = l.length - 1, h; a >= 0; a--)
|
|
9
|
+
(h = l[a]) && (r = h(s, n, r) || r);
|
|
10
|
+
return r && f(s, n, r), r;
|
|
11
|
+
};
|
|
12
|
+
class e extends p {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments), this.label = "Search", this.value = "", this.name = "q", this.buttonText = "Search", this.clearButtonText = "Clear";
|
|
15
|
+
}
|
|
16
|
+
static get styles() {
|
|
17
|
+
return d(m);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Focus the search input. Public hook for parent patterns that reveal the
|
|
21
|
+
* form (e.g. a header search panel) and need to move focus into it.
|
|
22
|
+
*/
|
|
23
|
+
focusField() {
|
|
24
|
+
this.shadowRoot?.querySelector("ed-single-field-form")?.focusField();
|
|
25
|
+
}
|
|
26
|
+
render() {
|
|
27
|
+
const s = this.componentClassNames("ed-r-search-form");
|
|
28
|
+
return c`
|
|
29
|
+
<ed-single-field-form
|
|
30
|
+
class="${s}"
|
|
31
|
+
type="search"
|
|
32
|
+
showClear
|
|
33
|
+
fieldId="${i(this.fieldId)}"
|
|
34
|
+
label="${this.label}"
|
|
35
|
+
?hideLabel=${this.hideLabel}
|
|
36
|
+
.value=${this.value}
|
|
37
|
+
placeholder="${i(this.placeholder)}"
|
|
38
|
+
name="${this.name}"
|
|
39
|
+
action="${i(this.action)}"
|
|
40
|
+
method="get"
|
|
41
|
+
buttonText="${this.buttonText}"
|
|
42
|
+
clearButtonText="${this.clearButtonText}"
|
|
43
|
+
?knockout=${this.knockout}
|
|
44
|
+
></ed-single-field-form>
|
|
45
|
+
`;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
o([
|
|
49
|
+
t()
|
|
50
|
+
], e.prototype, "fieldId");
|
|
51
|
+
o([
|
|
52
|
+
t()
|
|
53
|
+
], e.prototype, "label");
|
|
54
|
+
o([
|
|
55
|
+
t({ type: Boolean })
|
|
56
|
+
], e.prototype, "hideLabel");
|
|
57
|
+
o([
|
|
58
|
+
t()
|
|
59
|
+
], e.prototype, "value");
|
|
60
|
+
o([
|
|
61
|
+
t()
|
|
62
|
+
], e.prototype, "placeholder");
|
|
63
|
+
o([
|
|
64
|
+
t()
|
|
65
|
+
], e.prototype, "name");
|
|
66
|
+
o([
|
|
67
|
+
t()
|
|
68
|
+
], e.prototype, "action");
|
|
69
|
+
o([
|
|
70
|
+
t()
|
|
71
|
+
], e.prototype, "buttonText");
|
|
72
|
+
o([
|
|
73
|
+
t()
|
|
74
|
+
], e.prototype, "clearButtonText");
|
|
75
|
+
o([
|
|
76
|
+
t({ type: Boolean })
|
|
77
|
+
], e.prototype, "knockout");
|
|
78
|
+
customElements.define("ed-r-search-form", e);
|
|
79
|
+
export {
|
|
80
|
+
e as EdRSearchForm
|
|
81
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { EdElement } from '@brad-frost-web/eddie-web-components/components/EdElement';
|
|
2
|
+
type HeadingTag = 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
3
|
+
/**
|
|
4
|
+
* A compact KPI display composed of `ed-card` + two `ed-heading`s +
|
|
5
|
+
* `ed-text-passage`. The label is the card's semantic heading; the value
|
|
6
|
+
* is a display-sized sub-heading; the meta line is supporting body text.
|
|
7
|
+
* Designed to sit as a peer of other stat cards inside an `ed-grid`,
|
|
8
|
+
* forming a dashboard or summary surface.
|
|
9
|
+
*
|
|
10
|
+
* The recipe is a **composition of Eddie primitives** — every visible
|
|
11
|
+
* element's typography and surface comes from Eddie atoms. The recipe's
|
|
12
|
+
* own styles only handle layout glue between the three composed pieces
|
|
13
|
+
* and the variant-based tinting of the value color.
|
|
14
|
+
*
|
|
15
|
+
* @use At the top of a dashboard page to present KPIs as a grid of cards
|
|
16
|
+
* @use On a landing page to show at-a-glance metrics
|
|
17
|
+
* @use In an admin or settings page to summarize account-level quantities
|
|
18
|
+
* @use Composing grids of KPIs by wrapping each card in `ed-grid-item`
|
|
19
|
+
* inside an `ed-grid`
|
|
20
|
+
*
|
|
21
|
+
* @dontuse For longer-form content with multiple paragraphs — use `ed-card`
|
|
22
|
+
* with `ed-text-passage` directly
|
|
23
|
+
* @dontuse As a decorative label-only element — use `ed-tag` or `ed-badge`
|
|
24
|
+
* @dontuse As a single interactive link wrapper — do not make the whole
|
|
25
|
+
* card one clickable element
|
|
26
|
+
*
|
|
27
|
+
* @a11y The label and value are both rendered via `ed-heading` at
|
|
28
|
+
* hierarchically ordered levels (label = `headingTagName`, value =
|
|
29
|
+
* one level deeper). The pair reads as a coherent heading + display
|
|
30
|
+
* headline in the document outline.
|
|
31
|
+
* @a11y Variant tones (positive / warning / danger) must never be the sole
|
|
32
|
+
* indicator of meaning — pair with clear wording in the label or
|
|
33
|
+
* meta so color is supplementary, not load-bearing (WCAG 1.4.1).
|
|
34
|
+
*
|
|
35
|
+
* @slot - The primary value — typically a large number, currency, or
|
|
36
|
+
* percentage. Plain text is the common case; a short `<span>`
|
|
37
|
+
* or a future `ed-r-sparkline` can nest here.
|
|
38
|
+
*/
|
|
39
|
+
export declare class EdRStatCard extends EdElement {
|
|
40
|
+
static get styles(): import('lit').CSSResult;
|
|
41
|
+
/**
|
|
42
|
+
* Descriptive label rendered above the value. The card's primary
|
|
43
|
+
* semantic heading — set `headingTagName` to match the surrounding
|
|
44
|
+
* document outline.
|
|
45
|
+
*/
|
|
46
|
+
label: string;
|
|
47
|
+
/**
|
|
48
|
+
* Optional secondary context line rendered beneath the value.
|
|
49
|
+
*/
|
|
50
|
+
meta: string;
|
|
51
|
+
/**
|
|
52
|
+
* Semantic tone variant. Tints the value color; paired with label/meta
|
|
53
|
+
* copy so color is never the sole indicator of meaning (WCAG 1.4.1).
|
|
54
|
+
*/
|
|
55
|
+
variant: 'default' | 'positive' | 'warning' | 'danger';
|
|
56
|
+
/**
|
|
57
|
+
* Heading tag for the label. Default `h3` assumes the card sits inside
|
|
58
|
+
* an `h2`-titled section. The value's tag is derived one level deeper
|
|
59
|
+
* (h3 → h4, h2 → h3, etc.) so the two pieces form a valid outline.
|
|
60
|
+
*/
|
|
61
|
+
headingTagName: HeadingTag;
|
|
62
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
63
|
+
}
|
|
64
|
+
export {};
|
|
65
|
+
//# sourceMappingURL=stat-card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stat-card.d.ts","sourceRoot":"","sources":["../../../../../packages/eddie-recipes/recipes/common/stat-card/stat-card.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,2DAA2D,CAAC;AACtF,OAAO,2DAA2D,CAAC;AACnE,OAAO,iEAAiE,CAAC;AACzE,OAAO,2EAA2E,CAAC;AAKnF,KAAK,UAAU,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAUnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,qBAAa,WAAY,SAAQ,SAAS;IACxC,MAAM,KAAK,MAAM,4BAEhB;IAED;;;;OAIG;IAEH,KAAK,SAAM;IAEX;;OAEG;IAEH,IAAI,SAAM;IAEV;;;OAGG;IAEH,OAAO,EAAE,SAAS,GAAG,UAAU,GAAG,SAAS,GAAG,QAAQ,CAAa;IAEnE;;;;OAIG;IAEH,cAAc,EAAE,UAAU,CAAQ;IAElC,MAAM;CA+BP"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { EdElement as h } from "@brad-frost-web/eddie-web-components/components/EdElement";
|
|
2
|
+
import "@brad-frost-web/eddie-web-components/components/card/card";
|
|
3
|
+
import "@brad-frost-web/eddie-web-components/components/heading/heading";
|
|
4
|
+
import "@brad-frost-web/eddie-web-components/components/text-passage/text-passage";
|
|
5
|
+
import { unsafeCSS as m, nothing as c, html as o } from "lit";
|
|
6
|
+
import { property as s } from "lit/decorators.js";
|
|
7
|
+
const p = '@charset "UTF-8";:root,:host{--size-base-unit: .5rem}*,::slotted(*),*:before,*:after{box-sizing:border-box}h1,h2,h3,h4,h5,h6{margin:0}.ed-r-stat-card__label{display:block;margin-block-end:.25rem}.ed-r-stat-card__value{display:block;margin:0;font-variant-numeric:tabular-nums}.ed-r-stat-card__value:not(:last-child){margin-block-end:.25rem}.ed-r-stat-card__meta{display:block}.ed-r-stat-card--positive .ed-r-stat-card__value{color:var(--ed-theme-color-content-utility-success)}.ed-r-stat-card--warning .ed-r-stat-card__value{color:var(--ed-theme-color-content-utility-warning)}.ed-r-stat-card--danger .ed-r-stat-card__value{color:var(--ed-theme-color-content-utility-error)}';
|
|
8
|
+
var u = Object.defineProperty, d = (l, e, r, v) => {
|
|
9
|
+
for (var t = void 0, i = l.length - 1, n; i >= 0; i--)
|
|
10
|
+
(n = l[i]) && (t = n(e, r, t) || t);
|
|
11
|
+
return t && u(e, r, t), t;
|
|
12
|
+
};
|
|
13
|
+
const g = {
|
|
14
|
+
h2: "h3",
|
|
15
|
+
h3: "h4",
|
|
16
|
+
h4: "h5",
|
|
17
|
+
h5: "h6",
|
|
18
|
+
h6: "h6"
|
|
19
|
+
};
|
|
20
|
+
class a extends h {
|
|
21
|
+
constructor() {
|
|
22
|
+
super(...arguments), this.label = "", this.meta = "", this.variant = "default", this.headingTagName = "h3";
|
|
23
|
+
}
|
|
24
|
+
static get styles() {
|
|
25
|
+
return m(p);
|
|
26
|
+
}
|
|
27
|
+
render() {
|
|
28
|
+
const e = this.componentClassNames("ed-r-stat-card", {
|
|
29
|
+
[`ed-r-stat-card--${this.variant}`]: this.variant !== "default"
|
|
30
|
+
}), r = g[this.headingTagName];
|
|
31
|
+
return o`
|
|
32
|
+
<ed-card class="${e}">
|
|
33
|
+
${this.label ? o`<ed-heading
|
|
34
|
+
tagName="${this.headingTagName}"
|
|
35
|
+
variant="label-default"
|
|
36
|
+
class="ed-r-stat-card__label"
|
|
37
|
+
>${this.label}</ed-heading
|
|
38
|
+
>` : c}
|
|
39
|
+
<ed-heading
|
|
40
|
+
tagName="${r}"
|
|
41
|
+
variant="display-default"
|
|
42
|
+
class="ed-r-stat-card__value"
|
|
43
|
+
>
|
|
44
|
+
<slot></slot>
|
|
45
|
+
</ed-heading>
|
|
46
|
+
${this.meta ? o`<ed-text-passage size="xs" class="ed-r-stat-card__meta">
|
|
47
|
+
<p>${this.meta}</p>
|
|
48
|
+
</ed-text-passage>` : c}
|
|
49
|
+
</ed-card>
|
|
50
|
+
`;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
d([
|
|
54
|
+
s()
|
|
55
|
+
], a.prototype, "label");
|
|
56
|
+
d([
|
|
57
|
+
s()
|
|
58
|
+
], a.prototype, "meta");
|
|
59
|
+
d([
|
|
60
|
+
s({ reflect: !0 })
|
|
61
|
+
], a.prototype, "variant");
|
|
62
|
+
d([
|
|
63
|
+
s()
|
|
64
|
+
], a.prototype, "headingTagName");
|
|
65
|
+
customElements.define("ed-r-stat-card", a);
|
|
66
|
+
export {
|
|
67
|
+
a as EdRStatCard
|
|
68
|
+
};
|
|
@@ -2,13 +2,13 @@ import { EdElement as u } from "@brad-frost-web/eddie-web-components/components/
|
|
|
2
2
|
import { unsafeCSS as b, html as c } from "lit";
|
|
3
3
|
import { property as o } from "lit/decorators.js";
|
|
4
4
|
import "@brad-frost-web/eddie-web-components/components/button/button";
|
|
5
|
-
const m = '@charset "UTF-8";:root,:host{--size-base-unit: .5rem}*,::slotted(*),*:before,*:after{box-sizing:border-box}h1,h2,h3,h4,h5,h6{margin:0}:host{display:inline-block}.ed-r-transport-button{position:relative;display:inline-block}.ed-r-transport-button--sm .ed-r-transport-button__button{--ed-c-button-size-override: 2.5rem }.ed-r-transport-button--md .ed-r-transport-button__button{--ed-c-button-size-override: 3.5rem }.ed-r-transport-button--lg .ed-r-transport-button__button{--ed-c-button-size-override: 5rem }.ed-r-transport-button--xl .ed-r-transport-button__button{--ed-c-button-size-override: 9rem }.ed-r-transport-button__button{width:var(--ed-c-button-size-override, auto);height:var(--ed-c-button-size-override, auto)}.ed-r-transport-button--pulsing:before{content:"";position:absolute;inset:0;border-radius:
|
|
5
|
+
const m = '@charset "UTF-8";:root,:host{--size-base-unit: .5rem}*,::slotted(*),*:before,*:after{box-sizing:border-box}h1,h2,h3,h4,h5,h6{margin:0}:host{display:inline-block}.ed-r-transport-button{position:relative;display:inline-block}.ed-r-transport-button--sm .ed-r-transport-button__button{--ed-c-button-size-override: 2.5rem }.ed-r-transport-button--md .ed-r-transport-button__button{--ed-c-button-size-override: 3.5rem }.ed-r-transport-button--lg .ed-r-transport-button__button{--ed-c-button-size-override: 5rem }.ed-r-transport-button--xl .ed-r-transport-button__button{--ed-c-button-size-override: 9rem }.ed-r-transport-button__button{width:var(--ed-c-button-size-override, auto);height:var(--ed-c-button-size-override, auto)}.ed-r-transport-button--pulsing:before{content:"";position:absolute;inset:0;border-radius:var(--ed-theme-border-radius-round);pointer-events:none;box-shadow:0 0 0 0 var(--ed-theme-color-content-danger);animation:ed-r-transport-button-pulse 1.4s ease-out infinite}@keyframes ed-r-transport-button-pulse{0%{box-shadow:0 0 color-mix(in srgb,var(--ed-theme-color-content-danger) 60%,transparent)}70%{box-shadow:0 0 0 1.25rem color-mix(in srgb,var(--ed-theme-color-content-danger) 0%,transparent)}to{box-shadow:0 0 color-mix(in srgb,var(--ed-theme-color-content-danger) 0%,transparent)}}@media(prefers-reduced-motion:reduce){.ed-r-transport-button--pulsing:before{animation:none}}.ed-r-transport-button.ed-is-disabled{opacity:.5;pointer-events:none}';
|
|
6
6
|
var h = Object.defineProperty, n = (a, t, s, d) => {
|
|
7
|
-
for (var e = void 0, i = a.length - 1,
|
|
8
|
-
(
|
|
7
|
+
for (var e = void 0, i = a.length - 1, l; i >= 0; i--)
|
|
8
|
+
(l = a[i]) && (e = l(t, s, e) || e);
|
|
9
9
|
return e && h(t, s, e), e;
|
|
10
10
|
};
|
|
11
|
-
const
|
|
11
|
+
const p = {
|
|
12
12
|
record: { icon: "mic", label: "Record", variant: "danger", ariaPressed: "false" },
|
|
13
13
|
recording: { icon: "stop", label: "Stop recording", variant: "danger", ariaPressed: "true", pulsing: !0 },
|
|
14
14
|
play: { icon: "play-arrow", label: "Play", variant: "primary", ariaPressed: "false" },
|
|
@@ -28,7 +28,7 @@ class r extends u {
|
|
|
28
28
|
return b(m);
|
|
29
29
|
}
|
|
30
30
|
render() {
|
|
31
|
-
const t =
|
|
31
|
+
const t = p[this.mode] ?? p.play, s = this.pulsing ?? t.pulsing ?? !1, d = this.componentClassNames("ed-r-transport-button", {
|
|
32
32
|
[`ed-r-transport-button--${this.mode}`]: !0,
|
|
33
33
|
[`ed-r-transport-button--${this.size}`]: !0,
|
|
34
34
|
"ed-r-transport-button--pulsing": s,
|
|
@@ -15,21 +15,34 @@ import { EdElement } from '@brad-frost-web/eddie-web-components/components/EdEle
|
|
|
15
15
|
* isn't lost. Click Save to promote the sandbox to a named theme; click
|
|
16
16
|
* Reset to clear it.
|
|
17
17
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
18
|
+
* By default the trigger button flows **inline** in normal document flow
|
|
19
|
+
* wherever you place `<ed-r-theme-customizer>` — drop it into a header,
|
|
20
|
+
* toolbar, or footer and it sits where you put it. Set `position="fixed"`
|
|
21
|
+
* to opt into the legacy floating behavior, where the trigger pins itself
|
|
22
|
+
* to the top-right corner of the viewport. The slide-in panel is a fixed
|
|
23
|
+
* overlay in both modes.
|
|
24
|
+
*
|
|
25
|
+
* @prop {'inline' | 'fixed'} position - Where the trigger button sits. `inline` (default) flows in normal document flow; `fixed` pins it to the top-right viewport corner. The panel always slides in as a fixed overlay.
|
|
20
26
|
*
|
|
21
27
|
* @use Live theming demos in meetings, sales calls, design reviews
|
|
22
28
|
* @use White-labeling spike work — try a brand color set without rebuilding tokens
|
|
23
29
|
* @use Internal QA for verifying components render correctly across the published themes
|
|
24
30
|
*
|
|
25
31
|
* @dontuse As a production end-user feature — overrides are global and persist on the device; not appropriate for multi-tenant sites
|
|
26
|
-
* @dontuse
|
|
32
|
+
* @dontuse With position="fixed" inside a clipped/transformed ancestor — a fixed trigger anchors to that ancestor, not the viewport; place a fixed customizer as a sibling of the main content
|
|
27
33
|
*
|
|
28
34
|
* @a11y The panel renders with role="dialog" and an aria-label; ESC closes it
|
|
29
35
|
* @a11y Color contrast is the consumer's responsibility once overrides are applied — the Random button uses random values and does not validate against WCAG
|
|
30
36
|
*/
|
|
31
37
|
export declare class EdRThemeCustomizer extends EdElement {
|
|
32
38
|
static get styles(): import('lit').CSSResult;
|
|
39
|
+
/**
|
|
40
|
+
* Where the trigger button sits. `inline` (default) flows in normal
|
|
41
|
+
* document flow wherever the element is placed; `fixed` pins the trigger
|
|
42
|
+
* to the top-right corner of the viewport (the original floating tool
|
|
43
|
+
* behavior). Reflected so the modifier is visible in the light DOM.
|
|
44
|
+
*/
|
|
45
|
+
position: 'inline' | 'fixed';
|
|
33
46
|
private isOpen;
|
|
34
47
|
/**
|
|
35
48
|
* The currently-selected theme. Published theme IDs ('bfw', 'bfw-dark', …)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-customizer.d.ts","sourceRoot":"","sources":["../../../../../packages/eddie-recipes/recipes/tools/theme-customizer/theme-customizer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,2DAA2D,CAAC;AACtF,OAAO,+DAA+D,CAAC;AACvE,OAAO,2DAA2D,CAAC;AA0SnE
|
|
1
|
+
{"version":3,"file":"theme-customizer.d.ts","sourceRoot":"","sources":["../../../../../packages/eddie-recipes/recipes/tools/theme-customizer/theme-customizer.ts"],"names":[],"mappings":"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"}
|
|
@@ -2,13 +2,13 @@ import { EdElement as B } from "@brad-frost-web/eddie-web-components/components/
|
|
|
2
2
|
import "@brad-frost-web/eddie-web-components/components/button/button";
|
|
3
3
|
import "@brad-frost-web/eddie-web-components/components/icon/icon";
|
|
4
4
|
import { unsafeCSS as D, html as f } from "lit";
|
|
5
|
-
import { state as
|
|
6
|
-
import { STATIC_CATALOG as
|
|
7
|
-
const
|
|
8
|
-
var
|
|
5
|
+
import { property as R, state as p } from "lit/decorators.js";
|
|
6
|
+
import { STATIC_CATALOG as N, CATALOG_API_URL as G } from "./google-fonts-catalog.js";
|
|
7
|
+
const L = '@charset "UTF-8";:root,:host{--size-base-unit: .5rem}*,::slotted(*),*:before,*:after{box-sizing:border-box}h1,h2,h3,h4,h5,h6{margin:0}:host{display:contents}.ed-r-theme-customizer__trigger{transition:opacity .18s ease,transform .22s ease}.ed-r-theme-customizer--fixed .ed-r-theme-customizer__trigger{position:fixed;inset-block-start:.75rem;inset-inline-end:.75rem;z-index:9999;box-shadow:0 .5rem 1.25rem #0000002e}.ed-r-theme-customizer--fixed.is-open .ed-r-theme-customizer__trigger{opacity:0;transform:translate(120%);pointer-events:none}.ed-r-theme-customizer__panel{position:fixed;inset-block:0;inset-inline-end:0;width:min(26rem,100vw);background:var(--ed-theme-color-background-default);color:var(--ed-theme-color-content-default);border-inline-start:1px solid var(--ed-theme-color-border-default, rgba(0, 0, 0, .15));box-shadow:-.75rem 0 2rem #0000002e;z-index:9998;display:flex;flex-direction:column;transform:translate(100%);transition:transform .28s cubic-bezier(.22,.61,.36,1);visibility:hidden}.ed-r-theme-customizer.is-open .ed-r-theme-customizer__panel{transform:translate(0);visibility:visible}.ed-r-theme-customizer__panel-header{display:flex;align-items:center;justify-content:space-between;gap:.5rem;padding:1rem 1rem .5rem;border-block-end:1px solid var(--ed-theme-color-border-default, rgba(0, 0, 0, .1))}.ed-r-theme-customizer__title{margin:0;font-family:var(--ed-theme-typography-heading-h3-font-family, inherit);font-size:1.125rem;font-weight:600;line-height:1.2;color:var(--ed-theme-color-content-default)}.ed-r-theme-customizer__close{flex-shrink:0}.ed-r-theme-customizer__body{flex:1;overflow-y:auto;padding:1rem;display:flex;flex-direction:column;gap:1.5rem}.ed-r-theme-customizer__section{display:flex;flex-direction:column;gap:.5rem}.ed-r-theme-customizer__section-title{margin:0;font-family:var(--ed-theme-typography-heading-h4-font-family, inherit);font-size:var(--ed-theme-typography-heading-h4-font-size, 1rem);font-weight:var(--ed-theme-typography-heading-h4-font-weight, 600);letter-spacing:.02em;text-transform:uppercase;color:var(--ed-theme-color-content-muted, var(--ed-theme-color-content-default))}.ed-r-theme-customizer__hint{margin:0;font-size:.8125rem;line-height:1.4;color:var(--ed-theme-color-content-muted, var(--ed-theme-color-content-default))}.ed-r-theme-customizer__field{display:flex;flex-direction:column;gap:.25rem}.ed-r-theme-customizer__field-label{display:flex;align-items:baseline;justify-content:space-between;gap:.5rem;font-size:.8125rem;font-weight:500;color:var(--ed-theme-color-content-default)}.ed-r-theme-customizer__field-value{font-family:var(--ed-theme-typography-meta-default-font-family, monospace);font-size:.75rem;font-weight:400;color:var(--ed-theme-color-content-muted, var(--ed-theme-color-content-default));font-variant-numeric:tabular-nums}.ed-r-theme-customizer__slider{width:100%;appearance:none;background:transparent;cursor:pointer;padding:.25rem 0}.ed-r-theme-customizer__slider::-webkit-slider-runnable-track{height:.25rem;border-radius:var(--ed-theme-border-radius-round);background:var(--ed-theme-color-border-default, rgba(0, 0, 0, .2))}.ed-r-theme-customizer__slider::-moz-range-track{height:.25rem;border-radius:var(--ed-theme-border-radius-round);background:var(--ed-theme-color-border-default, rgba(0, 0, 0, .2))}.ed-r-theme-customizer__slider::-webkit-slider-thumb{appearance:none;width:1rem;height:1rem;margin-top:-.375rem;border-radius:var(--ed-theme-border-radius-round);background:var(--ed-theme-color-background-brand, var(--ed-theme-color-content-default));border:2px solid var(--ed-theme-color-background-default);box-shadow:0 1px 3px #00000040}.ed-r-theme-customizer__slider::-moz-range-thumb{width:1rem;height:1rem;border-radius:var(--ed-theme-border-radius-round);background:var(--ed-theme-color-background-brand, var(--ed-theme-color-content-default));border:2px solid var(--ed-theme-color-background-default);box-shadow:0 1px 3px #00000040}.ed-r-theme-customizer__slider:focus-visible{outline:2px solid var(--ed-theme-color-border-focus, var(--ed-theme-color-background-brand));outline-offset:2px;border-radius:var(--ed-theme-border-radius-round)}.ed-r-theme-customizer__select{width:100%;padding:.375rem .5rem;border:1px solid var(--ed-theme-color-border-default, rgba(0, 0, 0, .2));border-radius:var(--ed-theme-border-radius-sm, .25rem);background:var(--ed-theme-color-background-default);color:var(--ed-theme-color-content-default);font:inherit;font-size:.875rem}.ed-r-theme-customizer__save-row{display:flex;align-items:stretch;gap:.375rem;margin-block-start:.25rem}.ed-r-theme-customizer__save-input{flex:1;min-width:0;padding:.25rem .375rem;border:1px solid var(--ed-theme-color-border-default, rgba(0, 0, 0, .2));border-radius:var(--ed-theme-border-radius-sm, .25rem);background:var(--ed-theme-color-background-default);color:var(--ed-theme-color-content-default);font:inherit;font-size:.875rem}.ed-r-theme-customizer__save-input::placeholder{color:var(--ed-theme-color-content-muted, rgba(0, 0, 0, .5))}.ed-r-theme-customizer__save-input:focus{outline:2px solid var(--ed-theme-color-border-focus, var(--ed-theme-color-background-brand));outline-offset:1px}.ed-r-theme-customizer__save-button{flex-shrink:0}.ed-r-theme-customizer__inline-action{appearance:none;background:transparent;border:none;padding:0;margin-block-start:.25rem;font:inherit;font-size:.75rem;font-weight:500;text-transform:uppercase;letter-spacing:.04em;color:var(--ed-theme-color-content-muted, var(--ed-theme-color-content-default));cursor:pointer;text-align:start}.ed-r-theme-customizer__inline-action:hover{color:var(--ed-theme-color-content-utility-error, var(--ed-theme-color-content-default))}.ed-r-theme-customizer__picker{position:relative}.ed-r-theme-customizer__picker-clear{appearance:none;background:transparent;border:none;padding:0;font:inherit;font-size:.6875rem;font-weight:500;text-transform:uppercase;letter-spacing:.04em;color:var(--ed-theme-color-content-muted, var(--ed-theme-color-content-default));cursor:pointer}.ed-r-theme-customizer__picker-clear:hover{color:var(--ed-theme-color-content-default)}.ed-r-theme-customizer__picker-shell{position:relative}.ed-r-theme-customizer__picker-input{width:100%;padding:.375rem .5rem;border:1px solid var(--ed-theme-color-border-default, rgba(0, 0, 0, .2));border-radius:var(--ed-theme-border-radius-sm, .25rem);background:var(--ed-theme-color-background-default);color:var(--ed-theme-color-content-default);font:inherit;font-size:.9375rem;line-height:1.3}.ed-r-theme-customizer__picker-input::placeholder{color:var(--ed-theme-color-content-muted, rgba(0, 0, 0, .5))}.ed-r-theme-customizer__picker-input:focus{outline:2px solid var(--ed-theme-color-border-focus, var(--ed-theme-color-background-brand));outline-offset:1px}.ed-r-theme-customizer__picker-list{position:absolute;inset-inline:0;inset-block-start:calc(100% + .25rem);z-index:10;margin:0;padding:.25rem 0;max-height:18rem;overflow-y:auto;background:var(--ed-theme-color-background-default);border:1px solid var(--ed-theme-color-border-default, rgba(0, 0, 0, .15));border-radius:var(--ed-theme-border-radius-sm, .25rem);box-shadow:0 .75rem 1.5rem #0000002e;list-style:none;font-size:.9375rem}.ed-r-theme-customizer__picker-empty{padding:.375rem .5rem;color:var(--ed-theme-color-content-muted, var(--ed-theme-color-content-default));font-size:.8125rem;font-style:italic}.ed-r-theme-customizer__picker-item{display:flex;align-items:baseline;justify-content:space-between;gap:.5rem;padding:.25rem .5rem;cursor:pointer;color:var(--ed-theme-color-content-default);line-height:1.3}.ed-r-theme-customizer__picker-item.is-active{background:var(--ed-theme-color-background-subtle, rgba(0, 0, 0, .05))}.ed-r-theme-customizer__picker-item.is-selected{background:var(--ed-theme-color-background-brand, var(--ed-theme-color-background-subtle, rgba(0, 0, 0, .05)));color:var(--ed-theme-color-content-brand-knockout, var(--ed-theme-color-content-default))}.ed-r-theme-customizer__picker-name{flex:1;min-width:0}.ed-r-theme-customizer__picker-category{font-family:var(--ed-theme-typography-meta-default-font-family, monospace);font-size:.6875rem;font-weight:400;text-transform:lowercase;letter-spacing:.02em;color:var(--ed-theme-color-content-muted, var(--ed-theme-color-content-default));flex-shrink:0}.ed-r-theme-customizer__color-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:.375rem}.ed-r-theme-customizer__color-tile{display:flex;flex-direction:column;align-items:center;gap:.25rem;font-size:.6875rem;line-height:1.2;text-align:center;color:var(--ed-theme-color-content-default);cursor:pointer}.ed-r-theme-customizer__color-input{appearance:none;width:100%;height:2.75rem;border:1px solid var(--ed-theme-color-border-default, rgba(0, 0, 0, .2));border-radius:var(--ed-theme-border-radius-sm, .25rem);padding:0;cursor:pointer;background:transparent}.ed-r-theme-customizer__color-input::-webkit-color-swatch-wrapper{padding:0}.ed-r-theme-customizer__color-input::-webkit-color-swatch{border:none;border-radius:var(--ed-theme-border-radius-sm, .25rem)}.ed-r-theme-customizer__color-input::-moz-color-swatch{border:none;border-radius:var(--ed-theme-border-radius-sm, .25rem)}.ed-r-theme-customizer__color-label{word-break:break-word}.ed-r-theme-customizer__cycle-toggle{align-self:stretch}.ed-r-theme-customizer__export-row{display:flex;gap:.375rem}.ed-r-theme-customizer__export-row ed-button{flex:1}.ed-r-theme-customizer__actions{display:flex;gap:.5rem;padding:.75rem 1rem;border-block-start:1px solid var(--ed-theme-color-border-default, rgba(0, 0, 0, .1))}.ed-r-theme-customizer__actions ed-button{flex:1}';
|
|
8
|
+
var j = Object.defineProperty, u = (w, e, t, r) => {
|
|
9
9
|
for (var o = void 0, s = w.length - 1, i; s >= 0; s--)
|
|
10
10
|
(i = w[s]) && (o = i(e, t, o) || o);
|
|
11
|
-
return o &&
|
|
11
|
+
return o && j(e, t, o), o;
|
|
12
12
|
};
|
|
13
13
|
const k = [
|
|
14
14
|
{ id: "bfw", label: "BFW" },
|
|
@@ -129,7 +129,7 @@ const k = [
|
|
|
129
129
|
"--ed-theme-typography-meta-sm-font-family",
|
|
130
130
|
"--ed-theme-typography-primary-nav-default-font-family",
|
|
131
131
|
"--ed-theme-typography-primary-nav-default-mobile-font-family"
|
|
132
|
-
],
|
|
132
|
+
], M = "400;500;600;700", F = ["display", "serif", "handwriting"], E = ["sans-serif", "serif", "monospace"], A = "ed-r-theme-customizer:catalog:v1", K = 1e3 * 60 * 60 * 24 * 7, S = [
|
|
133
133
|
{ key: "--ed-theme-border-radius-sm", label: "radius-sm", max: 1.5 },
|
|
134
134
|
{ key: "--ed-theme-border-radius-md", label: "radius-md", max: 2.5 }
|
|
135
135
|
], _ = [
|
|
@@ -151,7 +151,7 @@ const k = [
|
|
|
151
151
|
"--ed-theme-color-background-accent-6",
|
|
152
152
|
"--ed-theme-color-background-accent-7",
|
|
153
153
|
"--ed-theme-color-background-accent-8"
|
|
154
|
-
],
|
|
154
|
+
], V = 0.5, Y = 1, H = 1500, x = {
|
|
155
155
|
"--ed-theme-color-background-default": "--ed-theme-color-content-default",
|
|
156
156
|
"--ed-theme-color-background-subtle": "--ed-theme-color-content-default",
|
|
157
157
|
"--ed-theme-color-background-knockout": "--ed-theme-color-content-knockout",
|
|
@@ -165,9 +165,9 @@ const k = [
|
|
|
165
165
|
"--ed-theme-color-background-accent-7": "--ed-theme-color-content-on-accent-7",
|
|
166
166
|
"--ed-theme-color-background-accent-8": "--ed-theme-color-content-on-accent-8"
|
|
167
167
|
}, g = typeof CSS < "u" && typeof CSS.supports == "function" && CSS.supports("color", "contrast-color(red)");
|
|
168
|
-
class
|
|
168
|
+
class h extends B {
|
|
169
169
|
constructor() {
|
|
170
|
-
super(...arguments), this.isOpen = !1, this.currentThemeId = "bfw", this.colorOverrides = {}, this.fontOverrides = {}, this.borderOverrides = {}, this.buttonGroupColors = {}, this.shadowScales = {}, this.shadowOverrides = {}, this.displayFontFamily = "", this.bodyFontFamily = "", this.sandbox = null, this.savedThemes = [], this.saveDraftName = "", this.cycleActive = !1, this.cycleSpeed =
|
|
170
|
+
super(...arguments), this.position = "inline", this.isOpen = !1, this.currentThemeId = "bfw", this.colorOverrides = {}, this.fontOverrides = {}, this.borderOverrides = {}, this.buttonGroupColors = {}, this.shadowScales = {}, this.shadowOverrides = {}, this.displayFontFamily = "", this.bodyFontFamily = "", this.sandbox = null, this.savedThemes = [], this.saveDraftName = "", this.cycleActive = !1, this.cycleSpeed = Y, this.exportFeedback = null, this.catalog = N, this.pickerOpen = { display: !1, body: !1 }, this.pickerFilter = { display: "", body: "" }, this.pickerActiveIndex = { display: 0, body: 0 }, this.loadedFonts = /* @__PURE__ */ new Set(), this.resolvedColors = {}, this.resolvedButtonColors = {}, this.resolvedDisplayFont = "", this.resolvedBodyFont = "", this.resolvedBorders = {}, this.resolvedShadows = {}, this.cycleHueOffset = 0, this.cycleBaselines = {}, this.cycleRaf = null, this.exportFeedbackTimer = null, this.handleKeydown = (e) => {
|
|
171
171
|
if (e.key === "Escape") {
|
|
172
172
|
if (this.pickerOpen.display || this.pickerOpen.body) {
|
|
173
173
|
this.pickerOpen = { display: !1, body: !1 };
|
|
@@ -236,24 +236,24 @@ class m extends B {
|
|
|
236
236
|
for (const n of v)
|
|
237
237
|
t.has(n.id) || this.setButtonGroupColor(n.id, this.randomHex());
|
|
238
238
|
const r = this.catalog.filter((n) => F.includes(n.category)), o = this.catalog.filter((n) => E.includes(n.category)), s = (n) => n.length ? n[Math.floor(Math.random() * n.length)].family : "", i = s(r);
|
|
239
|
-
let
|
|
240
|
-
if (
|
|
241
|
-
const n = o.findIndex((
|
|
242
|
-
|
|
239
|
+
let d = s(o);
|
|
240
|
+
if (d && d === i && o.length > 1) {
|
|
241
|
+
const n = o.findIndex((l) => l.family === d);
|
|
242
|
+
d = o[(n + 1) % o.length].family;
|
|
243
243
|
}
|
|
244
|
-
i && this.setDisplayFont(i),
|
|
244
|
+
i && this.setDisplayFont(i), d && this.setBodyFont(d);
|
|
245
245
|
const a = 0.25 + Math.random() * 1.5, c = 0.0625 + Math.random() * 0.4375;
|
|
246
|
-
S.forEach((n,
|
|
247
|
-
const
|
|
248
|
-
this.setBorderValue(n.key, this.roundToStep(
|
|
249
|
-
}), _.forEach((n,
|
|
250
|
-
const
|
|
251
|
-
this.setBorderValue(n.key, this.roundToStep(
|
|
246
|
+
S.forEach((n, l) => {
|
|
247
|
+
const m = l === 0 ? 0.35 : 1;
|
|
248
|
+
this.setBorderValue(n.key, this.roundToStep(m * a, 0.0625));
|
|
249
|
+
}), _.forEach((n, l) => {
|
|
250
|
+
const m = (l + 1) / _.length;
|
|
251
|
+
this.setBorderValue(n.key, this.roundToStep(m * c, 0.0625));
|
|
252
252
|
});
|
|
253
253
|
for (const { key: n } of C) {
|
|
254
254
|
if (!this.resolvedShadows[n]) continue;
|
|
255
|
-
const
|
|
256
|
-
this.setShadowOverride(n,
|
|
255
|
+
const l = n.endsWith("-sm") ? "sm" : n.endsWith("-bold") ? "bold" : "md", m = this.randomShadowExpression(l), b = this.roundToStep(0.6 + Math.random() * 1, 0.1);
|
|
256
|
+
this.setShadowOverride(n, m, b);
|
|
257
257
|
}
|
|
258
258
|
}, this.onReset = () => {
|
|
259
259
|
if (this.cycleActive && this.stopColorCycle(), this.currentThemeId === y) {
|
|
@@ -291,7 +291,7 @@ class m extends B {
|
|
|
291
291
|
};
|
|
292
292
|
}
|
|
293
293
|
static get styles() {
|
|
294
|
-
return D(
|
|
294
|
+
return D(L);
|
|
295
295
|
}
|
|
296
296
|
connectedCallback() {
|
|
297
297
|
super.connectedCallback(), this.savedThemes = this.loadSavedThemes(), this.sandbox = this.loadSandbox();
|
|
@@ -311,7 +311,7 @@ class m extends B {
|
|
|
311
311
|
const e = localStorage.getItem(A);
|
|
312
312
|
if (e) {
|
|
313
313
|
const t = JSON.parse(e);
|
|
314
|
-
if (t.fonts?.length && Date.now() - t.fetchedAt <
|
|
314
|
+
if (t.fonts?.length && Date.now() - t.fetchedAt < K) {
|
|
315
315
|
this.catalog = t.fonts;
|
|
316
316
|
return;
|
|
317
317
|
}
|
|
@@ -319,7 +319,7 @@ class m extends B {
|
|
|
319
319
|
} catch {
|
|
320
320
|
}
|
|
321
321
|
try {
|
|
322
|
-
const e = await fetch(
|
|
322
|
+
const e = await fetch(G);
|
|
323
323
|
if (!e.ok) return;
|
|
324
324
|
const t = await e.json(), r = /* @__PURE__ */ new Set(["sans-serif", "serif", "display", "handwriting", "monospace"]), o = t.filter((s) => r.has(s.category)).map((s) => ({ family: s.family, category: s.category })).sort((s, i) => s.family.localeCompare(i.family));
|
|
325
325
|
this.catalog = o;
|
|
@@ -395,26 +395,26 @@ class m extends B {
|
|
|
395
395
|
document.body.removeChild(t);
|
|
396
396
|
const o = r.match(/\d+/g);
|
|
397
397
|
if (!o || o.length < 3) return "#000000";
|
|
398
|
-
const [s, i,
|
|
399
|
-
return `#${[s, i,
|
|
398
|
+
const [s, i, d] = o.map(Number);
|
|
399
|
+
return `#${[s, i, d].map((a) => a.toString(16).padStart(2, "0")).join("")}`;
|
|
400
400
|
}
|
|
401
401
|
hexToHsl(e) {
|
|
402
402
|
const t = /^#?([0-9a-f]{6})$/i.exec(e);
|
|
403
403
|
if (!t) return null;
|
|
404
|
-
const r = parseInt(t[1], 16), o = (r >> 16 & 255) / 255, s = (r >> 8 & 255) / 255, i = (r & 255) / 255,
|
|
405
|
-
let n = 0,
|
|
406
|
-
if (
|
|
407
|
-
const
|
|
408
|
-
|
|
404
|
+
const r = parseInt(t[1], 16), o = (r >> 16 & 255) / 255, s = (r >> 8 & 255) / 255, i = (r & 255) / 255, d = Math.max(o, s, i), a = Math.min(o, s, i), c = (d + a) / 2;
|
|
405
|
+
let n = 0, l = 0;
|
|
406
|
+
if (d !== a) {
|
|
407
|
+
const m = d - a;
|
|
408
|
+
l = c > 0.5 ? m / (2 - d - a) : m / (d + a), d === o ? n = ((s - i) / m + (s < i ? 6 : 0)) * 60 : d === s ? n = ((i - o) / m + 2) * 60 : n = ((o - s) / m + 4) * 60;
|
|
409
409
|
}
|
|
410
|
-
return { h: n, s:
|
|
410
|
+
return { h: n, s: l, l: c };
|
|
411
411
|
}
|
|
412
412
|
hslToHex({ h: e, s: t, l: r }) {
|
|
413
|
-
const o = (e % 360 + 360) % 360, s = (1 - Math.abs(2 * r - 1)) * t, i = s * (1 - Math.abs(o / 60 % 2 - 1)),
|
|
413
|
+
const o = (e % 360 + 360) % 360, s = (1 - Math.abs(2 * r - 1)) * t, i = s * (1 - Math.abs(o / 60 % 2 - 1)), d = r - s / 2;
|
|
414
414
|
let a = 0, c = 0, n = 0;
|
|
415
415
|
o < 60 ? (a = s, c = i) : o < 120 ? (a = i, c = s) : o < 180 ? (c = s, n = i) : o < 240 ? (c = i, n = s) : o < 300 ? (a = i, n = s) : (a = s, n = i);
|
|
416
|
-
const
|
|
417
|
-
return `#${
|
|
416
|
+
const l = (m) => Math.max(0, Math.min(255, Math.round((m + d) * 255))).toString(16).padStart(2, "0");
|
|
417
|
+
return `#${l(a)}${l(c)}${l(n)}`;
|
|
418
418
|
}
|
|
419
419
|
/**
|
|
420
420
|
* Begin the color cycle. Captures each cycle token's current hex as an HSL
|
|
@@ -439,7 +439,7 @@ class m extends B {
|
|
|
439
439
|
this.cycleHueOffset = 0, this.cycleActive = !0;
|
|
440
440
|
const t = () => {
|
|
441
441
|
if (this.cycleActive) {
|
|
442
|
-
this.cycleHueOffset = (this.cycleHueOffset +
|
|
442
|
+
this.cycleHueOffset = (this.cycleHueOffset + V * this.cycleSpeed) % 360;
|
|
443
443
|
for (const [r, o] of Object.entries(this.cycleBaselines)) {
|
|
444
444
|
const s = this.hslToHex({
|
|
445
445
|
h: o.h + this.cycleHueOffset,
|
|
@@ -553,7 +553,7 @@ class m extends B {
|
|
|
553
553
|
flashExportFeedback(e) {
|
|
554
554
|
this.exportFeedback = e, this.exportFeedbackTimer !== null && window.clearTimeout(this.exportFeedbackTimer), this.exportFeedbackTimer = window.setTimeout(() => {
|
|
555
555
|
this.exportFeedback = null, this.exportFeedbackTimer = null;
|
|
556
|
-
},
|
|
556
|
+
}, H);
|
|
557
557
|
}
|
|
558
558
|
loadSandbox() {
|
|
559
559
|
try {
|
|
@@ -762,11 +762,11 @@ class m extends B {
|
|
|
762
762
|
* the new expression, not the theme baseline.
|
|
763
763
|
*/
|
|
764
764
|
randomShadowExpression(e) {
|
|
765
|
-
const t = e === "sm" ? ["soft", "glow", "inset"] : e === "md" ? ["soft", "hard", "glow", "stacked"] : ["hard", "stacked", "glow", "soft"], r = t[Math.floor(Math.random() * t.length)], o = e === "sm" ? 0.4 : e === "md" ? 0.9 : 1.6, s = (a, c) => Math.round((a + Math.random() * (c - a)) * 1e3) / 1e3, i = () => this.randomHex(),
|
|
765
|
+
const t = e === "sm" ? ["soft", "glow", "inset"] : e === "md" ? ["soft", "hard", "glow", "stacked"] : ["hard", "stacked", "glow", "soft"], r = t[Math.floor(Math.random() * t.length)], o = e === "sm" ? 0.4 : e === "md" ? 0.9 : 1.6, s = (a, c) => Math.round((a + Math.random() * (c - a)) * 1e3) / 1e3, i = () => this.randomHex(), d = (a, c) => `rgba(0, 0, 0, ${s(a, c).toFixed(2)})`;
|
|
766
766
|
switch (r) {
|
|
767
767
|
case "soft": {
|
|
768
768
|
const a = s(0.1, o), c = s(o * 0.6, o * 2), n = s(-o * 0.4, 0);
|
|
769
|
-
return `0rem ${a}rem ${c}rem ${n}rem ${
|
|
769
|
+
return `0rem ${a}rem ${c}rem ${n}rem ${d(0.1, 0.3)}`;
|
|
770
770
|
}
|
|
771
771
|
case "hard": {
|
|
772
772
|
const a = s(o * 0.4, o * 1.2) * (Math.random() < 0.5 ? -1 : 1), c = s(o * 0.4, o * 1.2);
|
|
@@ -777,16 +777,16 @@ class m extends B {
|
|
|
777
777
|
return `0rem 0rem ${a}rem ${c}rem ${i()}`;
|
|
778
778
|
}
|
|
779
779
|
case "stacked": {
|
|
780
|
-
const a = i(), c = i(), n =
|
|
780
|
+
const a = i(), c = i(), n = d(0.15, 0.3), l = s(o * 0.3, o * 0.6), m = s(o * 0.7, o * 1.1), b = s(o * 1.1, o * 1.6);
|
|
781
781
|
return [
|
|
782
|
-
`0rem ${
|
|
783
|
-
`0rem ${
|
|
782
|
+
`0rem ${l}rem 0rem ${-l * 0.4}rem ${a}`,
|
|
783
|
+
`0rem ${m}rem 0rem ${-m * 0.4}rem ${c}`,
|
|
784
784
|
`0rem ${b}rem ${o * 0.5}rem ${-b * 0.4}rem ${n}`
|
|
785
785
|
].join(", ");
|
|
786
786
|
}
|
|
787
787
|
default: {
|
|
788
788
|
const a = s(0.05, o * 0.6), c = s(o * 0.5, o * 1.5);
|
|
789
|
-
return `inset 0rem ${a}rem ${c}rem 0rem ${
|
|
789
|
+
return `inset 0rem ${a}rem ${c}rem 0rem ${d(0.1, 0.25)}`;
|
|
790
790
|
}
|
|
791
791
|
}
|
|
792
792
|
}
|
|
@@ -801,7 +801,7 @@ class m extends B {
|
|
|
801
801
|
const t = document.createElement("link");
|
|
802
802
|
t.rel = "stylesheet", t.dataset.edThemeCustomizerFont = e;
|
|
803
803
|
const r = e.replace(/ /g, "+");
|
|
804
|
-
t.href = `https://fonts.googleapis.com/css2?family=${r}:wght@${
|
|
804
|
+
t.href = `https://fonts.googleapis.com/css2?family=${r}:wght@${M}&display=swap`, document.head.appendChild(t), this.loadedFonts.add(e);
|
|
805
805
|
}
|
|
806
806
|
clearAppliedOverrides() {
|
|
807
807
|
for (const t of Object.keys(this.colorOverrides))
|
|
@@ -909,7 +909,7 @@ class m extends B {
|
|
|
909
909
|
* is the Figma-y bit.
|
|
910
910
|
*/
|
|
911
911
|
renderFontPicker(e, t, r) {
|
|
912
|
-
const o = e === "display" ? this.displayFontFamily : this.bodyFontFamily, s = this.pickerFilter[e], i = this.pickerOpen[e],
|
|
912
|
+
const o = e === "display" ? this.displayFontFamily : this.bodyFontFamily, s = this.pickerFilter[e], i = this.pickerOpen[e], d = i ? s : o, a = this.filteredCatalog(e).slice(0, 100), c = this.pickerActiveIndex[e], n = o || `theme default (${r || "inherit"})`;
|
|
913
913
|
return f`
|
|
914
914
|
<div
|
|
915
915
|
class="ed-r-theme-customizer__field ed-r-theme-customizer__picker"
|
|
@@ -938,7 +938,7 @@ class m extends B {
|
|
|
938
938
|
aria-autocomplete="list"
|
|
939
939
|
aria-activedescendant=${i ? `ed-r-theme-customizer-picker-item-${e}-${c}` : ""}
|
|
940
940
|
placeholder=${n}
|
|
941
|
-
.value=${
|
|
941
|
+
.value=${d}
|
|
942
942
|
style=${o && !i ? `font-family: '${o}', sans-serif;` : ""}
|
|
943
943
|
@input=${this.onPickerInput(e)}
|
|
944
944
|
@focus=${this.onPickerFocus(e)}
|
|
@@ -951,23 +951,23 @@ class m extends B {
|
|
|
951
951
|
role="listbox"
|
|
952
952
|
>
|
|
953
953
|
${a.length === 0 ? f`<li class="ed-r-theme-customizer__picker-empty">No fonts match.</li>` : a.map(
|
|
954
|
-
(
|
|
954
|
+
(l, m) => f`
|
|
955
955
|
<li
|
|
956
|
-
id="ed-r-theme-customizer-picker-item-${e}-${
|
|
957
|
-
class="ed-r-theme-customizer__picker-item ${
|
|
958
|
-
data-index=${
|
|
956
|
+
id="ed-r-theme-customizer-picker-item-${e}-${m}"
|
|
957
|
+
class="ed-r-theme-customizer__picker-item ${m === c ? "is-active" : ""} ${l.family === o ? "is-selected" : ""}"
|
|
958
|
+
data-index=${m}
|
|
959
959
|
role="option"
|
|
960
|
-
aria-selected=${
|
|
961
|
-
style="font-family: '${
|
|
960
|
+
aria-selected=${l.family === o}
|
|
961
|
+
style="font-family: '${l.family}', sans-serif;"
|
|
962
962
|
@mousedown=${(b) => {
|
|
963
|
-
b.preventDefault(), this.selectFont(e,
|
|
963
|
+
b.preventDefault(), this.selectFont(e, l.family);
|
|
964
964
|
}}
|
|
965
965
|
@mouseenter=${() => {
|
|
966
|
-
this.pickerActiveIndex = { ...this.pickerActiveIndex, [e]:
|
|
966
|
+
this.pickerActiveIndex = { ...this.pickerActiveIndex, [e]: m };
|
|
967
967
|
}}
|
|
968
968
|
>
|
|
969
|
-
<span class="ed-r-theme-customizer__picker-name">${
|
|
970
|
-
<span class="ed-r-theme-customizer__picker-category">${
|
|
969
|
+
<span class="ed-r-theme-customizer__picker-name">${l.family}</span>
|
|
970
|
+
<span class="ed-r-theme-customizer__picker-category">${l.category}</span>
|
|
971
971
|
</li>
|
|
972
972
|
`
|
|
973
973
|
)}
|
|
@@ -979,7 +979,8 @@ class m extends B {
|
|
|
979
979
|
}
|
|
980
980
|
render() {
|
|
981
981
|
const e = this.componentClassNames("ed-r-theme-customizer", {
|
|
982
|
-
"is-open": this.isOpen
|
|
982
|
+
"is-open": this.isOpen,
|
|
983
|
+
"ed-r-theme-customizer--fixed": this.position === "fixed"
|
|
983
984
|
});
|
|
984
985
|
return f`
|
|
985
986
|
<div class="${e}">
|
|
@@ -1320,67 +1321,70 @@ class m extends B {
|
|
|
1320
1321
|
`;
|
|
1321
1322
|
}
|
|
1322
1323
|
}
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
],
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
],
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
],
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
],
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
],
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
],
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
],
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
],
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
],
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
],
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
],
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
],
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
],
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
],
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
],
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
],
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
],
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
],
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
],
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
],
|
|
1383
|
-
|
|
1324
|
+
u([
|
|
1325
|
+
R({ reflect: !0 })
|
|
1326
|
+
], h.prototype, "position");
|
|
1327
|
+
u([
|
|
1328
|
+
p()
|
|
1329
|
+
], h.prototype, "isOpen");
|
|
1330
|
+
u([
|
|
1331
|
+
p()
|
|
1332
|
+
], h.prototype, "currentThemeId");
|
|
1333
|
+
u([
|
|
1334
|
+
p()
|
|
1335
|
+
], h.prototype, "colorOverrides");
|
|
1336
|
+
u([
|
|
1337
|
+
p()
|
|
1338
|
+
], h.prototype, "fontOverrides");
|
|
1339
|
+
u([
|
|
1340
|
+
p()
|
|
1341
|
+
], h.prototype, "borderOverrides");
|
|
1342
|
+
u([
|
|
1343
|
+
p()
|
|
1344
|
+
], h.prototype, "buttonGroupColors");
|
|
1345
|
+
u([
|
|
1346
|
+
p()
|
|
1347
|
+
], h.prototype, "shadowScales");
|
|
1348
|
+
u([
|
|
1349
|
+
p()
|
|
1350
|
+
], h.prototype, "shadowOverrides");
|
|
1351
|
+
u([
|
|
1352
|
+
p()
|
|
1353
|
+
], h.prototype, "displayFontFamily");
|
|
1354
|
+
u([
|
|
1355
|
+
p()
|
|
1356
|
+
], h.prototype, "bodyFontFamily");
|
|
1357
|
+
u([
|
|
1358
|
+
p()
|
|
1359
|
+
], h.prototype, "sandbox");
|
|
1360
|
+
u([
|
|
1361
|
+
p()
|
|
1362
|
+
], h.prototype, "savedThemes");
|
|
1363
|
+
u([
|
|
1364
|
+
p()
|
|
1365
|
+
], h.prototype, "saveDraftName");
|
|
1366
|
+
u([
|
|
1367
|
+
p()
|
|
1368
|
+
], h.prototype, "cycleActive");
|
|
1369
|
+
u([
|
|
1370
|
+
p()
|
|
1371
|
+
], h.prototype, "cycleSpeed");
|
|
1372
|
+
u([
|
|
1373
|
+
p()
|
|
1374
|
+
], h.prototype, "exportFeedback");
|
|
1375
|
+
u([
|
|
1376
|
+
p()
|
|
1377
|
+
], h.prototype, "catalog");
|
|
1378
|
+
u([
|
|
1379
|
+
p()
|
|
1380
|
+
], h.prototype, "pickerOpen");
|
|
1381
|
+
u([
|
|
1382
|
+
p()
|
|
1383
|
+
], h.prototype, "pickerFilter");
|
|
1384
|
+
u([
|
|
1385
|
+
p()
|
|
1386
|
+
], h.prototype, "pickerActiveIndex");
|
|
1387
|
+
customElements.get("ed-r-theme-customizer") === void 0 && customElements.define("ed-r-theme-customizer", h);
|
|
1384
1388
|
export {
|
|
1385
|
-
|
|
1389
|
+
h as EdRThemeCustomizer
|
|
1386
1390
|
};
|