@zazz-ui/core 0.13.0 → 0.14.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 (84) hide show
  1. package/CHANGELOG.md +93 -0
  2. package/README.md +5 -9
  3. package/dist/sri.json +34 -30
  4. package/dist/zazz.css +1 -1
  5. package/dist/zazz.js +1 -1
  6. package/editor/zazz.css-data.json +173 -3
  7. package/editor/zazz.html-data.json +138 -0
  8. package/editor/zazz.language-data.json +313 -125
  9. package/editor/zazz.lint-data.json +1501 -1383
  10. package/package.json +1 -5
  11. package/src/base/_defaults.css +1 -1
  12. package/src/base/_reset.css +16 -2
  13. package/src/base/_variables.css +43 -31
  14. package/src/base/carousel-scroll.d.ts +161 -0
  15. package/src/base/carousel-scroll.d.ts.map +1 -0
  16. package/src/base/carousel-scroll.js +1035 -0
  17. package/src/base/carousel-scroll.ts +1227 -0
  18. package/src/base/carousel.d.ts +34 -0
  19. package/src/base/carousel.d.ts.map +1 -0
  20. package/src/base/carousel.js +279 -0
  21. package/src/base/carousel.ts +292 -0
  22. package/src/base/dialog-lifecycle.js +1 -1
  23. package/src/base/dialog-lifecycle.ts +1 -1
  24. package/src/base/gesture.d.ts +201 -0
  25. package/src/base/gesture.d.ts.map +1 -0
  26. package/src/base/gesture.js +317 -0
  27. package/src/base/gesture.ts +494 -0
  28. package/src/base/kit-styling.d.ts.map +1 -1
  29. package/src/base/kit-styling.js +182 -162
  30. package/src/base/kit-styling.ts +182 -162
  31. package/src/base/utils.d.ts +1 -1
  32. package/src/base/utils.js +2 -2
  33. package/src/base/utils.ts +2 -2
  34. package/src/globals.d.ts +7 -30
  35. package/src/head.d.ts.map +1 -1
  36. package/src/head.js +1 -25
  37. package/src/head.ts +1 -25
  38. package/src/index.css +1 -0
  39. package/src/index.d.ts +6 -5
  40. package/src/index.d.ts.map +1 -1
  41. package/src/index.js +6 -5
  42. package/src/index.ts +6 -5
  43. package/src/manifest.d.ts +1 -1
  44. package/src/manifest.d.ts.map +1 -1
  45. package/src/manifest.js +25 -13
  46. package/src/manifest.ts +26 -14
  47. package/src/primitives/button/button.css +1 -1
  48. package/src/primitives/carousel/carousel.css +103 -20
  49. package/src/primitives/carousel/carousel.d.ts +4 -32
  50. package/src/primitives/carousel/carousel.d.ts.map +1 -1
  51. package/src/primitives/carousel/carousel.js +39 -14
  52. package/src/primitives/carousel/carousel.ts +21 -25
  53. package/src/primitives/dialog/dialog.css +14 -8
  54. package/src/primitives/drawer/drawer-indent.html +27 -0
  55. package/src/primitives/drawer/drawer-nested.html +72 -0
  56. package/src/primitives/drawer/drawer-responsive-dialog.html +44 -0
  57. package/src/primitives/drawer/drawer-snap.html +26 -0
  58. package/src/primitives/drawer/drawer.css +528 -0
  59. package/src/primitives/drawer/drawer.d.ts +24 -0
  60. package/src/primitives/drawer/drawer.d.ts.map +1 -0
  61. package/src/primitives/drawer/drawer.html +42 -0
  62. package/src/primitives/drawer/drawer.js +765 -0
  63. package/src/primitives/drawer/drawer.ts +823 -0
  64. package/src/primitives/fields/fields.css +4 -2
  65. package/src/primitives/input/input.css +4 -3
  66. package/src/primitives/input-group/input-group.css +5 -5
  67. package/src/primitives/lightbox/lightbox.css +2 -2
  68. package/src/primitives/lightbox/lightbox.d.ts.map +1 -1
  69. package/src/primitives/lightbox/lightbox.js +9 -8
  70. package/src/primitives/lightbox/lightbox.ts +9 -8
  71. package/src/primitives/password-group/password-group.css +5 -5
  72. package/src/primitives/radio/radio.css +15 -10
  73. package/src/primitives/slider/slider.css +2 -2
  74. package/src/primitives/switch/switch.css +6 -6
  75. package/src/primitives/tabs/tabs.css +10 -10
  76. package/src/primitives/toaster/toaster.css +29 -1
  77. package/src/primitives/toaster/toaster.d.ts.map +1 -1
  78. package/src/primitives/toaster/toaster.js +117 -9
  79. package/src/primitives/toaster/toaster.ts +136 -9
  80. package/src/primitives/tooltip/tooltip.css +93 -10
  81. package/src/base/embla.d.ts +0 -90
  82. package/src/base/embla.d.ts.map +0 -1
  83. package/src/base/embla.js +0 -878
  84. package/src/base/embla.ts +0 -1066
