@crystal-ui/core 2.0.0 → 2.2.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.
Files changed (38) hide show
  1. package/assets/crystal-theme.css +126 -3
  2. package/assets/crystal.css +1192 -5
  3. package/assets/crystal.js +106 -11
  4. package/assets/motion.js +17 -2
  5. package/assets/tokens.js +1 -1
  6. package/docs/accessibility.md +9 -2
  7. package/docs/adoption.md +29 -48
  8. package/docs/catalogue.md +465 -33
  9. package/docs/colors.md +84 -0
  10. package/docs/components.md +55 -25
  11. package/docs/materials.md +12 -4
  12. package/docs/motion-components.md +16 -12
  13. package/docs/motion.md +12 -2
  14. package/docs/tokens.md +31 -3
  15. package/engines.js +13 -2
  16. package/exports/crystal-tokens.kt +19 -1
  17. package/exports/crystal-tokens.swift +19 -1
  18. package/exports/crystal-tokens.ts +19 -1
  19. package/package.json +2 -1
  20. package/tokens/catalogue/01-layout.json +45 -0
  21. package/tokens/catalogue/02-navigation.json +89 -2
  22. package/tokens/catalogue/03-actions.json +42 -1
  23. package/tokens/catalogue/04-inputs.json +366 -5
  24. package/tokens/catalogue/05-data-display.json +187 -1
  25. package/tokens/catalogue/06-feedback.json +78 -6
  26. package/tokens/catalogue/07-overlays.json +50 -3
  27. package/tokens/catalogue/08-typography.json +54 -0
  28. package/tokens/catalogue/09-utility.json +79 -0
  29. package/tokens/catalogue/10-charts.json +89 -1
  30. package/tokens/catalogue/11-media.json +33 -0
  31. package/tokens/catalogue/12-commerce.json +134 -1
  32. package/tokens/catalogue/13-screens.json +81 -0
  33. package/tokens/catalogue/14-blocks.json +101 -0
  34. package/tokens/catalogue.json +1652 -21
  35. package/tokens/crystal.json +253 -13
  36. package/tokens/crystal.tokens.json +98 -2
  37. package/tokens/motion-recipes.json +216 -0
  38. package/tokens/surfaces.json +167 -0
@@ -774,6 +774,98 @@
774
774
  }
775
775
  }
776
776
  },
777
+ {
778
+ "id": "view-push-in",
779
+ "category": "Navigation",
780
+ "label": "Pushed view arrival",
781
+ "duration": 700,
782
+ "engine": "GSAP",
783
+ "keyframes": [
784
+ {
785
+ "transform": "perspective(1400px) translateX(100%) rotateY(-4deg)",
786
+ "offset": 0
787
+ },
788
+ {
789
+ "transform": "perspective(1400px) translateX(-6px) rotateY(0.4deg)",
790
+ "offset": 0.55
791
+ },
792
+ {
793
+ "transform": "perspective(1400px) translateX(0) rotateY(0)",
794
+ "offset": 1
795
+ }
796
+ ],
797
+ "use": "A view pushed onto a stack. It arrives from the inline-end edge, along the reading direction, so the movement says the stack went forward. Mirror it for a pop, and again for right-to-left.",
798
+ "reduced": "Apply the semantic state immediately; omit decorative movement.",
799
+ "material": "plastic",
800
+ "signature": "inertia",
801
+ "travelException": "A pushed view must cross its own width from outside the viewport.",
802
+ "spring": {
803
+ "stiffness": 452.3775,
804
+ "damping": 23.3961,
805
+ "mass": 1,
806
+ "dampingRatio": 0.55,
807
+ "platform": {
808
+ "swiftUI": {
809
+ "response": 0.2954,
810
+ "dampingFraction": 0.55
811
+ },
812
+ "compose": {
813
+ "dampingRatio": 0.55,
814
+ "stiffness": 452.3775
815
+ },
816
+ "web": {
817
+ "stiffness": 452.3775,
818
+ "damping": 23.3961,
819
+ "mass": 1
820
+ }
821
+ }
822
+ }
823
+ },
824
+ {
825
+ "id": "view-push-out",
826
+ "category": "Navigation",
827
+ "label": "Pushed view departure",
828
+ "duration": 700,
829
+ "engine": "GSAP",
830
+ "keyframes": [
831
+ {
832
+ "transform": "perspective(1400px) translateX(0) rotateY(0)",
833
+ "opacity": 1,
834
+ "offset": 0
835
+ },
836
+ {
837
+ "transform": "perspective(1400px) translateX(-28%) rotateY(2deg)",
838
+ "opacity": 0.55,
839
+ "offset": 1
840
+ }
841
+ ],
842
+ "use": "The view a push covered. It travels a fraction of the incoming view's distance and stays behind it, so the two read as one stack rather than two independent slides; it is still there, which is what makes the back gesture legible.",
843
+ "reduced": "Apply the semantic state immediately; omit decorative movement.",
844
+ "material": "plastic",
845
+ "signature": "inertia",
846
+ "travelException": "A covered view travels with the stack rather than within its own bounds.",
847
+ "spring": {
848
+ "stiffness": 452.3775,
849
+ "damping": 23.3961,
850
+ "mass": 1,
851
+ "dampingRatio": 0.55,
852
+ "platform": {
853
+ "swiftUI": {
854
+ "response": 0.2954,
855
+ "dampingFraction": 0.55
856
+ },
857
+ "compose": {
858
+ "dampingRatio": 0.55,
859
+ "stiffness": 452.3775
860
+ },
861
+ "web": {
862
+ "stiffness": 452.3775,
863
+ "damping": 23.3961,
864
+ "mass": 1
865
+ }
866
+ }
867
+ }
868
+ },
777
869
  {
778
870
  "id": "breadcrumb",
779
871
  "category": "Navigation",
@@ -2476,10 +2568,134 @@
2476
2568
  }
