@citrusworx/juiceui 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +263 -233
- package/dist/index.css +807 -3
- package/dist/index.d.ts +4 -0
- package/dist/index.js +418 -45
- package/dist/js/juice.d.ts +6 -0
- package/dist/js/src/accordion/accordion-runtime.d.ts +16 -0
- package/dist/js/src/tabs/tabs-runtime.d.ts +16 -0
- package/dist/themes/aquaflux.css +152 -0
- package/dist/themes/citrusmint.css +124 -0
- package/dist/themes/index.d.ts +2 -0
- package/dist/themes/kiwipress.css +123 -10
- package/dist/tokens/index.d.ts +15 -0
- package/package.json +117 -109
- package/dist/components/accordion/accordion.test.d.ts +0 -1
package/README.md
CHANGED
|
@@ -1,233 +1,263 @@
|
|
|
1
|
-
# @citrusworx/juiceui
|
|
2
|
-
|
|
3
|
-
Juice is an attribute-driven styling library for CitrusWorx apps. It packages the compiled Juice stylesheet and a small JS entrypoint so applications can import shared tokens and styles from one place.
|
|
4
|
-
|
|
5
|
-
## Published Surface
|
|
6
|
-
|
|
7
|
-
The production package surface is intentionally small:
|
|
8
|
-
|
|
9
|
-
- `@citrusworx/juiceui`
|
|
10
|
-
- `@citrusworx/juiceui/styles` (core CSS only)
|
|
11
|
-
- `@citrusworx/juiceui/styles/themes/<id>` (per-theme CSS)
|
|
12
|
-
- the built artifacts in `dist/`
|
|
13
|
-
|
|
14
|
-
These are the stable consumer-facing entrypoints for the package.
|
|
15
|
-
|
|
16
|
-
## Internal Workspace Assets
|
|
17
|
-
|
|
18
|
-
The Juice workspace also contains internal-only material that is not part of the published runtime contract:
|
|
19
|
-
|
|
20
|
-
- `src/native/` playground and experiments
|
|
21
|
-
- `src/templates/` HTML examples
|
|
22
|
-
- `src/tools/` compiler helpers
|
|
23
|
-
- `.mockups/` and `test-results/`
|
|
24
|
-
- local build tooling like `gulp.ts`, `vite.config.ts`, and `juice.config.yaml`
|
|
25
|
-
|
|
26
|
-
Those are useful for monorepo development, but they are not part of the public API of `@citrusworx/juiceui`.
|
|
27
|
-
|
|
28
|
-
## Install
|
|
29
|
-
|
|
30
|
-
```bash
|
|
31
|
-
yarn add @citrusworx/juiceui
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
## Use the stylesheet
|
|
35
|
-
|
|
36
|
-
Core utilities and components (no theme identity):
|
|
37
|
-
|
|
38
|
-
```ts
|
|
39
|
-
import "@citrusworx/juiceui/styles";
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
## Themes (Beta)
|
|
43
|
-
|
|
44
|
-
**Breaking change:** `@citrusworx/juiceui/styles` is **core only**. Import a theme stylesheet explicitly:
|
|
45
|
-
|
|
46
|
-
```ts
|
|
47
|
-
import "@citrusworx/juiceui/styles";
|
|
48
|
-
import "@citrusworx/juiceui/styles/themes/aquaflux";
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
```html
|
|
52
|
-
<body theme="aquaflux">
|
|
53
|
-
<!-- or theme="kiwipress" | theme="citrusmint" -->
|
|
54
|
-
</body>
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
Built files: `dist/index.css` (core), `dist/themes/<id>.css` (theme). Each theme is authored as `<themeId>.scss` + `<themeId>.yaml` under `src/themes/<themeId>/`. See [docs/juice/juice-theme-authoring.md](../../docs/juice/juice-theme-authoring.md).
|
|
58
|
-
|
|
59
|
-
## Responsive behavior
|
|
60
|
-
|
|
61
|
-
Built-in breakpoints, `row` collapse, and scaled spacing are documented in [docs/juice/juice-responsive-reference.md](../../docs/juice/juice-responsive-reference.md).
|
|
62
|
-
|
|
63
|
-
## Surfaces
|
|
64
|
-
|
|
65
|
-
Beta-stable: `surfaceTone="soft"`. See [docs/juice/juice-surfaces.md](../../docs/juice/juice-surfaces.md).
|
|
66
|
-
|
|
67
|
-
## Motion (Beta)
|
|
68
|
-
|
|
69
|
-
Use the `motion` attribute for animations (for example `motion="fade.in"`, `motion="spin::fast"`). See [docs/juice/juice-animations.md](../../docs/juice/juice-animations.md).
|
|
70
|
-
|
|
71
|
-
## Use the JS API
|
|
72
|
-
|
|
73
|
-
```ts
|
|
74
|
-
import {
|
|
75
|
-
Accordion,
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
##
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
-
|
|
114
|
-
|
|
115
|
-
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
-
|
|
125
|
-
-
|
|
126
|
-
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
1
|
+
# @citrusworx/juiceui
|
|
2
|
+
|
|
3
|
+
Juice is an attribute-driven styling library for CitrusWorx apps. It packages the compiled Juice stylesheet and a small JS entrypoint so applications can import shared tokens and styles from one place.
|
|
4
|
+
|
|
5
|
+
## Published Surface
|
|
6
|
+
|
|
7
|
+
The production package surface is intentionally small:
|
|
8
|
+
|
|
9
|
+
- `@citrusworx/juiceui`
|
|
10
|
+
- `@citrusworx/juiceui/styles` (core CSS only)
|
|
11
|
+
- `@citrusworx/juiceui/styles/themes/<id>` (per-theme CSS)
|
|
12
|
+
- the built artifacts in `dist/`
|
|
13
|
+
|
|
14
|
+
These are the stable consumer-facing entrypoints for the package.
|
|
15
|
+
|
|
16
|
+
## Internal Workspace Assets
|
|
17
|
+
|
|
18
|
+
The Juice workspace also contains internal-only material that is not part of the published runtime contract:
|
|
19
|
+
|
|
20
|
+
- `src/native/` playground and experiments
|
|
21
|
+
- `src/templates/` HTML examples
|
|
22
|
+
- `src/tools/` compiler helpers
|
|
23
|
+
- `.mockups/` and `test-results/`
|
|
24
|
+
- local build tooling like `gulp.ts`, `vite.config.ts`, and `juice.config.yaml`
|
|
25
|
+
|
|
26
|
+
Those are useful for monorepo development, but they are not part of the public API of `@citrusworx/juiceui`.
|
|
27
|
+
|
|
28
|
+
## Install
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
yarn add @citrusworx/juiceui
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Use the stylesheet
|
|
35
|
+
|
|
36
|
+
Core utilities and components (no theme identity):
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
import "@citrusworx/juiceui/styles";
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Themes (Beta)
|
|
43
|
+
|
|
44
|
+
**Breaking change:** `@citrusworx/juiceui/styles` is **core only**. Import a theme stylesheet explicitly:
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
import "@citrusworx/juiceui/styles";
|
|
48
|
+
import "@citrusworx/juiceui/styles/themes/aquaflux";
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
```html
|
|
52
|
+
<body theme="aquaflux">
|
|
53
|
+
<!-- or theme="kiwipress" | theme="citrusmint" -->
|
|
54
|
+
</body>
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Built files: `dist/index.css` (core), `dist/themes/<id>.css` (theme). Each theme is authored as `<themeId>.scss` + `<themeId>.yaml` under `src/themes/<themeId>/`. See [docs/juice/juice-theme-authoring.md](../../docs/juice/juice-theme-authoring.md).
|
|
58
|
+
|
|
59
|
+
## Responsive behavior
|
|
60
|
+
|
|
61
|
+
Built-in breakpoints, `row` collapse, and scaled spacing are documented in [docs/juice/juice-responsive-reference.md](../../docs/juice/juice-responsive-reference.md).
|
|
62
|
+
|
|
63
|
+
## Surfaces
|
|
64
|
+
|
|
65
|
+
Beta-stable: `surfaceTone="soft"`. See [docs/juice/juice-surfaces.md](../../docs/juice/juice-surfaces.md).
|
|
66
|
+
|
|
67
|
+
## Motion (Beta)
|
|
68
|
+
|
|
69
|
+
Use the `motion` attribute for animations (for example `motion="fade.in"`, `motion="spin::fast"`). See [docs/juice/juice-animations.md](../../docs/juice/juice-animations.md).
|
|
70
|
+
|
|
71
|
+
## Use the JS API
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
import {
|
|
75
|
+
Accordion,
|
|
76
|
+
createAccordion,
|
|
77
|
+
initAccordion,
|
|
78
|
+
startAccordionRuntime,
|
|
79
|
+
stopAccordionRuntime,
|
|
80
|
+
createTabs,
|
|
81
|
+
initTabs,
|
|
82
|
+
startTabsRuntime,
|
|
83
|
+
stopTabsRuntime,
|
|
84
|
+
createNavigation,
|
|
85
|
+
initNavigation,
|
|
86
|
+
startNavigationRuntime,
|
|
87
|
+
stopNavigationRuntime,
|
|
88
|
+
tokens
|
|
89
|
+
} from "@citrusworx/juiceui";
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
The top-level JS entrypoint is intentionally small. Those named exports are the stable runtime API Juice currently promises.
|
|
93
|
+
|
|
94
|
+
Importing that entry auto-starts the navigation, accordion, and tabs runtimes in the browser. Valid `[accordion]` and `[tabs]` markup work without app init. See [docs/juice/juice-accordion-runtime.md](../../docs/juice/juice-accordion-runtime.md) and [docs/juice/juice-tabs-runtime.md](../../docs/juice/juice-tabs-runtime.md).
|
|
95
|
+
|
|
96
|
+
## Use the built files directly
|
|
97
|
+
|
|
98
|
+
If you are hosting Juice assets yourself, the main built files are:
|
|
99
|
+
|
|
100
|
+
- `dist/index.css` (core)
|
|
101
|
+
- `dist/themes/aquaflux.css`, `dist/themes/kiwipress.css`, `dist/themes/citrusmint.css`
|
|
102
|
+
- `dist/themes/_draft/tide.css` (local draft artifact only — blocked from package `exports` and omitted from the published tarball)
|
|
103
|
+
- `dist/index.js`
|
|
104
|
+
|
|
105
|
+
Load core plus at least one theme CSS file when using `theme="..."` on the root element.
|
|
106
|
+
|
|
107
|
+
## Example
|
|
108
|
+
|
|
109
|
+
```html
|
|
110
|
+
<section stack gap="1" padding="2rem">
|
|
111
|
+
<h1 font="bebas-neue" fontColor="obsidian-900">Juice</h1>
|
|
112
|
+
<p font="lato" fontColor="gray-700">
|
|
113
|
+
Attribute-driven styling from shared design tokens.
|
|
114
|
+
</p>
|
|
115
|
+
<button bgColor="green-500" hover="green-600" fontColor="white-100" padding="1rem">
|
|
116
|
+
Get started
|
|
117
|
+
</button>
|
|
118
|
+
</section>
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## What is implemented today
|
|
122
|
+
|
|
123
|
+
- compiled CSS output at `dist/index.css`
|
|
124
|
+
- compiled JS output at `dist/index.js`
|
|
125
|
+
- color tokens and swatches
|
|
126
|
+
- Google and Adobe font selectors
|
|
127
|
+
- attribute selectors for color, spacing, width, height, gradients, shadows, and icons
|
|
128
|
+
- layout primitives for `stack`, `row`, `grid`, `gap`, and `span`
|
|
129
|
+
- FontAwesome Free icon integration across the solid, regular, and brands sets
|
|
130
|
+
|
|
131
|
+
## Accessibility
|
|
132
|
+
|
|
133
|
+
Juice keeps styling attribute-first, but interactive patterns still need accessible relationships and names.
|
|
134
|
+
|
|
135
|
+
- mobile nav toggles should expose an accessible name and control a sidebar with `aria-controls`
|
|
136
|
+
- accordion triggers should use `aria-expanded` and `aria-controls`
|
|
137
|
+
- accordion panels should be labeled regions when they contain meaningful content
|
|
138
|
+
- accordion chrome colors come from `--juice-accordion-*` roles bound by the active theme (Aquaflux, KiwiPress, and Citrusmint, plus draft Tide)
|
|
139
|
+
- group FAQ stacks in a card/panel surface (`[aqua-card]` / `[aqua-panel]` under Aquaflux, `[tide-card]` / `[tide-panel]` under draft Tide) so the accordion wrapper stays structural
|
|
140
|
+
- open/closed accordion panels use the native `hidden` attribute; do not use `content="active"` or `content="hidden"` for accordion state (those clash with layout `[content]`)
|
|
141
|
+
- optional `[motion="accordion"]` is height easing, not required for show/hide
|
|
142
|
+
- tabs live under a `[tabs]` root with `[tabs-list]`, `[tab]` triggers, and `[tab-panel]` panels; orphan triggers and panels are ignored
|
|
143
|
+
- tab selection dual-writes Juice `[active]` and `aria-selected`; the runtime also wires `role="tablist"` / `tab` / `tabpanel`, roving tabindex, and labeled panels
|
|
144
|
+
- tab chrome colors come from `--juice-tabs-*` roles bound by the active theme (Aquaflux, KiwiPress, and Citrusmint, plus draft Tide and generated `--jx-tabs-*` aliases)
|
|
145
|
+
- visible vs hidden tab panels use the native `hidden` attribute; do not use `content="active"` or `content="hidden"` for panel state
|
|
146
|
+
|
|
147
|
+
```html
|
|
148
|
+
<div tabs name="settings">
|
|
149
|
+
<div tabs-list>
|
|
150
|
+
<button type="button" tab active>Account</button>
|
|
151
|
+
<button type="button" tab>Billing</button>
|
|
152
|
+
</div>
|
|
153
|
+
<div tab-panel>Account panel</div>
|
|
154
|
+
<div tab-panel hidden>Billing panel</div>
|
|
155
|
+
</div>
|
|
156
|
+
|
|
157
|
+
<article aqua-card stack gap="0.5rem" padding="0.75rem">
|
|
158
|
+
<section accordion name="faq-account">
|
|
159
|
+
<button
|
|
160
|
+
id="faq-account-trigger"
|
|
161
|
+
type="button"
|
|
162
|
+
accordion-item
|
|
163
|
+
aria-expanded="false"
|
|
164
|
+
aria-controls="faq-account-panel"
|
|
165
|
+
>
|
|
166
|
+
How do I update billing?
|
|
167
|
+
</button>
|
|
168
|
+
|
|
169
|
+
<div
|
|
170
|
+
id="faq-account-panel"
|
|
171
|
+
role="region"
|
|
172
|
+
aria-labelledby="faq-account-trigger"
|
|
173
|
+
hidden
|
|
174
|
+
>
|
|
175
|
+
Update billing from the account dashboard.
|
|
176
|
+
</div>
|
|
177
|
+
</section>
|
|
178
|
+
</article>
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## Browser Support
|
|
182
|
+
|
|
183
|
+
Juice currently targets modern evergreen browsers:
|
|
184
|
+
|
|
185
|
+
- the last 2 Chrome versions
|
|
186
|
+
- the last 2 Edge versions
|
|
187
|
+
- the last 2 Firefox versions
|
|
188
|
+
- the last 2 Safari major versions
|
|
189
|
+
- iOS Safari `16.4+`
|
|
190
|
+
|
|
191
|
+
The CSS build runs through `autoprefixer` against that package-level browserslist target, so supported-browser behavior is part of the build contract rather than an assumption.
|
|
192
|
+
|
|
193
|
+
## Asset Policy
|
|
194
|
+
|
|
195
|
+
Juice ships a large compiled stylesheet plus the icon assets it references.
|
|
196
|
+
|
|
197
|
+
- `dist/index.css` is the main published stylesheet artifact
|
|
198
|
+
- `dist/icons/` is intentionally published and contains the icon SVG payload used by the stylesheet
|
|
199
|
+
- texture SVGs are inlined into the compiled CSS during build, so they do not ship as separate runtime files
|
|
200
|
+
|
|
201
|
+
Current release policy:
|
|
202
|
+
|
|
203
|
+
- keep `dist/index.css` under the current artifact budget
|
|
204
|
+
- keep `dist/icons/` under a separate icon payload budget
|
|
205
|
+
- avoid adding new runtime asset directories unless they are part of the published package contract
|
|
206
|
+
|
|
207
|
+
## Optional config
|
|
208
|
+
|
|
209
|
+
Juice also includes an optional config surface at `juice.config.yaml`.
|
|
210
|
+
|
|
211
|
+
This is intended for describing project-level branding concerns like:
|
|
212
|
+
|
|
213
|
+
- base colors and swatches
|
|
214
|
+
- typography roles
|
|
215
|
+
- experimental integration options
|
|
216
|
+
|
|
217
|
+
Juice can also generate full theme artifacts from config.
|
|
218
|
+
|
|
219
|
+
Library-owned themes can still come from `src/themes/<id>/<id>.config.yaml`.
|
|
220
|
+
The generator writes those derived theme contracts into `src/.generated/themes/<id>/` and the build automatically compiles them into `dist/themes/<id>.css`.
|
|
221
|
+
|
|
222
|
+
App-owned themes can be generated from an app config and committed or imported locally:
|
|
223
|
+
|
|
224
|
+
```bash
|
|
225
|
+
yarn workspace @citrusworx/juiceui generate:themes --config ../../apps/blackwatersound/front/juice.theme.yaml --css-out ../../apps/blackwatersound/front/src/generated/blackwatersound-theme.css
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
That lets an app keep its brand config while still relying on Juice for spacing, layout, surfaces, and responsive structure.
|
|
229
|
+
|
|
230
|
+
Config is not required to use Juice. The most stable current entrypoint is still the compiled stylesheet plus the existing attribute system.
|
|
231
|
+
|
|
232
|
+
Generate/discover themes directly with:
|
|
233
|
+
|
|
234
|
+
```bash
|
|
235
|
+
yarn workspace @citrusworx/juiceui generate:themes
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
## Build
|
|
239
|
+
|
|
240
|
+
```bash
|
|
241
|
+
yarn workspace @citrusworx/juiceui build
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
The build runs:
|
|
245
|
+
|
|
246
|
+
- `gulp.ts` to compile `src/juice.scss` into `dist/index.css`
|
|
247
|
+
- `vite` to build the JS entrypoint into `dist/index.js`
|
|
248
|
+
|
|
249
|
+
## Release
|
|
250
|
+
|
|
251
|
+
Before publishing a new Juice release, run:
|
|
252
|
+
|
|
253
|
+
```bash
|
|
254
|
+
yarn workspace @citrusworx/juiceui verify
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
That is the minimum publish gate for Juice right now. It rebuilds the package and reruns the package/runtime test suite so the published artifacts, accessibility runtime behavior, and package contract are all checked together.
|
|
258
|
+
|
|
259
|
+
Release notes and versioning should continue to flow through Changesets. The package changelog is consumer-facing and should describe behavior, package contract changes, and dependency updates in plain language instead of internal-only notes.
|
|
260
|
+
|
|
261
|
+
## Docs
|
|
262
|
+
|
|
263
|
+
Internal project docs live in `docs/juice/`.
|