package/src/head.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"head.d.ts","sourceRoot":"","sources":["head.ts"],"names":[],"mappings":"AA6BA,wDAAwD;AACxD,UAAU,aAAa;IACrB,0EAA0E;IAC1E,IAAI,EAAE,MAAM,CAAC;IACb,yEAAyE;IACzE,OAAO,EAAE,MAAM,CAAC;IAChB,yEAAyE;IACzE,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;AAwCD;;;;;;GAMG;AACH,iBAAS,MAAM,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAE1C;AAED;;;;;GAKG;AACH,QAAA,MAAM,gBAAgB,EAAE,SAAS,aAAa,EA+B7C,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,QAAA,MAAM,SAAS,EAAE,SAAS,aAAa,EAOtC,CAAC;AAuFF,iEAAiE;AACjE,MAAM,WAAW,cAAc;IAC7B,6EAA6E;IAC7E,OAAO,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB;;;;;OAKG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9B;AAED,+BAA+B;AAC/B,MAAM,WAAW,WAAW;IAC1B;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,8EAA8E;IAC9E,WAAW,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,KAAK,CAAC;IAC1C,kFAAkF;IAClF,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,UAAU,CAAC,EA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M,CAAC;IACpB,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,oCAAoC;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,WAAW,CAAC;IACrB,wCAAwC;IACxC,MAAM,EAAE,MAAM,CAAC;CAChB;AAKD,yEAAyE;AACzE,wBAAgB,UAAU,CAAC,OAAO,GAAE,WAAgB,GAAG,MAAM,CAI5D;AAED,+FAA+F;AAC/F,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAgBjE;AAcD;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,WAAW,GACpB;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAa1D;AAED,0FAA0F;AAC1F,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,MAAM,CAG1F"}
package/src/head.js CHANGED
@@ -78,30 +78,6 @@ const ESM_DEPENDENCIES = [
78
78
  file: "dist/index.js",
79
79
  integrity: "sha384-0OqM7OXGT6Oz1z98u/geiFn/FUyz4iWexkXHCvbIGXRRDXl6bp6IKc0j78AQ6DEK",
80
80
  },
81
- {
82
- name: "embla-carousel",
83
- version: "9.0.0-rc04",
84
- file: "esm/embla-carousel.esm.js",
85
- integrity: "sha384-Qcz5VJ/iRhG3zPRMT8li6rYNSsXcCeSQ6URxPlQh7joEd/nNxRRkCZxlJoTZr3Ch",
86
- },
87
- {
88
- name: "embla-carousel-autoplay",
89
- version: "9.0.0-rc04",
90
- file: "esm/embla-carousel-autoplay.esm.js",
91
- integrity: "sha384-dsPLKoLTpj/hIVD1I1zYA1kDCI32uRH4seU3ly+s7Lm9MdWVsj1OmE8HELhZ/Fm4",
92
- },
93
- {
94
- name: "embla-carousel-auto-scroll",
95
- version: "9.0.0-rc04",
96
- file: "esm/embla-carousel-auto-scroll.esm.js",
97
- integrity: "sha384-bOWyJNYHSsncAhdIgavN6TjY6Bb/NRLV9fAon5xy9HquiFZbNYTjq2JZ5bq5nyb5",
98
- },
99
- {
100
- name: "embla-carousel-class-names",
101
- version: "9.0.0-rc04",
102
- file: "esm/embla-carousel-class-names.esm.js",
103
- integrity: "sha384-y8wWJW7HPdqr5guB+ZdF/o9FIRGg2KtH9TdoAttP7jjEU9bQlAzY0Fc5FiIMYQN1",
104
- },
105
81
  ];