2477
2569
  }
2478
2570
  }
2571
+ },
2572
+ {
2573
+ "id": "activity-turn",
2574
+ "category": "Feedback",
2575
+ "label": "Indeterminate arc",
2576
+ "duration": 1200,
2577
+ "engine": "Motion",
2578
+ "loop": true,
2579
+ "direction": "normal",
2580
+ "easing": "linear",
2581
+ "keyframes": [
2582
+ {
2583
+ "transform": "rotate(0deg)",
2584
+ "offset": 0
2585
+ },
2586
+ {
2587
+ "transform": "rotate(360deg)",
2588
+ "offset": 1
2589
+ }
2590
+ ],
2591
+ "use": "A loader, or an indeterminate progress ring, while an operation is genuinely pending — and only then. Starts when the work starts and stops when it resolves. One period for every continuous indicator, so two in one view never tick against each other.",
2592
+ "reduced": "Static: the whole track visible and nothing turning. Never a partial arc, which reports a measurement nobody took.",
2593
+ "material": "stone",
2594
+ "signature": "feather"
2595
+ },
2596
+ {
2597
+ "id": "activity-travel",
2598
+ "category": "Feedback",
2599
+ "label": "Indeterminate bar",
2600
+ "duration": 1200,
2601
+ "engine": "Motion",
2602
+ "loop": true,
2603
+ "direction": "normal",
2604
+ "easing": "linear",
2605
+ "keyframes": [
2606
+ {
2607
+ "transform": "translateX(-100%)",
2608
+ "offset": 0
2609
+ },
2610
+ {
2611
+ "transform": "translateX(100%)",
2612
+ "offset": 1
2613
+ }
2614
+ ],
2615
+ "travelException": "A travelling segment crosses its own track, and the track is its bound; the travel is a fraction of the track rather than a distance on the page.",
2616
+ "use": "Indeterminate linear progress while an operation is genuinely pending, stopping when it resolves or becomes measurable.",
2617
+ "reduced": "Static: the whole track visible. A segment frozen part of the way along reports a measurement nobody took.",
2618
+ "material": "stone",
2619
+ "signature": "feather"
2620
+ },
2621
+ {
2622
+ "id": "skeleton-sweep",
2623
+ "category": "Content",
2624
+ "label": "Luminance sweep",
2625
+ "duration": 1200,
2626
+ "engine": "Motion",
2627
+ "loop": true,
2628
+ "direction": "normal",
2629
+ "easing": "linear",
2630
+ "keyframes": [
2631
+ {
2632
+ "backgroundPosition": "200% 0",
2633
+ "offset": 0
2634
+ },
2635
+ {
2636
+ "backgroundPosition": "-200% 0",
2637
+ "offset": 1
2638
+ }
2639
+ ],
2640
+ "use": "A skeleton while its content is genuinely loading, on the Haze fill and never on the text that replaces it. Ends with skeleton-resolve.",
2641
+ "reduced": "Static Haze fill.",
2642
+ "material": "haze",
2643
+ "signature": "feather"
2644
+ },
2645
+ {
2646
+ "id": "mark-in",
2647
+ "category": "Content",
2648
+ "label": "Mark arriving",
2649
+ "duration": 500,
2650
+ "engine": "Motion",
2651
+ "keyframes": [
2652
+ {
2653
+ "transform": "scaleY(0)",
2654
+ "opacity": 0,
2655
+ "offset": 0
2656
+ },
2657
+ {
2658
+ "transform": "scaleY(1)",
2659
+ "opacity": 1,
2660
+ "offset": 1
2661
+ }
2662
+ ],
2663
+ "overshoot": "never",
2664
+ "stagger": {
2665
+ "step": 24,
2666
+ "maxMarks": 24
2667
+ },
2668
+ "use": "A data mark — a bar, a series, a segment — growing from its baseline when a chart first appears, and not when its data later changes. transform-origin is the baseline. Staggered by index up to 24 marks; past that every mark arrives together, because a sequence nobody can count is decoration.",
2669
+ "reduced": "Marks appear in place at their values.",
2670
+ "material": "haze",
2671
+ "signature": "feather",
2672
+ "spring": {
2673
+ "stiffness": 644.657,
2674
+ "damping": 50.7802,
2675
+ "mass": 1,
2676
+ "dampingRatio": 1,
2677
+ "platform": {
2678
+ "swiftUI": {
2679
+ "response": 0.2475,
2680
+ "dampingFraction": 1
2681
+ },
2682
+ "compose": {
2683
+ "dampingRatio": 1,
2684
+ "stiffness": 644.657
2685
+ },
2686
+ "web": {
2687
+ "stiffness": 644.657,
2688
+ "damping": 50.7802,
2689
+ "mass": 1
2690
+ }
2691
+ }
2692
+ }
2479
2693
  }
