@consciousclouds/appearance-experience 0.0.0-stage → 0.1.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/LICENSE ADDED
@@ -0,0 +1,171 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship made available under
36
+ the License, as indicated by a copyright notice that is included in
37
+ or attached to the work (an example is provided in the Appendix below).
38
+
39
+ "Derivative Works" shall mean any work, whether in Source or Object
40
+ form, that is based on (or derived from) the Work and for which the
41
+ editorial revisions, annotations, elaborations, or other modifications
42
+ represent, as a whole, an original work of authorship. For the purposes
43
+ of this License, Derivative Works shall not include works that remain
44
+ separable from, or merely link (or bind by name) to the interfaces of,
45
+ the Work and Derivative Works thereof.
46
+
47
+ "Contribution" shall mean, as submitted to the Licensor for inclusion
48
+ in the Work by the copyright owner or by an individual or Legal Entity
49
+ authorized to submit on behalf of the copyright owner. For the purposes
50
+ of this definition, "submitted" means any form of electronic, verbal,
51
+ or written communication sent to the Licensor or its representatives,
52
+ including but not limited to communication on electronic mailing lists,
53
+ source code control systems, and issue tracking systems that are managed
54
+ by, or on behalf of, the Licensor for the purpose of discussing and
55
+ improving the Work, but excluding communication that is conspicuously
56
+ marked or designated in writing by the copyright owner as "Not a
57
+ Contribution."
58
+
59
+ "Contributor" shall mean Licensor and any Legal Entity on behalf of
60
+ whom a Contribution has been received by the Licensor and included
61
+ within the Work.
62
+
63
+ 2. Grant of Copyright License. Subject to the terms and conditions of
64
+ this License, each Contributor hereby grants to You a perpetual,
65
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
66
+ copyright license to reproduce, prepare Derivative Works of,
67
+ publicly display, publicly perform, sublicense, and distribute the
68
+ Work and such Derivative Works in Source or Object form.
69
+
70
+ 3. Grant of Patent License. Subject to the terms and conditions of
71
+ this License, each Contributor hereby grants to You a perpetual,
72
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
73
+ (except as stated in this section) patent license to make, have made,
74
+ use, offer to sell, sell, import, and otherwise transfer the Work,
75
+ where such license applies only to those patent claims licensable
76
+ by such Contributor that are necessarily infringed by their
77
+ Contribution(s) alone or by the combination of their Contribution(s)
78
+ with the Work to which such Contribution(s) was submitted. If You
79
+ institute patent litigation against any entity (including a cross-claim
80
+ or counterclaim in a lawsuit) alleging that the Work or any
81
+ Contribution embodied within the Work constitutes direct or contributory
82
+ patent infringement, then any patent licenses granted to You under
83
+ this License for that Work shall terminate as of the date such
84
+ litigation is filed.
85
+
86
+ 4. Redistribution. You may reproduce and distribute copies of the
87
+ Work or Derivative Works thereof in any medium, with or without
88
+ modifications, and in Source or Object form, provided that You
89
+ meet the following conditions:
90
+
91
+ (a) You must give any other recipients of the Work or Derivative Works
92
+ a copy of this License; and
93
+
94
+ (b) You must cause any modified files to carry prominent notices
95
+ stating that You changed the files; and
96
+
97
+ (c) You must retain, in the Source form of any Derivative Works that
98
+ You distribute, all copyright, patent, trademark, and attribution
99
+ notices from the Source form of the Work, excluding those notices
100
+ that do not pertain to any part of the Derivative Works; and
101
+
102
+ (d) If the Work includes a "NOTICE" text file as part of its
103
+ distribution, You must include a readable copy of the attribution
104
+ notices contained within such NOTICE file, in at least one of the
105
+ following places: within a NOTICE text provided as part of the
106
+ Derivative Works; within the Source form or documentation, if
107
+ provided along with the Derivative Works; or, within a display
108
+ generated by the Derivative Works, if and wherever such third-party
109
+ notices normally appear. The contents of the NOTICE file are for
110
+ informational purposes only and do not modify the License. You may
111
+ add Your own attribution notices within Derivative Works that You
112
+ distribute, alongside or in addition to the NOTICE text from the
113
+ Work, provided that such additional attribution notices cannot be
114
+ construed as modifying the License.
115
+
116
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
117
+ any Contribution intentionally submitted for inclusion in the Work by
118
+ You to the Licensor shall be under the terms and conditions of this
119
+ License, without any additional terms or conditions.
120
+
121
+ 6. Trademarks. This License does not grant permission to use the trade
122
+ names, trademarks, service marks, or product names of the Licensor,
123
+ except as required for reasonable and customary use in describing the
124
+ origin of the Work and reproducing the content of the NOTICE file.
125
+
126
+ 7. Disclaimer of Warranty. Unless required by applicable law or
127
+ agreed to in writing, Licensor provides the Work (and each
128
+ Contributor provides its Contributions) on an "AS IS" BASIS,
129
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
130
+ implied, including, without limitation, any conditions of TITLE,
131
+ MERCHANTIBILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely
132
+ responsible for determining the appropriateness of using or
133
+ redistributing the Work and assume any risks associated with Your
134
+ exercise of permissions under this License.
135
+
136
+ 8. Limitation of Liability. In no event and under no legal theory,
137
+ whether in tort (including negligence), contract, or otherwise,
138
+ unless required by applicable law (such as deliberate and grossly
139
+ negligent acts) or agreed to in writing, shall any Contributor be
140
+ liable to You for damages, including any direct, indirect, special,
141
+ incidental, or exemplary damages of any character arising as a result
142
+ of this License or out of the use or inability to use the Work
143
+ (including but not limited to damages for loss of goodwill, work
144
+ stoppage, computer failure or malfunction, or all other commercial
145
+ damages or losses), even if such Contributor has been advised of the
146
+ possibility of such damages.
147
+
148
+ 9. Accepting Warranty or Liability. While redistributing the Work or
149
+ Derivative Works thereof, You may choose to offer, and charge a fee
150
+ for, acceptance of support, warranty, indemnity, or other liability
151
+ obligations and/or rights consistent with this License. However, in
152
+ accepting such obligations, You may offer such obligations only on
153
+ Your own behalf and on Your sole responsibility, not on behalf of any
154
+ other Contributor, and only if You agree to indemnify, defend, and
155
+ hold each Contributor harmless for any liability incurred by, or
156
+ claims asserted against, such Contributor by reason of your accepting
157
+ any such warranty or additional liability.
158
+
159
+ Copyright 2024 Conscious Clouds
160
+
161
+ Licensed under the Apache License, Version 2.0 (the "License");
162
+ you may not use this file except in compliance with the License.
163
+ You may obtain a copy of the License at
164
+
165
+ http://www.apache.org/licenses/LICENSE-2.0
166
+
167
+ Unless required by applicable law or agreed to in writing, software
168
+ distributed under the License is distributed on an "AS IS" BASIS,
169
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
170
+ See the License for the specific language governing permissions and
171
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,68 @@
1
- # Temporary Holding Version
1
+ # Appearance Experience — local 0.1.0 candidate
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Optional React 19 presentation. Import `AppearanceExperience` and its types from
4
+ `@consciousclouds/appearance-experience`, and import
5
+ `@consciousclouds/appearance-experience/styles.css` once in the host CSS entry.
6
+ No Tailwind source scanning is required; the CSS also works in Tailwind 4 hosts.
7
+
8
+ Provide the existing Universal `Brand`, approved `AccentPreset[]`, all localized
9
+ `AppearanceMessages`, capabilities, an immutable account/scope `contextKey`, and a
10
+ stable `AppearanceAdapter`. Both `embedded` and `standalone` layouts are panels;
11
+ neither owns a route, application shell, global ThemeProvider or persistence.
12
+
13
+ ## Contract
14
+
15
+ `AppearanceSnapshot` contains saved `overrides`, canonical `effective` values and
16
+ an optional opaque `revision`. Omitted mode/accent means inheritance. `load`,
17
+ `save` and `reset` return a snapshot or `denied | unavailable | failed | conflict`.
18
+ Every operation receives an AbortSignal; writes also receive the saved revision.
19
+ The product's pure `resolve(draft, saved)` function determines preview precedence.
20
+ It must return a supported mode and an approved accent identifier.
21
+
22
+ Bind an adapter to one immutable account/scope. Change `contextKey` whenever the
23
+ account, scope, permissions policy, allowed catalog or inherited defaults change.
24
+ Keep adapter identity stable within that context. Context/capability changes
25
+ remount the panel, abort outstanding requests, and discard late results even if
26
+ an adapter ignores abort. A remote write already accepted by a server cannot be
27
+ undone by abort: adapters must capture the correct scope and enforce permissions
28
+ server-side. A revision provides conflict protection only when the backend enforces it.
29
+
30
+ Preview affects only the scoped sample. Apply commits draft overrides. Cancel
31
+ restores the saved draft/sample without persistence. Reset stages removal of the
32
+ selected scope's overrides; Apply then invokes `reset`. Editing after Reset turns
33
+ the operation into a save of the edited overrides. Save failures preserve the draft
34
+ and committed presentation separately. Unexpected load errors show unavailable;
35
+ unexpected write errors show failed. Raw service errors are never rendered.
36
+
37
+ Capabilities hide unsupported mode/accent controls, disable writes and suppress
38
+ loads when read access is absent. They do not grant authorization. Typography,
39
+ density, schedules, scope pickers and lifecycle/authentication screens are absent.
40
+
41
+ ## Styling and accessibility
42
+
43
+ Brand 0.1.2 adds isolated HSL CSS generation. The panel shows saved appearance;
44
+ the preview can show a separate draft. Host root classes/tokens are never changed.
45
+ Accents override the product brand's mode values only inside these scopes. Missing
46
+ sample roles use scoped baseline values; every preset's color values must be HSL
47
+ channel triples, not full `hsl()`/`oklch()` expressions. Fonts are inherited from
48
+ the host; product assets and preference precedence remain product-owned.
49
+
50
+ All messages, option labels and headings are product-provided. Use `locale`,
51
+ `dir` and `headingLevel` for embedding. Native radios/selects support keyboard
52
+ navigation; status is a polite live region. Controls have visible focus and 44px
53
+ minimum targets. The module uses the existing UI reduced-motion hook and introduces
54
+ no animation. It does not change OS preferences or other application animations.
55
+ Pass `nonce` when inline scoped styles require a CSP nonce. Host-wide `!important`
56
+ CSS can override ordinary component CSS; such hosts need their own compatibility test.
57
+ Product palettes must pass contrast checks; syntactic HSL validation is not a contrast certificate.
58
+
59
+ ## Distribution
60
+
61
+ Dependencies: Brand ^0.1.2, Tokens ^0.1.1, UI ^0.1.1; React/DOM ^19.0.0 peers.
62
+ ShellFrame and OperatorShell are not dependencies. ESM/public exports only.
63
+ Build with `npm run build`; packing invokes build/type-check. Production artifacts
64
+ require no source checkout or workspace links and contain no SDK transport or storage implementation.
65
+
66
+ See `scripts/appearance-experience/README.md` in the Universal source review for
67
+ artifact-only fixture reproduction, hashes, adapter specifications and limitations.
68
+ Local candidates are not registry-publication or product-adoption proof.
@@ -0,0 +1,3 @@
1
+ import type { AppearanceExperienceProps } from "./contracts.js";
2
+ /** Pure presentation boundary; context changes synchronously remove the previous account's view. */
3
+ export declare function AppearanceExperience(props: AppearanceExperienceProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,136 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { scopedBrandTokenOverridesCss } from "@consciousclouds/brand";
5
+ import { Button, useReducedMotion } from "@consciousclouds/ui";
6
+ const modes = ["light", "dark", "system"];
7
+ const initial = () => ({ draft: {}, pending: true, preview: false, reset: false, applied: false });
8
+ const same = (a, b) => a.mode === b.mode && a.accent === b.accent;
9
+ /** Pure presentation boundary; context changes synchronously remove the previous account's view. */
10
+ export function AppearanceExperience(props) {
11
+ const c = props.capabilities;
12
+ return _jsx(Panel, { ...props }, JSON.stringify([props.contextKey, c.read, c.write, c.reset, c.mode, c.accent]));
13
+ }
14
+ function Panel({ adapter, capabilities: caps, brand, accents, messages: m, layout = "embedded", headingLevel = 2, locale, dir, nonce }) {
15
+ const uid = `appearance-${React.useId().replace(/[^a-zA-Z0-9_-]/g, "")}`;
16
+ const [state, setState] = React.useState(initial);
17
+ const [reload, setReload] = React.useState(0);
18
+ const generation = React.useRef(0);
19
+ const active = React.useRef(null);
20
+ // Ref prevents duplicate calls in the same event batch, before React disables controls.
21
+ const busy = React.useRef(true);
22
+ const reduced = useReducedMotion();
23
+ const Heading = `h${headingLevel}`;
24
+ const ids = new Set(accents.map(a => a.id));
25
+ if (!accents.length || ids.size !== accents.length || accents.some(a => !a.id))
26
+ throw new TypeError("Appearance requires unique approved accent presets");
27
+ // Validate ALL preset configurations, including options not yet selected.
28
+ for (const a of accents)
29
+ scopedBrandTokenOverridesCss(a.tokens, uid);
30
+ scopedBrandTokenOverridesCss(brand.tokenOverrides, uid);
31
+ function validateValues(value) {
32
+ if (!value || !modes.includes(value.mode) || !ids.has(value.accent))
33
+ throw new TypeError("Unsupported effective appearance");
34
+ }
35
+ function validateSnapshot(value) {
36
+ validateValues(value.effective);
37
+ const o = value.overrides;
38
+ if (!o || Object.keys(o).some(k => k !== "mode" && k !== "accent") ||
39
+ (o.mode !== undefined && !modes.includes(o.mode)) || (o.accent !== undefined && !ids.has(o.accent))) {
40
+ throw new TypeError("Unsupported appearance overrides");
41
+ }
42
+ }
43
+ React.useEffect(() => {
44
+ const ticket = ++generation.current;
45
+ const controller = new AbortController();
46
+ active.current = controller;
47
+ busy.current = true;
48
+ setState(initial());
49
+ if (!caps.read) {
50
+ busy.current = false;
51
+ setState({ ...initial(), pending: false, failure: "denied" });
52
+ return () => { generation.current++; controller.abort(); };
53
+ }
54
+ async function load() {
55
+ try {
56
+ const result = await adapter.load({ signal: controller.signal });
57
+ if (ticket !== generation.current || controller.signal.aborted)
58
+ return;
59
+ if (result.ok) {
60
+ validateSnapshot(result.snapshot);
61
+ setState({ ...initial(), pending: false, snapshot: result.snapshot, draft: { ...result.snapshot.overrides } });
62
+ }
63
+ else
64
+ setState({ ...initial(), pending: false, failure: result.reason });
65
+ }
66
+ catch {
67
+ if (ticket === generation.current && !controller.signal.aborted)
68
+ setState({ ...initial(), pending: false, failure: "unavailable" });
69
+ }
70
+ finally {
71
+ if (ticket === generation.current)
72
+ busy.current = false;
73
+ }
74
+ }
75
+ void load();
76
+ return () => { generation.current++; controller.abort(); active.current?.abort(); };
77
+ // Brand/catalog/policy revisions belong in contextKey; keep adapter identity stable.
78
+ // eslint-disable-next-line react-hooks/exhaustive-deps
79
+ }, [adapter, reload, caps.read]);
80
+ const dirty = !!state.snapshot && (state.reset || !same(state.draft, state.snapshot.overrides));
81
+ const locked = state.pending || !caps.write || !state.snapshot;
82
+ const selected = state.snapshot && (state.preview ? adapter.resolve(state.draft, state.snapshot) : state.snapshot.effective);
83
+ if (selected)
84
+ validateValues(selected);
85
+ const preset = selected && accents.find(a => a.id === selected.accent);
86
+ const overrides = {
87
+ light: { ...brand.tokenOverrides?.light, ...preset?.tokens.light },
88
+ dark: { ...brand.tokenOverrides?.dark, ...preset?.tokens.dark },
89
+ };
90
+ const savedPreset = state.snapshot && accents.find(a => a.id === state.snapshot.effective.accent);
91
+ const panelCss = scopedBrandTokenOverridesCss({
92
+ light: { ...brand.tokenOverrides?.light, ...savedPreset?.tokens.light },
93
+ dark: { ...brand.tokenOverrides?.dark, ...savedPreset?.tokens.dark },
94
+ }, `${uid}-panel`);
95
+ const css = panelCss + "\n" + scopedBrandTokenOverridesCss(overrides, uid);
96
+ function edit(patch) {
97
+ if (locked || busy.current)
98
+ return;
99
+ setState(s => ({ ...s, draft: { ...s.draft, ...patch }, reset: false, failure: undefined, applied: false }));
100
+ }
101
+ async function apply() {
102
+ if (locked || busy.current || !dirty || !state.snapshot)
103
+ return;
104
+ busy.current = true;
105
+ const ticket = ++generation.current;
106
+ active.current?.abort();
107
+ const controller = new AbortController();
108
+ active.current = controller;
109
+ const request = { signal: controller.signal, revision: state.snapshot.revision };
110
+ setState(s => ({ ...s, pending: true, failure: undefined, applied: false }));
111
+ try {
112
+ const result = state.reset ? await adapter.reset(request) : await adapter.save({ ...state.draft }, request);
113
+ if (ticket !== generation.current || controller.signal.aborted)
114
+ return;
115
+ if (result.ok) {
116
+ validateSnapshot(result.snapshot);
117
+ setState({ ...initial(), pending: false, snapshot: result.snapshot, draft: { ...result.snapshot.overrides }, applied: true });
118
+ }
119
+ else
120
+ setState(s => ({ ...s, pending: false, failure: result.reason }));
121
+ }
122
+ catch {
123
+ if (ticket === generation.current && !controller.signal.aborted)
124
+ setState(s => ({ ...s, pending: false, failure: "failed" }));
125
+ }
126
+ finally {
127
+ if (ticket === generation.current)
128
+ busy.current = false;
129
+ }
130
+ }
131
+ const status = state.pending ? (state.snapshot ? m.saving : m.loading)
132
+ : state.failure ? m[state.failure] : !caps.write ? m.readOnly
133
+ : state.reset ? m.resetPending : dirty ? m.unsaved : state.applied ? m.saved : "";
134
+ return _jsxs("section", { className: "cc-appearance", "data-layout": layout, "data-cc-brand-scope": `${uid}-panel`, "data-cc-mode": state.snapshot?.effective.mode ?? "system", "data-reduced-motion": reduced, lang: locale, dir: dir, "aria-labelledby": `${uid}-title`, children: [_jsx(Heading, { id: `${uid}-title`, className: "cc-a-title", children: m.title }), _jsx("p", { className: "cc-a-description", children: m.description }), _jsx("p", { className: "cc-a-status", role: "status", "aria-live": "polite", "aria-atomic": "true", children: status }), !state.snapshot && !state.pending && caps.read && _jsx(Button, { className: "cc-a-button", onClick: () => setReload(n => n + 1), children: m.retry }), state.snapshot && _jsxs(_Fragment, { children: [_jsxs("div", { className: "cc-a-controls", "aria-busy": state.pending, children: [caps.mode && _jsxs("fieldset", { disabled: locked, className: "cc-a-fieldset", children: [_jsx("legend", { children: m.mode }), _jsx("div", { className: "cc-a-options", children: [undefined, ...modes].map(mode => _jsxs("label", { className: "cc-a-option", children: [_jsx("input", { type: "radio", name: `${uid}-mode`, value: mode ?? "inherit", checked: state.draft.mode === mode, onChange: () => edit({ mode }) }), _jsx("span", { children: mode ? m[mode] : m.inherit })] }, mode ?? "inherit")) })] }), caps.accent && _jsxs("label", { className: "cc-a-accent", htmlFor: `${uid}-accent`, children: [_jsx("span", { children: m.accent }), _jsxs("select", { id: `${uid}-accent`, disabled: locked, value: state.draft.accent ?? "", onChange: e => edit({ accent: e.target.value || undefined }), children: [_jsx("option", { value: "", children: m.inherit }), accents.map(a => _jsx("option", { value: a.id, children: a.label }, a.id))] })] })] }), _jsxs("div", { className: "cc-a-actions", children: [_jsx(Button, { className: "cc-a-button", "aria-pressed": state.preview, disabled: state.pending, onClick: () => setState(s => ({ ...s, preview: !s.preview })), children: m.preview }), _jsx(Button, { className: "cc-a-button", disabled: locked || !dirty, onClick: () => void apply(), children: m.apply }), _jsx(Button, { className: "cc-a-button", disabled: state.pending || (!dirty && !state.preview), onClick: () => setState(s => ({ ...s, draft: { ...s.snapshot.overrides }, reset: false, preview: false, failure: undefined, applied: false })), children: m.cancel }), caps.reset && _jsx(Button, { className: "cc-a-button", disabled: locked, onClick: () => setState(s => ({ ...s, draft: {}, reset: true, preview: true, failure: undefined, applied: false })), children: m.reset })] }), _jsx("style", { nonce: nonce, children: css }), _jsxs("div", { className: "cc-a-preview", "data-cc-brand-scope": uid, "data-cc-mode": selected?.mode, role: "region", "aria-label": m.previewTitle, children: [_jsx("strong", { children: m.previewTitle }), _jsx("p", { children: m.previewText }), _jsx("span", { className: "cc-a-preview-action", children: m.previewAction })] })] })] });
135
+ }
136
+ //# sourceMappingURL=appearance-experience.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"appearance-experience.js","sourceRoot":"","sources":["../src/appearance-experience.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAG/D,MAAM,KAAK,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAU,CAAC;AAUnD,MAAM,OAAO,GAAG,GAAU,EAAE,CAAC,CAAC,EAAE,KAAK,E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EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,YAAG,CAAC,CAAC,KAAK,GAAU,IACpM,EACN,gBAAO,KAAK,EAAE,KAAK,YAAG,GAAG,GAAS,EAClC,eAAK,SAAS,EAAC,cAAc,yBAAsB,GAAG,kBAAgB,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAC,QAAQ,gBAAa,CAAC,CAAC,YAAY,aAC5H,2BAAS,CAAC,CAAC,YAAY,GAAU,EAAA,sBAAI,CAAC,CAAC,WAAW,GAAK,EACvD,eAAM,SAAS,EAAC,qBAAqB,YAAE,CAAC,CAAC,aAAa,GAAQ,IAC1D,IACL,IACK,CAAC;AACb,CAAC"}
@@ -0,0 +1,90 @@
1
+ import type { Brand } from "@consciousclouds/brand";
2
+ import type { TokenModeValues } from "@consciousclouds/tokens";
3
+ export type AppearanceMode = "light" | "dark" | "system";
4
+ export interface AppearanceValues {
5
+ mode: AppearanceMode;
6
+ accent: string;
7
+ }
8
+ /** Omitted properties mean inheritance, never a fabricated Universal default. */
9
+ export type AppearanceOverrides = Partial<AppearanceValues>;
10
+ export interface AppearanceSnapshot {
11
+ overrides: AppearanceOverrides;
12
+ effective: AppearanceValues;
13
+ /** Opaque product revision; the module makes no concurrency guarantee without it. */
14
+ revision?: string;
15
+ }
16
+ export type AppearanceFailure = "denied" | "unavailable" | "failed" | "conflict";
17
+ export type AppearanceResult = {
18
+ ok: true;
19
+ snapshot: AppearanceSnapshot;
20
+ } | {
21
+ ok: false;
22
+ reason: AppearanceFailure;
23
+ };
24
+ export interface AppearanceRequest {
25
+ signal: AbortSignal;
26
+ revision?: string;
27
+ }
28
+ /** Bind each adapter to ONE account/scope. Never look up a mutable current account inside an async action. */
29
+ export interface AppearanceAdapter {
30
+ load(request: AppearanceRequest): Promise<AppearanceResult>;
31
+ save(overrides: AppearanceOverrides, request: AppearanceRequest): Promise<AppearanceResult>;
32
+ reset(request: AppearanceRequest): Promise<AppearanceResult>;
33
+ /** Pure product-owned precedence. No I/O or persistence during preview. */
34
+ resolve(overrides: AppearanceOverrides, saved: AppearanceSnapshot): AppearanceValues;
35
+ }
36
+ export interface AppearanceCapabilities {
37
+ read: boolean;
38
+ write: boolean;
39
+ reset: boolean;
40
+ mode: boolean;
41
+ accent: boolean;
42
+ }
43
+ export interface AccentPreset {
44
+ id: string;
45
+ label: string;
46
+ tokens: TokenModeValues;
47
+ }
48
+ export interface AppearanceMessages {
49
+ title: string;
50
+ description: string;
51
+ mode: string;
52
+ accent: string;
53
+ light: string;
54
+ dark: string;
55
+ system: string;
56
+ inherit: string;
57
+ preview: string;
58
+ previewTitle: string;
59
+ previewText: string;
60
+ previewAction: string;
61
+ apply: string;
62
+ cancel: string;
63
+ reset: string;
64
+ retry: string;
65
+ loading: string;
66
+ saving: string;
67
+ saved: string;
68
+ unsaved: string;
69
+ resetPending: string;
70
+ denied: string;
71
+ unavailable: string;
72
+ failed: string;
73
+ conflict: string;
74
+ readOnly: string;
75
+ }
76
+ export interface AppearanceExperienceProps {
77
+ /** Change on account, scope, policy or inherited-preference revision changes. Remounts/aborts stale work. */
78
+ contextKey: string;
79
+ adapter: AppearanceAdapter;
80
+ capabilities: AppearanceCapabilities;
81
+ brand: Brand;
82
+ accents: readonly AccentPreset[];
83
+ messages: AppearanceMessages;
84
+ layout?: "embedded" | "standalone";
85
+ headingLevel?: 1 | 2 | 3;
86
+ locale?: string;
87
+ dir?: "ltr" | "rtl";
88
+ /** CSP nonce for generated scoped brand CSS, if required by the host. */
89
+ nonce?: string;
90
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=contracts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contracts.js","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export { AppearanceExperience } from "./appearance-experience.js";
2
+ export type * from "./contracts.js";
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { AppearanceExperience } from "./appearance-experience.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,49 @@
1
1
  {
2
2
  "name": "@consciousclouds/appearance-experience",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.1",
4
+ "description": "Optional React Appearance experience with product-owned persistence and preference resolution",
5
+ "license": "Apache-2.0",
6
+ "type": "module",
7
+ "main": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js"
13
+ },
14
+ "./styles.css": "./styles/appearance.css"
15
+ },
16
+ "files": [
17
+ "dist",
18
+ "styles",
19
+ "README.md",
20
+ "LICENSE"
21
+ ],
22
+ "sideEffects": [
23
+ "**/*.css"
24
+ ],
25
+ "scripts": {
26
+ "build": "tsc -p tsconfig.build.json",
27
+ "type-check": "tsc --noEmit",
28
+ "prepack": "npm run build && npm run type-check"
29
+ },
30
+ "dependencies": {
31
+ "@consciousclouds/brand": "^0.1.2",
32
+ "@consciousclouds/tokens": "^0.1.1",
33
+ "@consciousclouds/ui": "^0.2.0"
34
+ },
35
+ "peerDependencies": {
36
+ "react": "^19.0.0",
37
+ "react-dom": "^19.0.0"
38
+ },
39
+ "devDependencies": {
40
+ "typescript": "5.9.3",
41
+ "@types/react": "19.2.14",
42
+ "@types/react-dom": "19.2.3",
43
+ "react": "19.2.4",
44
+ "react-dom": "19.2.4"
45
+ },
46
+ "publishConfig": {
47
+ "access": "public"
48
+ }
49
+ }
@@ -0,0 +1,31 @@
1
+ /* Baseline semantic values are scoped; they never inherit incompatible host colors. */
2
+ .cc-appearance { --background: 0 0% 100%; --foreground: 240 10% 3.9%; --primary: 243 75% 59%; --primary-foreground: 0 0% 98%; --border: 240 5.9% 45%; }
3
+ .cc-appearance:where([data-cc-mode="dark"]) { --background: 240 10% 3.9%; --foreground: 0 0% 98%; --primary: 243 75% 70%; --border: 240 3.7% 60%; }
4
+ @media (prefers-color-scheme: dark) { .cc-appearance:where([data-cc-mode="system"]) { --background: 240 10% 3.9%; --foreground: 0 0% 98%; --primary: 243 75% 70%; --border: 240 3.7% 60%; } }
5
+ /* Self-contained module styles; no Tailwind scan, preflight or document-root writes.
6
+ Neutral editor chrome intentionally stays separate from the draft preview. */
7
+ .cc-appearance { box-sizing: border-box; color: hsl(var(--foreground)); background: hsl(var(--background)); font-family: inherit; font-size: 1rem; line-height: 1.5; padding: 1.25rem; border: 1px solid hsl(var(--border)); border-radius: .75rem; max-width: 48rem; width: 100%; text-align: start; }
8
+ .cc-appearance *, .cc-appearance *::before, .cc-appearance *::after { box-sizing: border-box; }
9
+ .cc-appearance[data-layout="standalone"] { margin-inline: auto; padding: clamp(1rem, 4vw, 2rem); }
10
+ .cc-appearance .cc-a-title { margin: 0; font-size: 1.35rem; font-weight: 650; line-height: 1.3; }
11
+ .cc-appearance .cc-a-description { margin: .5rem 0; }
12
+ .cc-appearance .cc-a-status { min-height: 1.5em; margin: .75rem 0; }
13
+ .cc-appearance .cc-a-controls { display: grid; gap: 1.25rem; }
14
+ .cc-appearance .cc-a-fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
15
+ .cc-appearance legend, .cc-appearance .cc-a-accent > span { display: block; font-weight: 600; margin-block-end: .5rem; }
16
+ .cc-appearance .cc-a-options { display: flex; flex-wrap: wrap; gap: .5rem; }
17
+ .cc-appearance .cc-a-option { display: flex; gap: .5rem; align-items: center; padding: .65rem; min-height: 44px; border: 1px solid hsl(var(--border)); border-radius: .35rem; }
18
+ .cc-appearance input[type="radio"] { appearance: auto; inline-size: 1rem; block-size: 1rem; margin: 0; accent-color: hsl(var(--foreground)); }
19
+ .cc-appearance select { appearance: auto; font: inherit; color: hsl(var(--foreground)); background: hsl(var(--background)); border: 1px solid hsl(var(--border)); border-radius: .35rem; min-height: 44px; padding: .5rem; max-width: 100%; width: 100%; }
20
+ .cc-appearance .cc-a-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-block: 1.25rem; }
21
+ .cc-appearance button.cc-a-button { display: inline-flex; justify-content: center; align-items: center; font: inherit; color: hsl(var(--foreground)); background: hsl(var(--background)); border: 1px solid hsl(var(--foreground)); border-radius: .35rem; min-height: 44px; height: auto; padding: .5rem 1rem; box-shadow: none; white-space: normal; transition: none; cursor: pointer; }
22
+ .cc-appearance button.cc-a-button[aria-pressed="true"] { box-shadow: inset 0 0 0 2px hsl(var(--primary)); }
23
+ .cc-appearance button.cc-a-button:disabled, .cc-appearance fieldset:disabled { opacity: .65; cursor: default; }
24
+ .cc-appearance :is(button, input, select):focus-visible { outline: 3px solid hsl(var(--primary)); outline-offset: 3px; }
25
+ :where(.cc-appearance) .cc-a-preview { --background: 0 0% 100%; --foreground: 240 10% 3.9%; --primary: 243 75% 59%; --primary-foreground: 0 0% 98%; --border: 240 5.9% 90%; color: hsl(var(--foreground)); background: hsl(var(--background)); border: 1px solid hsl(var(--border)); padding: 1rem; border-radius: .5rem; color-scheme: light; }
26
+ :where(.cc-appearance) .cc-a-preview:where([data-cc-mode="dark"]) { --background: 240 10% 3.9%; --foreground: 0 0% 98%; --primary: 243 75% 59%; --primary-foreground: 0 0% 98%; --border: 240 3.7% 15.9%; color-scheme: dark; }
27
+ @media (prefers-color-scheme: dark) { :where(.cc-appearance) .cc-a-preview:where([data-cc-mode="system"]) { --background: 240 10% 3.9%; --foreground: 0 0% 98%; --primary: 243 75% 59%; --primary-foreground: 0 0% 98%; --border: 240 3.7% 15.9%; color-scheme: dark; } }
28
+ .cc-appearance .cc-a-preview-action { display: inline-block; background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); padding: .5rem 1rem; border-radius: .25rem; }
29
+ .cc-appearance[data-reduced-motion="true"] *, .cc-appearance * { animation: none; transition: none; }
30
+ @media (max-width: 420px) { .cc-appearance .cc-a-actions { display: grid; grid-template-columns: 1fr 1fr; } }
31
+ @media (forced-colors: active) { .cc-appearance, .cc-appearance .cc-a-preview, .cc-appearance .cc-a-option { border-color: CanvasText; } }