106
82
  /**
107
83
  * Feature polyfills loaded ahead of the kit module. Exactly one entry:
@@ -143,7 +119,7 @@ function fontsBlock(display) {
143
119
  }
144
120
  /**
145
121
  * @description Renders the import map that resolves the kit's bare specifiers
146
- * (`signal-polyfill`, `embla-carousel`, …) to pinned jsDelivr URLs, with an
122
+ * (`signal-polyfill`) to pinned jsDelivr URLs, with an
147
123
  * `integrity` section covering every mapped file.
148
124
  *
149
125
  * @returns The import-map script tag.
package/src/head.ts CHANGED
@@ -104,30 +104,6 @@ const ESM_DEPENDENCIES: readonly CdnDependency[] = [
104
104
  file: "dist/index.js",
105
105
  integrity: "sha384-0OqM7OXGT6Oz1z98u/geiFn/FUyz4iWexkXHCvbIGXRRDXl6bp6IKc0j78AQ6DEK",
106
106
  },
107
- {
108
- name: "embla-carousel",
109
- version: "9.0.0-rc04",
110
- file: "esm/embla-carousel.esm.js",
111
- integrity: "sha384-Qcz5VJ/iRhG3zPRMT8li6rYNSsXcCeSQ6URxPlQh7joEd/nNxRRkCZxlJoTZr3Ch",
112
- },
113
- {
114
- name: "embla-carousel-autoplay",
115
- version: "9.0.0-rc04",
116
- file: "esm/embla-carousel-autoplay.esm.js",
117
- integrity: "sha384-dsPLKoLTpj/hIVD1I1zYA1kDCI32uRH4seU3ly+s7Lm9MdWVsj1OmE8HELhZ/Fm4",
118
- },
119
- {
120
- name: "embla-carousel-auto-scroll",
121
- version: "9.0.0-rc04",
122
- file: "esm/embla-carousel-auto-scroll.esm.js",
123
- integrity: "sha384-bOWyJNYHSsncAhdIgavN6TjY6Bb/NRLV9fAon5xy9HquiFZbNYTjq2JZ5bq5nyb5",
124
- },
125
- {
126
- name: "embla-carousel-class-names",
127
- version: "9.0.0-rc04",
128
- file: "esm/embla-carousel-class-names.esm.js",
129
- integrity: "sha384-y8wWJW7HPdqr5guB+ZdF/o9FIRGg2KtH9TdoAttP7jjEU9bQlAzY0Fc5FiIMYQN1",
130
- },
131
107
  ];
132
108
 
133
109
  /**
@@ -173,7 +149,7 @@ function fontsBlock(display: "swap" | "optional"): string {
173
149
 
174
150
  /**
175
151
  * @description Renders the import map that resolves the kit's bare specifiers
176
- * (`signal-polyfill`, `embla-carousel`, …) to pinned jsDelivr URLs, with an
152
+ * (`signal-polyfill`) to pinned jsDelivr URLs, with an
177
153
  * `integrity` section covering every mapped file.
178
154
  *
179
155
  * @returns The import-map script tag.
package/src/index.css CHANGED
@@ -53,6 +53,7 @@
53
53
  @import "./primitives/tooltip/tooltip.css";
54
54
  @import "./primitives/dialog/dialog.css";
55
55
  @import "./primitives/alert-dialog/alert-dialog.css";
56
+ @import "./primitives/drawer/drawer.css";
56
57
  @import "./primitives/menu/menu.css";
57
58
  @import "./primitives/navigation-menu/navigation-menu.css";
58
59
  @import "./primitives/mobile-menu/mobile-menu.css";
package/src/index.d.ts CHANGED
@@ -3,28 +3,29 @@
3
3
  * @description Imports all Zazz behavior modules so a page needs only one
4
4
  * `<script type="module" src=".../index.js">` instead of ten separate tags.
5
5
  * Each module runs for its side effects: global/utility setup, scroll-reveal
6
- * and carousel auto-initialization, SPA navigation, and the custom-element
6
+ * and carousel auto-initialization, drawer dragging, SPA navigation, and the custom-element
7
7
  * registrations (`<ui-autocomplete>`, `<ui-carousel>`, `<ui-combobox>`,
8
8
  * `<ui-command>`, `<ui-lightbox>`, `<ui-menu>`, `<ui-password>`, `<ui-tabs>`,
9
- * `<ui-toaster>`).
9
+ * `<ui-toaster>`), plus the `<ui-drawer-indent>` wrapper the drawer script finds by selector.
10
10
  *
11
11
  * Internal dependencies are resolved by the module graph — utils loads
12
- * before embla, embla before carousel, carousel before lightbox — so the
12
+ * before carousel, carousel before lightbox — so the
13
13
  * import order below is for readability, not correctness.
14
14
  *
15
- * External dependencies (signal-polyfill, the Embla packages) are imported by
15
+ * The one external dependency (signal-polyfill) is imported by
16
16
  * bare specifier and resolved by the page's import map — generated by
17
17
  * `head.ts` with pinned, SRI-checked jsDelivr URLs. No extra script tags.
18
18
  */
19
19
  import "./base/utils.ts";
20
20
  import "./base/reveal.ts";
21
21
  import "./base/dialog-lifecycle.ts";
22
- import "./base/embla.ts";
22
+ import "./base/carousel.ts";
23
23
  import "./primitives/autocomplete/autocomplete.ts";
24
24
  import "./primitives/checkbox/checkbox.ts";
25
25
  import "./primitives/combobox/combobox.ts";
26
26
  import "./primitives/command/command.ts";
27
27
  import "./primitives/carousel/carousel.ts";
28
+ import "./primitives/drawer/drawer.ts";
28
29
  import "./primitives/lightbox/lightbox.ts";
29
30
  import "./primitives/menu/menu.ts";
30
31
  import "./primitives/otp/otp.ts";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,iBAAiB,CAAC;AACzB,OAAO,kBAAkB,CAAC;AAC1B,OAAO,4BAA4B,CAAC;AACpC,OAAO,iBAAiB,CAAC;AACzB,OAAO,2CAA2C,CAAC;AACnD,OAAO,mCAAmC,CAAC;AAC3C,OAAO,mCAAmC,CAAC;AAC3C,OAAO,iCAAiC,CAAC;AACzC,OAAO,mCAAmC,CAAC;AAC3C,OAAO,mCAAmC,CAAC;AAC3C,OAAO,2BAA2B,CAAC;AACnC,OAAO,yBAAyB,CAAC;AACjC,OAAO,+CAA+C,CAAC;AACvD,OAAO,oCAAoC,CAAC;AAC5C,OAAO,2BAA2B,CAAC;AACnC,OAAO,iCAAiC,CAAC;AACzC,OAAO,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,iBAAiB,CAAC;AACzB,OAAO,kBAAkB,CAAC;AAC1B,OAAO,4BAA4B,CAAC;AACpC,OAAO,oBAAoB,CAAC;AAC5B,OAAO,2CAA2C,CAAC;AACnD,OAAO,mCAAmC,CAAC;AAC3C,OAAO,mCAAmC,CAAC;AAC3C,OAAO,iCAAiC,CAAC;AACzC,OAAO,mCAAmC,CAAC;AAC3C,OAAO,+BAA+B,CAAC;AACvC,OAAO,mCAAmC,CAAC;AAC3C,OAAO,2BAA2B,CAAC;AACnC,OAAO,yBAAyB,CAAC;AACjC,OAAO,+CAA+C,CAAC;AACvD,OAAO,oCAAoC,CAAC;AAC5C,OAAO,2BAA2B,CAAC;AACnC,OAAO,iCAAiC,CAAC;AACzC,OAAO,sBAAsB,CAAC"}