2480
2694
  ],
2481
2695
  "travelPolicy": "5–30px ordinary, 50px guidance; justified large transitions may exceed it. Haze and Stone paint moves locally while text stays fixed.",
2482
2696
  "springPolicy": "Every recipe carries a spring fitted to its authored duration, which remains the authority. Damping ratio is chosen by signature: inertia and coalesce overshoot because momentum is their material claim, feather and caustic do not because a soft edge that bounces is wrong. Disabling springs must reproduce the keyframes exactly.",
2697
+ "continuousPolicy": "A continuous recipe is the one kind of motion that repeats, and it is not ambient: it reports work that is genuinely pending, runs only while that work is pending, and stops when it resolves. Nothing loops at rest. Every continuous recipe travels linearly at one period, motion.flow, so no two indicators in a view tick against each other, and none carries a spring, because a loop has no rest position to settle to. Reduced motion removes it and leaves the whole track or fill in place — never a partial segment, which would report a measurement nobody took.",
2698
+ "staggerPolicy": "A recipe that animates many marks at once may declare a stagger: a step between consecutive marks and a ceiling on how many are staggered. Past the ceiling every mark arrives together. The whole staggered sequence stays within the recipe's duration ceiling, and a recipe that shows data declares overshoot never and is critically damped — a mark that overshoots its value has shown a number that is not true.",
2483
2699
  "incompressibility": "Deformations conserve volume: every scale(sx, sy) satisfies sx*sy = 1 within 0.005. Corrected by dividing both axes by the square root of the area, which preserves each deformation's aspect ratio exactly and removes only the compressibility error. Enforced by tools/validate-motion.cjs.",
2484
2700
  "ambientPolicy": "Ambient motion is what a surface does at rest. It is a capability tier, not a default: a platform declares support, and a surface opts in. Two rules are absolute. Ambient runs on the rim and the fill and never on a surface the user is reading, for the same reason Resin lenses at its edge rather than rippling through its middle. And it is the first motion that prefers-reduced-motion removes — WCAG 2.2.2 requires that anything moving for more than five seconds can be stopped, and an ambient loop never stops on its own. Where a platform cannot honour it, ambient degrades to a static surface with no other change."
2485
2701
  }