package/src/index.js CHANGED
@@ -3,28 +3,29 @@
3
3
  * @description Imports all Zazz behavior modules so a page needs only one
4
4
  * `<script type="module" src=".../index.js">` instead of ten separate tags.
5
5
  * Each module runs for its side effects: global/utility setup, scroll-reveal
6
- * and carousel auto-initialization, SPA navigation, and the custom-element
6
+ * and carousel auto-initialization, drawer dragging, SPA navigation, and the custom-element
7
7
  * registrations (`<ui-autocomplete>`, `<ui-carousel>`, `<ui-combobox>`,
8
8
  * `<ui-command>`, `<ui-lightbox>`, `<ui-menu>`, `<ui-password>`, `<ui-tabs>`,
9
- * `<ui-toaster>`).
9
+ * `<ui-toaster>`), plus the `<ui-drawer-indent>` wrapper the drawer script finds by selector.
10
10
  *
11
11
  * Internal dependencies are resolved by the module graph — utils loads
12
- * before embla, embla before carousel, carousel before lightbox — so the
12
+ * before carousel, carousel before lightbox — so the
13
13
  * import order below is for readability, not correctness.
14
14
  *
15
- * External dependencies (signal-polyfill, the Embla packages) are imported by
15
+ * The one external dependency (signal-polyfill) is imported by
16
16
  * bare specifier and resolved by the page's import map — generated by
17
17
  * `head.ts` with pinned, SRI-checked jsDelivr URLs. No extra script tags.
18
18
  */
19
19
  import "./base/utils.js";
20
20
  import "./base/reveal.js";
21
21
  import "./base/dialog-lifecycle.js";
22
- import "./base/embla.js";
22
+ import "./base/carousel.js";
23
23
  import "./primitives/autocomplete/autocomplete.js";
24
24
  import "./primitives/checkbox/checkbox.js";
25
25
  import "./primitives/combobox/combobox.js";
26
26
  import "./primitives/command/command.js";
27
27
  import "./primitives/carousel/carousel.js";
28
+ import "./primitives/drawer/drawer.js";
28
29
  import "./primitives/lightbox/lightbox.js";
29
30
  import "./primitives/menu/menu.js";
30
31
  import "./primitives/otp/otp.js";
package/src/index.ts CHANGED
@@ -3,16 +3,16 @@
3
3
  * @description Imports all Zazz behavior modules so a page needs only one
4
4
  * `<script type="module" src=".../index.js">` instead of ten separate tags.
5
5
  * Each module runs for its side effects: global/utility setup, scroll-reveal
6
- * and carousel auto-initialization, SPA navigation, and the custom-element
6
+ * and carousel auto-initialization, drawer dragging, SPA navigation, and the custom-element
7
7
  * registrations (`<ui-autocomplete>`, `<ui-carousel>`, `<ui-combobox>`,
8
8
  * `<ui-command>`, `<ui-lightbox>`, `<ui-menu>`, `<ui-password>`, `<ui-tabs>`,
9
- * `<ui-toaster>`).
9
+ * `<ui-toaster>`), plus the `<ui-drawer-indent>` wrapper the drawer script finds by selector.
10
10
  *
11
11
  * Internal dependencies are resolved by the module graph — utils loads
12
- * before embla, embla before carousel, carousel before lightbox — so the
12
+ * before carousel, carousel before lightbox — so the
13
13
  * import order below is for readability, not correctness.
14
14
  *
15
- * External dependencies (signal-polyfill, the Embla packages) are imported by
15
+ * The one external dependency (signal-polyfill) is imported by
16
16
  * bare specifier and resolved by the page's import map — generated by
17
17
  * `head.ts` with pinned, SRI-checked jsDelivr URLs. No extra script tags.
18
18
  */
@@ -20,12 +20,13 @@
20
20
  import "./base/utils.ts";
21
21
  import "./base/reveal.ts";
22
22
  import "./base/dialog-lifecycle.ts";
23
- import "./base/embla.ts";
23
+ import "./base/carousel.ts";
24
24
  import "./primitives/autocomplete/autocomplete.ts";
25
25
  import "./primitives/checkbox/checkbox.ts";
26
26
  import "./primitives/combobox/combobox.ts";
27
27
  import "./primitives/command/command.ts";
28
28
  import "./primitives/carousel/carousel.ts";
29
+ import "./primitives/drawer/drawer.ts";
29
30
  import "./primitives/lightbox/lightbox.ts";
30
31
  import "./primitives/menu/menu.ts";
31
32
  import "./primitives/otp/otp.ts";
package/src/manifest.d.ts CHANGED
@@ -127,7 +127,7 @@ export declare const CSS_CASCADE_ORDER: string[];
127
127
  * // ["fields", "badge", "kbd", "button", "popover", "select", "combobox"]
128
128
  */
129
129
  export declare function resolveClosure(names: string[]): string[];
130
- export type ExampleScript = "autocomplete" | "combobox" | "command" | "command-actions" | "embla" | "reveal" | "carousel" | "checkbox" | "lightbox" | "menu" | "multiselect" | "otp" | "password" | "tabs" | "toaster";
130
+ export type ExampleScript = "autocomplete" | "combobox" | "command" | "command-actions" | "drawer" | "reveal" | "carousel" | "checkbox" | "lightbox" | "menu" | "multiselect" | "otp" | "password" | "tabs" | "toaster";
131
131
  /**
132
132
  * Emitted script files (relative to the package `src/` root) that implement each
133
133
  * web-component script id. This is the single mapping from script ids to files
@@ -1 +1 @@
1
- {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["manifest.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;GAiBG;AAIH;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAIlC,yEAAyE;AACzE,MAAM,WAAW,cAAc;IAC7B,6EAA6E;IAC7E,GAAG,EAAE,MAAM,EAAE,CAAC;IACd,qDAAqD;IACrD,EAAE,EAAE,MAAM,EAAE,CAAC;IACb;;;;OAIG;IACH,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,0EAA0E;IAC1E,UAAU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E,MAAM,CAAC;IACb,iFAAiF;IACjF,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;CAC7C;AAED;;;;;GAKG;AACH,eAAO,MAAM,cAAc,EAAE,eAAe,EAE3C,CAAC;AAEF,yGAAyG;AACzG,MAAM,WAAW,eAAe;IAC9B,mCAAmC;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,6DAA6D;IAC7D,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB;;;;OAIG;IACH,IAAI,EAAE,uBAAuB,CAAC;CAC/B;AAED;;;;GAIG;AACH,eAAO,MAAM,cAAc,EAAE,eAAe,EAE3C,CAAC;AAEF,yHAAyH;AACzH,eAAO,MAAM,SAAS,EAAE,MAAM,EAErB,CAAC;AAEV,eAAO,MAAM,iBAAiB,EAAE,MAAM,EA4CrC,CAAC;AAIF;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAoBxD;AAID,MAAM,MAAM,aAAa,GACrB,cAAc,GACd,UAAU,GACV,SAAS,GACT,iBAAiB,GACjB,QAAQ,GACR,QAAQ,GACR,UAAU,GACV,UAAU,GACV,UAAU,GACV,MAAM,GACN,aAAa,GACb,KAAK,GACL,UAAU,GACV,MAAM,GACN,SAAS,CAAC;AAEd;;;;;;;;GAQG;AACH,eAAO,MAAM,0BAA0B,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,MAAM,EAAE,CAAC,CAoC/E,CAAC"}
package/src/manifest.js CHANGED
@@ -26,13 +26,8 @@
26
26
  export const MANIFEST_VERSION = 2;
27
27
  /** Bare specifiers pulled in by `base/signals.ts` (core runtime). */
28
28
  const SIGNALS_BARE = ["signal-polyfill"];
29
- /** Bare specifiers pulled in by `base/embla.ts`. */
30
- const EMBLA_BARE = [
31
- "embla-carousel",
32
- "embla-carousel-autoplay",
33
- "embla-carousel-auto-scroll",
34
- "embla-carousel-class-names",
35
- ];
29
+ /** The carousel stack: the gesture layer, the scroll-snap engine, and the page wiring. */
30
+ const CAROUSEL_BASE = ["base/gesture.js", "base/carousel-scroll.js", "base/carousel.js"];
36
31
  /** The typeahead engine stack shared by autocomplete, combobox, and command. */
37
32
  const TYPEAHEAD_BASE = ["base/command-score.js", "base/hotkeys.js", "base/typeahead.js"];
38
33
  /**
@@ -147,9 +142,9 @@ export const PRIMITIVES = {
147
142
  tags: ["ui-carousel"],
148
143
  css: ["primitives/carousel/carousel.css"],
149
144
  js: ["primitives/carousel/carousel.js"],
150
- base: ["base/embla.js"],
145
+ base: CAROUSEL_BASE,
151
146
  primitives: [],
152
- bare: EMBLA_BARE,
147
+ bare: [],
153
148
  examples: ["primitives/carousel/carousel.html"],
154
149
  },
155
150
  checkbox: {
@@ -201,6 +196,21 @@ export const PRIMITIVES = {
201
196
  bare: [],
202
197
  examples: ["primitives/dialog/dialog.html", "primitives/dialog/dialog-with-form.html"],
203
198
  },
199
+ drawer: {
200
+ css: ["primitives/drawer/drawer.css"],
201
+ js: ["primitives/drawer/drawer.js"],
202
+ base: ["base/gesture.js"],
203
+ primitives: ["dialog", "button"],
204
+ bare: [],
205
+ tags: ["ui-drawer-indent"],
206
+ examples: [
207
+ "primitives/drawer/drawer.html",
208
+ "primitives/drawer/drawer-responsive-dialog.html",
209
+ "primitives/drawer/drawer-snap.html",
210
+ "primitives/drawer/drawer-nested.html",
211
+ "primitives/drawer/drawer-indent.html",
212
+ ],
213
+ },
204
214
  fields: {
205
215
  css: ["primitives/fields/fields.css"],
206
216
  js: [],
@@ -263,9 +273,9 @@ export const PRIMITIVES = {
263
273
  tags: ["ui-lightbox"],
264
274
  css: ["primitives/lightbox/lightbox.css"],
265
275
  js: ["primitives/lightbox/lightbox.js"],
266
- base: ["base/embla.js"],
276
+ base: CAROUSEL_BASE,
267
277
  primitives: ["dialog", "carousel", "button"],
268
- bare: EMBLA_BARE,
278
+ bare: [],
269
279
  examples: ["primitives/lightbox/lightbox.html"],
270
280
  },
271
281
  menu: {
@@ -465,7 +475,7 @@ export const PRIMITIVES = {
465
475
  tags: ["ui-toaster"],
466
476
  css: ["primitives/toaster/toaster.css"],
467
477
  js: ["primitives/toaster/toaster.js"],
468
- base: [],
478
+ base: ["base/gesture.js"],
469
479
  primitives: ["popover", "button"],
470
480
  bare: SIGNALS_BARE,
471
481
  examples: ["primitives/toaster/toaster.html"],
@@ -684,6 +694,7 @@ export const CSS_CASCADE_ORDER = [
684
694
  "tooltip",
685
695
  "dialog",
686
696
  "alert-dialog",
697
+ "drawer",
687
698
  "menu",
688
699
  "navigation-menu",
689
700
  "mobile-menu",
@@ -784,11 +795,12 @@ export const WEB_COMPONENT_SCRIPT_FILES = {
784
795
  ],
785
796
  carousel: ["primitives/carousel/carousel.js"],
786
797
  checkbox: ["primitives/checkbox/checkbox.js"],
798
+ drawer: ["base/gesture.js", "primitives/drawer/drawer.js"],
787
799
  lightbox: ["primitives/carousel/carousel.js", "primitives/lightbox/lightbox.js"],
788
800
  menu: ["primitives/menu/menu.js"],
789
801
  multiselect: ["primitives/select/multiselect.js"],
790
802
  otp: ["primitives/otp/otp.js"],
791
803
  password: ["primitives/password-group/password-group.js"],
792
804
  tabs: ["primitives/tabs/tabs.js"],
793
- toaster: ["primitives/toaster/toaster.js"],
805
+ toaster: ["base/gesture.js", "primitives/toaster/toaster.js"],
794
806
  };
package/src/manifest.ts CHANGED
@@ -60,13 +60,8 @@ export interface PrimitiveEntry {
60
60
  /** Bare specifiers pulled in by `base/signals.ts` (core runtime). */