@@ -0,0 +1,167 @@
1
+ {
2
+ "$description": "Crystal's surface vocabulary: the closed set of material compositions a component may be made of, and the crystal.css recipe that implements each. Every catalogue entry names one or more of these in its `surface` field. tools/build-catalogue.cjs refuses an entry naming a surface not listed here, and refuses a surface whose `class` does not exist in core/assets/crystal.css — so a component cannot be specified in a material Crystal has not published a recipe for.",
3
+ "$rule": "The vocabulary is small on purpose. A component that seems to need a new surface almost always needs one of these on a different element; a new entry here is a new material composition for every platform library, and is added with a recipe, a fallback for reduced transparency and forced colours, a contract row in docs/components.md and a changelog entry — never alone.",
4
+ "surfaces": [
5
+ {
6
+ "id": "plastic",
7
+ "name": "Plastic foundation",
8
+ "materials": ["Plastic"],
9
+ "class": ".cr-plastic",
10
+ "use": "The root scene or window. One contextual, opaque foundation per view; never a component."
11
+ },
12
+ {
13
+ "id": "frost",
14
+ "name": "Frost panel",
15
+ "materials": ["Frost"],
16
+ "class": ".cr-frost",
17
+ "use": "Intermediate task frames and every transient surface that opens over content: side panels, drawers, sheets, app bars, and — at Meridian's direction (R15e) — menus, popovers, tooltips and toasts. Reading content inside it sits on Haze."
18
+ },
19
+ {
20
+ "id": "haze",
21
+ "name": "Haze reading surface",
22
+ "materials": ["Haze"],
23
+ "class": ".cr-haze",
24
+ "use": "Anything read: cards, rows, panels, wells, forms, messages, decisions. 80% fill, 1.95px feather on an isolated paint layer, crisp foreground. `.cr-well` is the same recipe recessed into a Frost or Resin frame."
25
+ },
26
+ {
27
+ "id": "resin",
28
+ "name": "Resin plane",
29
+ "materials": ["Resin"],
30
+ "class": ".cr-resin",
31
+ "use": "One clustered navigation or control plane, pill-shaped: toolbars, action bars, shared button planes, segmented strips, the transport bar of a player. Controls inside it lose their own backdrop filter — Resin never contains Resin."
32
+ },
33
+ {
34
+ "id": "resin-panel",
35
+ "name": "Resin panel",
36
+ "materials": ["Resin"],
37
+ "class": ".cr-resin.panel",
38
+ "use": "The Resin plane with the content radius instead of the pill, for a floating control plane that is a rectangle: a floating window, a media control bar wider than it is tall. Same fill, rim, blur and float shadow; only the geometry changes."
39
+ },
40
+ {
41
+ "id": "control",
42
+ "name": "Resin control",
43
+ "materials": ["Resin", "Haze"],
44
+ "class": ".cr-button",
45
+ "also": [".cr-control", "button", "a.cr-button"],
46
+ "use": "An action: a Resin shell with the 8px-inset Haze reading pad and the optical sheen. Pill geometry. `.primary` tints the pad, `.quiet` removes it, `.danger` adds the destructive boundary. Selected state is the primary pad plus label weight 800."
47
+ },
48
+ {
49
+ "id": "field",
50
+ "name": "Field shell",
51
+ "materials": ["Resin", "Haze"],
52
+ "class": ".cr-field-shell",
53
+ "use": "The Resin surround of a native text entry, with the Haze well the value is read on and the circular field-state badge. The native control keeps its functional boundary and semantics."
54
+ },
55
+ {
56
+ "id": "compact",
57
+ "name": "Compact display",
58
+ "materials": ["Resin", "Haze"],
59
+ "class": ".cr-resin-haze",
60
+ "also": [".cr-tag"],
61
+ "use": "Small information displays that sit on content: tags, badges, labels, keyboard caps. A Resin shell with the inset Haze pad, 18px radius. Not for anything that opens — transient overlays are Frost."
62
+ },
63
+ {
64
+ "id": "stone",
65
+ "name": "Stone label backing",
66
+ "materials": ["Stone"],
67
+ "class": ".cr-stone",
68
+ "use": "A label over an unknown or moving backdrop — a caption on media, a status bar over a scene. 55% light / 60% dark fill, feathered like Haze, crisp text."
69
+ },
70
+ {
71
+ "id": "mirage",
72
+ "name": "Mirage scrim",
73
+ "materials": ["Mirage"],
74
+ "class": ".cr-mirage",
75
+ "also": [".cr-dialog::backdrop"],
76
+ "use": "The chromatic diffusion of the real scene behind a modal. Never a content surface; the decision surface above it is Haze."
77
+ },
78
+ {
79
+ "id": "dialog",
80
+ "name": "Dialog",
81
+ "materials": ["Haze", "Mirage"],
82
+ "class": ".cr-dialog",
83
+ "use": "A Haze decision surface over a Mirage scrim, with the float shadow. Modality, focus and dismissal are the product's."
84
+ },
85
+ {
86
+ "id": "indicator",
87
+ "name": "Indicator",
88
+ "materials": ["Haze"],
89
+ "class": ".cr-indicator",
90
+ "use": "A 20px informational circle painting Haze on an isolated layer, or the moving pill behind a selected segment. Haze rather than Resin, because it sits on a surface that is often already translucent. Never a selection mark."
91
+ },
92
+ {
93
+ "id": "status",
94
+ "name": "Status badge",
95
+ "materials": ["Resin", "Haze"],
96
+ "class": ".cr-status",
97
+ "use": "The semantic ink and surface pair behind a symbol, with words beside it. Status colours are independent of the palette and are never redefined by it."
98
+ },
99
+ {
100
+ "id": "bubble",
101
+ "name": "Authored bubble",
102
+ "materials": ["Haze"],
103
+ "class": ".cr-bubble",
104
+ "use": "A Haze message surface with a directional tight corner. `.own` uses the palette's own-content pair."
105
+ },
106
+ {
107
+ "id": "table",
108
+ "name": "Table",
109
+ "materials": ["Resin", "Haze"],
110
+ "class": ".cr-table-scroll",
111
+ "also": [".cr-table"],
112
+ "use": "A Resin shell with an inset Haze fill holding the table, with the primary-soft header and the Resin scrollbar. Rows are read on the Haze; sort and selection are announced, and selection is label weight."
113
+ },
114
+ {
115
+ "id": "dock",
116
+ "name": "Dock",
117
+ "materials": ["Resin", "Haze"],
118
+ "class": ".cr-dock",
119
+ "also": [".cr-dock-inner"],
120
+ "use": "The floating destination group: a Resin pill with a Haze perimeter, transparent destinations inside it, primary fill and weight 800 on the current one."
121
+ },
122
+ {
123
+ "id": "nav-item",
124
+ "name": "Navigation entry",
125
+ "materials": ["Plastic"],
126
+ "class": ".cr-nav-item",
127
+ "use": "An entry in side navigation, a rail or a tree of destinations. It has no material of its own — it is furniture on the panel beneath it — and carries selection by label weight alone. Pill hit area, 44px target. `.stacked` puts the icon above the label for a rail. Adopted from the documentation site's side menu, which docs/components.md names as the reference implementation of selection."
128
+ },
129
+ {
130
+ "id": "bare",
131
+ "name": "Bare control",
132
+ "materials": [],
133
+ "class": ".cr-bare",
134
+ "use": "A control that must not wear the Resin coat because it sits inside a surface that already has one: a disclosure chevron, a chip's remove button, a sort header, a stepper's arrows, a dismiss button on a toast. Crystal paints every button by element, so bare means subtracting the fill, the shadow, the backdrop filter and both pseudo-layers — this class does all four. The focus ring and the target floor stay."
135
+ },
136
+ {
137
+ "id": "drag-handle",
138
+ "name": "Drag handle",
139
+ "materials": [],
140
+ "class": ".cr-drag-handle",
141
+ "use": "A bare control with a grip glyph and a lift while dragging. Keyboard drag is the product's; the handle only says it can be grabbed and when it has been."
142
+ },
143
+ {
144
+ "id": "choice",
145
+ "name": "Selection control",
146
+ "materials": ["Resin"],
147
+ "class": "input:is([type=checkbox],[type=radio])",
148
+ "also": ["input[type=checkbox][role=switch]", "input[type=range]"],
149
+ "use": "Native checkbox, radio, switch and range, styled by element: a Resin box, circle or track with a contained mark, and the marked glass thumb. Semantics stay native."
150
+ },
151
+ {
152
+ "id": "native",
153
+ "name": "Native control furniture",
154
+ "materials": [],
155
+ "class": "select option",
156
+ "also": ["input[type=file]::file-selector-button"],
157
+ "use": "Parts of native controls the browser draws and Crystal tints: select options, the file button. Platform-owned popups keep platform drawing."
158
+ },
159
+ {
160
+ "id": "none",
161
+ "name": "No surface of its own",
162
+ "materials": [],
163
+ "class": null,
164
+ "use": "Layout, typography, behaviour and drawing components that inherit whatever they sit on. A chart's marks, a divider, a provider. Nothing to paint and nothing to wear."
165
+ }
166
+ ]
167
+ }