61
61
  const SIGNALS_BARE = ["signal-polyfill"];
62
62
 
63
- /** Bare specifiers pulled in by `base/embla.ts`. */
64
- const EMBLA_BARE = [
65
- "embla-carousel",
66
- "embla-carousel-autoplay",
67
- "embla-carousel-auto-scroll",
68
- "embla-carousel-class-names",
69
- ];
63
+ /** The carousel stack: the gesture layer, the scroll-snap engine, and the page wiring. */
64
+ const CAROUSEL_BASE = ["base/gesture.js", "base/carousel-scroll.js", "base/carousel.js"];
70
65
 
71
66
  /** The typeahead engine stack shared by autocomplete, combobox, and command. */
72
67
  const TYPEAHEAD_BASE = ["base/command-score.js", "base/hotkeys.js", "base/typeahead.js"];
@@ -183,9 +178,9 @@ export const PRIMITIVES: Record<string, PrimitiveEntry> = {
183
178
  tags: ["ui-carousel"],
184
179
  css: ["primitives/carousel/carousel.css"],
185
180
  js: ["primitives/carousel/carousel.js"],
186
- base: ["base/embla.js"],
181
+ base: CAROUSEL_BASE,
187
182
  primitives: [],
188
- bare: EMBLA_BARE,
183
+ bare: [],
189
184
  examples: ["primitives/carousel/carousel.html"],
190
185
  },
191
186
  checkbox: {
@@ -237,6 +232,21 @@ export const PRIMITIVES: Record<string, PrimitiveEntry> = {
237
232
  bare: [],
238
233
  examples: ["primitives/dialog/dialog.html", "primitives/dialog/dialog-with-form.html"],
239
234
  },
235
+ drawer: {
236
+ css: ["primitives/drawer/drawer.css"],
237
+ js: ["primitives/drawer/drawer.js"],
238
+ base: ["base/gesture.js"],
239
+ primitives: ["dialog", "button"],
240
+ bare: [],
241
+ tags: ["ui-drawer-indent"],
242
+ examples: [
243
+ "primitives/drawer/drawer.html",
244
+ "primitives/drawer/drawer-responsive-dialog.html",
245
+ "primitives/drawer/drawer-snap.html",
246
+ "primitives/drawer/drawer-nested.html",
247
+ "primitives/drawer/drawer-indent.html",
248
+ ],
249
+ },
240
250
  fields: {
241
251
  css: ["primitives/fields/fields.css"],
242
252
  js: [],
@@ -299,9 +309,9 @@ export const PRIMITIVES: Record<string, PrimitiveEntry> = {
299
309
  tags: ["ui-lightbox"],
300
310
  css: ["primitives/lightbox/lightbox.css"],
301
311
  js: ["primitives/lightbox/lightbox.js"],
302
- base: ["base/embla.js"],
312
+ base: CAROUSEL_BASE,
303
313
  primitives: ["dialog", "carousel", "button"],
304
- bare: EMBLA_BARE,
314
+ bare: [],
305
315
  examples: ["primitives/lightbox/lightbox.html"],
306
316
  },
307
317
  menu: {
@@ -501,7 +511,7 @@ export const PRIMITIVES: Record<string, PrimitiveEntry> = {
501
511
  tags: ["ui-toaster"],
502
512
  css: ["primitives/toaster/toaster.css"],
503
513
  js: ["primitives/toaster/toaster.js"],
504
- base: [],
514
+ base: ["base/gesture.js"],
505
515
  primitives: ["popover", "button"],
506
516
  bare: SIGNALS_BARE,
507
517
  examples: ["primitives/toaster/toaster.html"],
@@ -750,6 +760,7 @@ export const CSS_CASCADE_ORDER: string[] = [
750
760
  "tooltip",
751
761
  "dialog",
752
762
  "alert-dialog",
763
+ "drawer",
753
764
  "menu",
754
765
  "navigation-menu",
755
766
  "mobile-menu",
@@ -817,7 +828,7 @@ export type ExampleScript =
817
828
  | "combobox"
818
829
  | "command"
819
830
  | "command-actions"
820
- | "embla"
831
+ | "drawer"
821
832
  | "reveal"
822
833
  | "carousel"
823
834
  | "checkbox"
@@ -866,11 +877,12 @@ export const WEB_COMPONENT_SCRIPT_FILES: Partial<Record<ExampleScript, string[]>
866
877
  ],
867
878
  carousel: ["primitives/carousel/carousel.js"],
868
879
  checkbox: ["primitives/checkbox/checkbox.js"],
880
+ drawer: ["base/gesture.js", "primitives/drawer/drawer.js"],
869
881
  lightbox: ["primitives/carousel/carousel.js", "primitives/lightbox/lightbox.js"],
870
882
  menu: ["primitives/menu/menu.js"],
871
883
  multiselect: ["primitives/select/multiselect.js"],
872
884
  otp: ["primitives/otp/otp.js"],
873
885
  password: ["primitives/password-group/password-group.js"],
874
886
  tabs: ["primitives/tabs/tabs.js"],
875
- toaster: ["primitives/toaster/toaster.js"],
887
+ toaster: ["base/gesture.js", "primitives/toaster/toaster.js"],
876
888
  };
@@ -59,7 +59,7 @@
59
59
  --ui-button-min-h: var(--ui-field-h);
60
60
  --ui-button-radius: var(--ui-field-radius);
61
61
  --ui-button-corner-shape: var(--ui-field-corner-shape);
62
- --ui-button-background-clip: padding-box;
62
+ --ui-button-background-clip: border-box;
63
63
 
64
64
  --ui-button-icon-size: var(--ui-field-icon-size);
65
65
 
@@ -1,10 +1,10 @@
1
1
  /**
2
- * carousel.css — Embla carousel (ui-carousel | [data-ui~="carousel"] + data-carousel-slot="carousel-*" hooks)
2
+ * carousel.css — scroll-snap carousel (ui-carousel | [data-ui~="carousel"] + data-carousel-slot hooks)
3
3
  *
4
4
  * @layer variables, components
5
5
  * @requires _layers.css, _variables.css
6
- * @uses data-carousel attributes — layout hooks only; behavior from base/embla.js (Embla v9)
7
- * @uses data-ui-dragging on :root — written by embla.js while a slide drags; the grabbing cursor page-wide
6
+ * @uses data-carousel attributes — the viewport is a native scroll-snap container; base/carousel.js adds mouse drag, loop, controls, and state
7
+ * @uses data-carousel-state on the viewport — free | gliding | settling | jumping | dragging, written by base/carousel-scroll.js
8
8
  * @uses container-type on viewport — basis-* / @sm:basis-* utils query [data-carousel-slot~="viewport"] width
9
9
  * @tokens --ui-carousel-* (@layer variables)
10
10
  * @consumedby lightbox.css
@@ -16,8 +16,12 @@
16
16
  --ui-carousel-gap: 0px;
17
17
  --ui-carousel-slide-basis: calc(100% - var(--ui-carousel-gap));
18
18
  --ui-carousel-slide-min-w: 0;
19
- --ui-carousel-touch-action: pan-y pinch-zoom;
20
19
  --ui-carousel-cursor--grabbing: grabbing;
20
+ /* where slides rest (data-carousel-align sets it), and the rubber band's
21
+ return after a mouse drag past an end (0s under reduced motion) */
22
+ --ui-carousel-snap-align: start;
23
+ --ui-carousel-settle-duration: calc(var(--default-transition-duration) * 2);
24
+ --ui-carousel-settle-ease: var(--default-transition-timing-function);
21
25
  }
22
26
  }
23
27
 
@@ -27,25 +31,76 @@
27
31
  display: block;
28
32
  }
29
33
 
30
- /* The grabbing cursor holds page-wide while a slide drags, since the pointer
31
- leaves the viewport mid-drag. embla.js flags the root; a `body:has(…) *`
32
- rule here made every DOM insertion restyle the whole page. */
33
- :where(ui-carousel, [data-ui~="carousel"])
34
- [data-carousel-slot~="viewport"][data-carousel-state~="dragging"],
35
- :root[data-ui-dragging],
36
- :root[data-ui-dragging] * {
37
- cursor: var(--ui-carousel-cursor--grabbing);
38
- }
39
-
40
34
  :where(ui-carousel, [data-ui~="carousel"]) {
41
35
  position: relative;
42
36
  isolation: isolate;
43
37
  }
44
38
 
39
+ /* The viewport is a real scroll container: touch, wheel, trackpad, and keys
40
+ scroll it natively, and it still scrolls with no script at all. RTL needs
41
+ nothing here: the track follows the inherited direction. */
45
42
  :where(ui-carousel, [data-ui~="carousel"]) [data-carousel-slot~="viewport"] {
46
- overflow: clip;
47
43
  max-block-size: 100%;
48
44
  max-inline-size: 100%;
45
+ overflow-x: auto;
46
+ overflow-y: hidden;
47
+ overscroll-behavior-x: contain;
48
+ scroll-snap-type: var(--_snap-axis, x) mandatory;
49
+ scrollbar-width: none;
50
+ }
51
+
52
+ /* vertical: data-carousel-axis="y" on the root (data-carousel-thumbs-axis="y"
53
+ on a thumbs slot). Give the viewport a block size; slides fill it by basis. */
54
+ :where(ui-carousel, [data-ui~="carousel"])
55
+ :is(
56
+ [data-carousel-axis="y"]
57
+ [data-carousel-slot~="viewport"]:not([data-carousel-slot~="thumbs"] *),
58
+ [data-carousel-thumbs-axis="y"] [data-carousel-slot~="viewport"]
59
+ ) {
60
+ --_snap-axis: y;
61
+ overflow-x: hidden;
62
+ overflow-y: auto;
63
+ overscroll-behavior-x: auto;
64
+ overscroll-behavior-y: contain;
65
+ }
66
+
67
+ /* free: drag-free (thumb strips by default), no snapping at all.
68
+ gliding: a mouse drag, its release scroll, or auto-scroll; snapping off
69
+ until it lands. settling: a loop rotation's compensating scroll, with the
70
+ axis locked too (iOS Safari otherwise paints the reordered frame before
71
+ the scroll lands). */
72
+ :where(ui-carousel, [data-ui~="carousel"])
73
+ [data-carousel-slot~="viewport"]:is(
74
+ [data-carousel-state~="free"],
75
+ [data-carousel-state~="gliding"],
76
+ [data-carousel-state~="settling"]
77
+ ) {
78
+ scroll-snap-type: none;
79
+ scroll-behavior: auto;
80
+ }
81
+
82
+ /* jumping: an instant scroll the script makes (start position, dialog start) */
83
+ :where(ui-carousel, [data-ui~="carousel"])
84
+ [data-carousel-slot~="viewport"][data-carousel-state~="jumping"] {
85
+ scroll-behavior: auto;
86
+ }
87
+
88
+ :where(ui-carousel, [data-ui~="carousel"])
89
+ [data-carousel-slot~="viewport"][data-carousel-state~="settling"] {
90
+ overflow: hidden;
91
+ }
92
+
93
+ /* a mouse drag would otherwise select the slides' text before the slop */
94
+ :where(ui-carousel, [data-ui~="carousel"]):not([data-carousel-draggable="false"])
95
+ [data-carousel-slot~="viewport"] {
96
+ user-select: none;
97
+ }
98
+
99
+ /* The pointer is captured for the whole drag, so this one rule keeps the
100
+ grabbing cursor wherever the pointer goes; no page-wide flag. */
101
+ :where(ui-carousel, [data-ui~="carousel"])
102
+ [data-carousel-slot~="viewport"][data-carousel-state~="dragging"] {
103
+ cursor: var(--ui-carousel-cursor--grabbing);
49
104
  }
50
105
 
51
106
  :where(ui-carousel, [data-ui~="carousel"]) [data-carousel-slot~="container"] {
@@ -53,16 +108,30 @@
53
108
  --_gap-len: var(--_gap-resolved, var(--ui-carousel-gap));
54
109
  --_gap-num: var(--_gap-resolved, var(--ui-carousel-gap));
55
110
  gap: calc(var(--_gap-len) + var(--_gap-num) * var(--spacing));
56
- touch-action: var(--ui-carousel-touch-action);
111
+ /* the rubber band past an end, springing back on release */
112
+ transition: translate var(--ui-carousel-settle-duration) var(--ui-carousel-settle-ease);
113
+ }
114
+
115
+ :where(ui-carousel, [data-ui~="carousel"])
116
+ [data-carousel-state~="dragging"]
117
+ > [data-carousel-slot~="container"] {
118
+ transition: none;
119
+ }
120
+
121
+ :where(ui-carousel, [data-ui~="carousel"])
122
+ :is(
123
+ [data-carousel-axis="y"]
124
+ [data-carousel-slot~="container"]:not([data-carousel-slot~="thumbs"] *),
125
+ [data-carousel-thumbs-axis="y"] [data-carousel-slot~="container"]
126
+ ) {
127
+ flex-direction: column;
128
+ block-size: 100%;
57
129
  }
58
130
 
59
131
  :where(ui-carousel, [data-ui~="carousel"]) [data-carousel-slot~="slide"] {
60
132
  flex: 0 0 var(--ui-carousel-slide-basis);
61
133
  min-inline-size: var(--ui-carousel-slide-min-w);
62
- /* Embla moves the container with transform, and with loop on also the slides
63
- it wraps; a transition on a slide (a link's default, say) sweeps it across
64
- the viewport. Animate a slide's child. */
65
- transition: none;
134
+ scroll-snap-align: var(--ui-carousel-snap-align);
66
135
  }
67
136
 
68
137
  :where(ui-carousel, [data-ui~="carousel"])
@@ -70,4 +139,18 @@
70
139
  [data-carousel-slot~="slide"] {
71
140
  flex: 0 0 auto;
72
141
  }
142
+
143
+ :where(ui-carousel, [data-ui~="carousel"])[data-carousel-align="center"] {
144
+ --ui-carousel-snap-align: center;
145
+ }
146
+
147
+ :where(ui-carousel, [data-ui~="carousel"])[data-carousel-align="end"] {
148
+ --ui-carousel-snap-align: end;
149
+ }
150
+
151
+ @media (prefers-reduced-motion: no-preference) {
152
+ :where(ui-carousel, [data-ui~="carousel"]) [data-carousel-slot~="viewport"] {
153
+ scroll-behavior: smooth;
154
+ }
155
+ }
73
156
  }