@c15t/svelte 3.0.0-alpha.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 (274) hide show
  1. package/AGENTS.md +88 -0
  2. package/README.md +136 -0
  3. package/SKILL.md +14 -0
  4. package/dist/actions/focus-trap.d.ts +8 -0
  5. package/dist/actions/focus-trap.js +23 -0
  6. package/dist/actions/portal.d.ts +8 -0
  7. package/dist/actions/portal.js +39 -0
  8. package/dist/actions/scroll-lock.d.ts +8 -0
  9. package/dist/actions/scroll-lock.js +23 -0
  10. package/dist/components/action-button.svelte +119 -0
  11. package/dist/components/action-button.svelte.d.ts +18 -0
  12. package/dist/components/branding.svelte +139 -0
  13. package/dist/components/branding.svelte.d.ts +13 -0
  14. package/dist/components/consent-dev-tools.svelte +58 -0
  15. package/dist/components/consent-dev-tools.svelte.d.ts +4 -0
  16. package/dist/components/frame.svelte +95 -0
  17. package/dist/components/frame.svelte.d.ts +12 -0
  18. package/dist/components/iab-panel.svelte +542 -0
  19. package/dist/components/iab-panel.svelte.d.ts +16 -0
  20. package/dist/components/iab-prompt.svelte +304 -0
  21. package/dist/components/iab-prompt.svelte.d.ts +14 -0
  22. package/dist/components/iab-purpose-item.svelte +511 -0
  23. package/dist/components/iab-purpose-item.svelte.d.ts +26 -0
  24. package/dist/components/iab-stack-item.svelte +146 -0
  25. package/dist/components/iab-stack-item.svelte.d.ts +19 -0
  26. package/dist/components/iab-vendor-list.svelte +900 -0
  27. package/dist/components/iab-vendor-list.svelte.d.ts +19 -0
  28. package/dist/components/icons/c15-t-icon-only.svelte +27 -0
  29. package/dist/components/icons/c15-t-icon-only.svelte.d.ts +9 -0
  30. package/dist/components/icons/chevron-down-icon.svelte +30 -0
  31. package/dist/components/icons/chevron-down-icon.svelte.d.ts +10 -0
  32. package/dist/components/icons/chevron-right-icon.svelte +36 -0
  33. package/dist/components/icons/chevron-right-icon.svelte.d.ts +12 -0
  34. package/dist/components/icons/close-icon.svelte +40 -0
  35. package/dist/components/icons/close-icon.svelte.d.ts +10 -0
  36. package/dist/components/icons/consent-icon-only.svelte +36 -0
  37. package/dist/components/icons/consent-icon-only.svelte.d.ts +9 -0
  38. package/dist/components/icons/external-link-icon.svelte +30 -0
  39. package/dist/components/icons/external-link-icon.svelte.d.ts +8 -0
  40. package/dist/components/icons/globe-icon.svelte +39 -0
  41. package/dist/components/icons/globe-icon.svelte.d.ts +9 -0
  42. package/dist/components/icons/info-icon.svelte +42 -0
  43. package/dist/components/icons/info-icon.svelte.d.ts +9 -0
  44. package/dist/components/icons/inth-logo.svelte +38 -0
  45. package/dist/components/icons/inth-logo.svelte.d.ts +9 -0
  46. package/dist/components/icons/layers-icon.svelte +25 -0
  47. package/dist/components/icons/layers-icon.svelte.d.ts +8 -0
  48. package/dist/components/icons/legitimate-interest-icon.svelte +29 -0
  49. package/dist/components/icons/legitimate-interest-icon.svelte.d.ts +10 -0
  50. package/dist/components/icons/lock-icon.svelte +31 -0
  51. package/dist/components/icons/lock-icon.svelte.d.ts +8 -0
  52. package/dist/components/icons/search-icon.svelte +33 -0
  53. package/dist/components/icons/search-icon.svelte.d.ts +8 -0
  54. package/dist/components/inline-legal-links.svelte +95 -0
  55. package/dist/components/inline-legal-links.svelte.d.ts +10 -0
  56. package/dist/components/manager-provider.svelte +459 -0
  57. package/dist/components/manager-provider.svelte.d.ts +27 -0
  58. package/dist/components/overlay.svelte +79 -0
  59. package/dist/components/overlay.svelte.d.ts +7 -0
  60. package/dist/components/panel-link.svelte +33 -0
  61. package/dist/components/panel-link.svelte.d.ts +10 -0
  62. package/dist/components/panel-trigger.svelte +237 -0
  63. package/dist/components/panel-trigger.svelte.d.ts +16 -0
  64. package/dist/components/panel.svelte +258 -0
  65. package/dist/components/panel.svelte.d.ts +22 -0
  66. package/dist/components/policy-actions-renderer.svelte +79 -0
  67. package/dist/components/policy-actions-renderer.svelte.d.ts +19 -0
  68. package/dist/components/preferences.svelte +320 -0
  69. package/dist/components/preferences.svelte.d.ts +8 -0
  70. package/dist/components/prompt.svelte +514 -0
  71. package/dist/components/prompt.svelte.d.ts +43 -0
  72. package/dist/context.svelte.d.ts +125 -0
  73. package/dist/context.svelte.js +354 -0
  74. package/dist/devtools-options.d.ts +7 -0
  75. package/dist/devtools-options.js +1 -0
  76. package/dist/devtools.d.ts +9 -0
  77. package/dist/devtools.js +7 -0
  78. package/dist/headless.d.ts +10 -0
  79. package/dist/headless.js +7 -0
  80. package/dist/iab/styles.css +11 -0
  81. package/dist/iab-loader.d.ts +30 -0
  82. package/dist/iab-loader.js +33 -0
  83. package/dist/iab-translations.d.ts +84 -0
  84. package/dist/iab-translations.js +45 -0
  85. package/dist/iab-types.d.ts +62 -0
  86. package/dist/iab-types.js +43 -0
  87. package/dist/index.d.ts +28 -0
  88. package/dist/index.js +21 -0
  89. package/dist/kit/app.d.ts +35 -0
  90. package/dist/kit/handle.d.ts +34 -0
  91. package/dist/kit/handle.js +87 -0
  92. package/dist/kit/index.d.ts +30 -0
  93. package/dist/kit/index.js +5 -0
  94. package/dist/kit/load-consent.d.ts +57 -0
  95. package/dist/kit/load-consent.js +144 -0
  96. package/dist/kit/routes.d.ts +46 -0
  97. package/dist/kit/routes.js +203 -0
  98. package/dist/kit/types.d.ts +56 -0
  99. package/dist/kit/types.js +1 -0
  100. package/dist/primitives/accordion/accordion-item-content.svelte +35 -0
  101. package/dist/primitives/accordion/accordion-item-content.svelte.d.ts +9 -0
  102. package/dist/primitives/accordion/accordion-item-trigger.svelte +54 -0
  103. package/dist/primitives/accordion/accordion-item-trigger.svelte.d.ts +10 -0
  104. package/dist/primitives/accordion/accordion-item.svelte +61 -0
  105. package/dist/primitives/accordion/accordion-item.svelte.d.ts +11 -0
  106. package/dist/primitives/accordion/accordion-root.svelte +61 -0
  107. package/dist/primitives/accordion/accordion-root.svelte.d.ts +13 -0
  108. package/dist/primitives/accordion/context.d.ts +18 -0
  109. package/dist/primitives/accordion/context.js +23 -0
  110. package/dist/primitives/accordion/index.d.ts +29 -0
  111. package/dist/primitives/accordion/index.js +11 -0
  112. package/dist/primitives/collapsible/collapsible-content.svelte +36 -0
  113. package/dist/primitives/collapsible/collapsible-content.svelte.d.ts +9 -0
  114. package/dist/primitives/collapsible/collapsible-indicator.svelte +29 -0
  115. package/dist/primitives/collapsible/collapsible-indicator.svelte.d.ts +9 -0
  116. package/dist/primitives/collapsible/collapsible-root.svelte +70 -0
  117. package/dist/primitives/collapsible/collapsible-root.svelte.d.ts +11 -0
  118. package/dist/primitives/collapsible/collapsible-trigger.svelte +52 -0
  119. package/dist/primitives/collapsible/collapsible-trigger.svelte.d.ts +10 -0
  120. package/dist/primitives/collapsible/context.d.ts +10 -0
  121. package/dist/primitives/collapsible/context.js +12 -0
  122. package/dist/primitives/collapsible/index.d.ts +26 -0
  123. package/dist/primitives/collapsible/index.js +11 -0
  124. package/dist/primitives/dialog/context.d.ts +14 -0
  125. package/dist/primitives/dialog/context.js +12 -0
  126. package/dist/primitives/dialog/dialog-backdrop.svelte +39 -0
  127. package/dist/primitives/dialog/dialog-backdrop.svelte.d.ts +7 -0
  128. package/dist/primitives/dialog/dialog-close-trigger.svelte +48 -0
  129. package/dist/primitives/dialog/dialog-close-trigger.svelte.d.ts +11 -0
  130. package/dist/primitives/dialog/dialog-content.svelte +81 -0
  131. package/dist/primitives/dialog/dialog-content.svelte.d.ts +9 -0
  132. package/dist/primitives/dialog/dialog-description.svelte +28 -0
  133. package/dist/primitives/dialog/dialog-description.svelte.d.ts +9 -0
  134. package/dist/primitives/dialog/dialog-positioner.svelte +33 -0
  135. package/dist/primitives/dialog/dialog-positioner.svelte.d.ts +9 -0
  136. package/dist/primitives/dialog/dialog-root.svelte +117 -0
  137. package/dist/primitives/dialog/dialog-root.svelte.d.ts +14 -0
  138. package/dist/primitives/dialog/dialog-title.svelte +28 -0
  139. package/dist/primitives/dialog/dialog-title.svelte.d.ts +9 -0
  140. package/dist/primitives/dialog/index.d.ts +50 -0
  141. package/dist/primitives/dialog/index.js +19 -0
  142. package/dist/primitives/index.d.ts +7 -0
  143. package/dist/primitives/index.js +7 -0
  144. package/dist/primitives/portal/index.d.ts +4 -0
  145. package/dist/primitives/portal/index.js +2 -0
  146. package/dist/primitives/portal/portal.svelte +23 -0
  147. package/dist/primitives/portal/portal.svelte.d.ts +9 -0
  148. package/dist/primitives/preference-item/context.d.ts +11 -0
  149. package/dist/primitives/preference-item/context.js +12 -0
  150. package/dist/primitives/preference-item/index.d.ts +54 -0
  151. package/dist/primitives/preference-item/index.js +21 -0
  152. package/dist/primitives/preference-item/preference-item-auxiliary.svelte +33 -0
  153. package/dist/primitives/preference-item/preference-item-auxiliary.svelte.d.ts +9 -0
  154. package/dist/primitives/preference-item/preference-item-content.svelte +68 -0
  155. package/dist/primitives/preference-item/preference-item-content.svelte.d.ts +14 -0
  156. package/dist/primitives/preference-item/preference-item-control.svelte +33 -0
  157. package/dist/primitives/preference-item/preference-item-control.svelte.d.ts +9 -0
  158. package/dist/primitives/preference-item/preference-item-header.svelte +33 -0
  159. package/dist/primitives/preference-item/preference-item-header.svelte.d.ts +9 -0
  160. package/dist/primitives/preference-item/preference-item-leading.svelte +33 -0
  161. package/dist/primitives/preference-item/preference-item-leading.svelte.d.ts +9 -0
  162. package/dist/primitives/preference-item/preference-item-meta.svelte +33 -0
  163. package/dist/primitives/preference-item/preference-item-meta.svelte.d.ts +9 -0
  164. package/dist/primitives/preference-item/preference-item-root.svelte +82 -0
  165. package/dist/primitives/preference-item/preference-item-root.svelte.d.ts +12 -0
  166. package/dist/primitives/preference-item/preference-item-title.svelte +33 -0
  167. package/dist/primitives/preference-item/preference-item-title.svelte.d.ts +9 -0
  168. package/dist/primitives/preference-item/preference-item-trigger.svelte +62 -0
  169. package/dist/primitives/preference-item/preference-item-trigger.svelte.d.ts +10 -0
  170. package/dist/primitives/switch/context.d.ts +7 -0
  171. package/dist/primitives/switch/context.js +12 -0
  172. package/dist/primitives/switch/index.d.ts +25 -0
  173. package/dist/primitives/switch/index.js +11 -0
  174. package/dist/primitives/switch/switch-control.svelte +21 -0
  175. package/dist/primitives/switch/switch-control.svelte.d.ts +9 -0
  176. package/dist/primitives/switch/switch-hidden-input.svelte +31 -0
  177. package/dist/primitives/switch/switch-hidden-input.svelte.d.ts +8 -0
  178. package/dist/primitives/switch/switch-root.svelte +86 -0
  179. package/dist/primitives/switch/switch-root.svelte.d.ts +12 -0
  180. package/dist/primitives/switch/switch-thumb.svelte +14 -0
  181. package/dist/primitives/switch/switch-thumb.svelte.d.ts +7 -0
  182. package/dist/primitives/tabs/context.d.ts +11 -0
  183. package/dist/primitives/tabs/context.js +12 -0
  184. package/dist/primitives/tabs/index.d.ts +32 -0
  185. package/dist/primitives/tabs/index.js +11 -0
  186. package/dist/primitives/tabs/tabs-content.svelte +45 -0
  187. package/dist/primitives/tabs/tabs-content.svelte.d.ts +11 -0
  188. package/dist/primitives/tabs/tabs-list.svelte +38 -0
  189. package/dist/primitives/tabs/tabs-list.svelte.d.ts +10 -0
  190. package/dist/primitives/tabs/tabs-root.svelte +67 -0
  191. package/dist/primitives/tabs/tabs-root.svelte.d.ts +14 -0
  192. package/dist/primitives/tabs/tabs-trigger.svelte +108 -0
  193. package/dist/primitives/tabs/tabs-trigger.svelte.d.ts +11 -0
  194. package/dist/server/headers.d.ts +13 -0
  195. package/dist/server/headers.js +37 -0
  196. package/dist/server/index.d.ts +8 -0
  197. package/dist/server/index.js +116 -0
  198. package/dist/server/normalize-url.d.ts +23 -0
  199. package/dist/server/normalize-url.js +46 -0
  200. package/dist/server/types.d.ts +25 -0
  201. package/dist/server/types.js +1 -0
  202. package/dist/styles.css +10 -0
  203. package/dist/transports/offline.d.ts +14 -0
  204. package/dist/transports/offline.js +22 -0
  205. package/dist/types.d.ts +70 -0
  206. package/dist/types.js +1 -0
  207. package/dist/use-banner-visibility.svelte.d.ts +25 -0
  208. package/dist/use-banner-visibility.svelte.js +108 -0
  209. package/dist/utils.d.ts +25 -0
  210. package/dist/utils.js +32 -0
  211. package/dist/version.d.ts +1 -0
  212. package/dist/version.js +2 -0
  213. package/docs/README.md +88 -0
  214. package/docs/assets/v3/brand-bar.png +0 -0
  215. package/docs/assets/v3/brand-card.png +0 -0
  216. package/docs/assets/v3/choice-wall.png +0 -0
  217. package/docs/assets/v3/mobile-card.png +0 -0
  218. package/docs/assets/v3/preferences.png +0 -0
  219. package/docs/customization/overview.md +45 -0
  220. package/docs/customization/recipes.md +79 -0
  221. package/docs/customization/slots.md +55 -0
  222. package/docs/customization/tokens.md +76 -0
  223. package/docs/customization/translations.md +49 -0
  224. package/docs/frameworks/svelte/quickstart.md +133 -0
  225. package/docs/frameworks/sveltekit/quickstart.md +144 -0
  226. package/docs/guides/consent-state.md +60 -0
  227. package/docs/guides/data-fetching.md +163 -0
  228. package/docs/guides/deployment-modes.md +63 -0
  229. package/docs/guides/troubleshooting.md +68 -0
  230. package/docs/guides/verify-consent.md +62 -0
  231. package/docs/integrations/adobe-analytics.md +294 -0
  232. package/docs/integrations/ahrefs-analytics.md +291 -0
  233. package/docs/integrations/amplitude.md +292 -0
  234. package/docs/integrations/building-integrations.md +47 -0
  235. package/docs/integrations/clearbit.md +291 -0
  236. package/docs/integrations/cloudflare-web-analytics.md +292 -0
  237. package/docs/integrations/crisp.md +294 -0
  238. package/docs/integrations/databuddy.md +311 -0
  239. package/docs/integrations/fathom-analytics.md +293 -0
  240. package/docs/integrations/google-maps.md +384 -0
  241. package/docs/integrations/google-tag-manager.md +306 -0
  242. package/docs/integrations/google-tag.md +305 -0
  243. package/docs/integrations/heap.md +292 -0
  244. package/docs/integrations/hightouch.md +293 -0
  245. package/docs/integrations/hotjar.md +292 -0
  246. package/docs/integrations/intercom.md +285 -0
  247. package/docs/integrations/linkedin-insights.md +291 -0
  248. package/docs/integrations/logrocket.md +293 -0
  249. package/docs/integrations/matomo-analytics.md +316 -0
  250. package/docs/integrations/meta-pixel.md +285 -0
  251. package/docs/integrations/microsoft-clarity.md +292 -0
  252. package/docs/integrations/microsoft-uet.md +291 -0
  253. package/docs/integrations/mixpanel-analytics.md +295 -0
  254. package/docs/integrations/openai-pixel.md +441 -0
  255. package/docs/integrations/overview.md +111 -0
  256. package/docs/integrations/pirsch.md +295 -0
  257. package/docs/integrations/plausible-analytics.md +295 -0
  258. package/docs/integrations/posthog.md +397 -0
  259. package/docs/integrations/promptwatch.md +291 -0
  260. package/docs/integrations/reddit-pixel.md +294 -0
  261. package/docs/integrations/rudderstack.md +328 -0
  262. package/docs/integrations/rybbit-analytics.md +296 -0
  263. package/docs/integrations/segment.md +292 -0
  264. package/docs/integrations/snapchat-pixel.md +293 -0
  265. package/docs/integrations/tiktok-pixel.md +291 -0
  266. package/docs/integrations/umami-analytics.md +295 -0
  267. package/docs/integrations/vercel-analytics.md +293 -0
  268. package/docs/integrations/x-pixel.md +291 -0
  269. package/docs/integrations/youtube.md +405 -0
  270. package/docs/upgrade-v3.md +334 -0
  271. package/iab/styles.css +1 -0
  272. package/package.json +153 -0
  273. package/readme.json +36 -0
  274. package/styles.css +1 -0
@@ -0,0 +1,108 @@
1
+ import { onMount, tick, untrack } from 'svelte';
2
+ const DEFAULT_DURATION_MS = 200;
3
+ const readDurationMs = function readDurationMs(target) {
4
+ if (typeof document === 'undefined') {
5
+ return DEFAULT_DURATION_MS;
6
+ }
7
+ const value = getComputedStyle(target ?? document.documentElement)
8
+ .getPropertyValue('--consent-banner-animation-duration')
9
+ .trim();
10
+ if (!value) {
11
+ return DEFAULT_DURATION_MS;
12
+ }
13
+ if (value.endsWith('ms')) {
14
+ return Number.parseFloat(value) || DEFAULT_DURATION_MS;
15
+ }
16
+ if (value.endsWith('s')) {
17
+ return Number.parseFloat(value) * 1000 || DEFAULT_DURATION_MS;
18
+ }
19
+ return Number.parseFloat(value) || DEFAULT_DURATION_MS;
20
+ };
21
+ /**
22
+ * Visibility / mount lifecycle for the consent banner.
23
+ *
24
+ * - On show: mounts the element with `.bannerHidden`, awaits Svelte commit,
25
+ * forces a reflow so the browser observes that initial style, then flips
26
+ * to `.bannerVisible`. The CSS transition fires automatically — no JS
27
+ * timing coordination.
28
+ * - On hide: flips to `.bannerHidden`, then unmounts after the duration
29
+ * declared by the `--consent-banner-animation-duration` CSS variable.
30
+ * - When animation is disabled (provider option or `prefers-reduced-motion`):
31
+ * toggles synchronously, skipping the show reflow and the hide timer.
32
+ * - Server render: when the very first evaluation already says "show" — which
33
+ * only happens once a `prefetch` has seeded a resolved policy, since
34
+ * without one the kernel's model is `null` and `activeUI` is `'none'` — the
35
+ * banner starts mounted and *visible*. That puts the shell in the first
36
+ * HTML and skips the entry animation on hydration, which would otherwise
37
+ * replay an animation the user has already seen painted. Client-triggered
38
+ * shows still take the animated path.
39
+ */
40
+ export const useBannerVisibility = function useBannerVisibility(getShouldShow, getDisableAnimation) {
41
+ // Read outside a reactive scope: this is the one-shot server/initial
42
+ // decision, not an ongoing dependency. The $effect below owns the rest.
43
+ const serverVisible = untrack(getShouldShow);
44
+ let isVisible = $state(serverVisible);
45
+ let isMounted = $state(serverVisible);
46
+ let shouldRender = $state(serverVisible);
47
+ onMount(() => {
48
+ isMounted = true;
49
+ });
50
+ let bannerEl = $state();
51
+ $effect(() => {
52
+ const shouldShow = getShouldShow();
53
+ const disableAnim = getDisableAnimation();
54
+ if (shouldShow) {
55
+ shouldRender = true;
56
+ if (disableAnim) {
57
+ isVisible = true;
58
+ return;
59
+ }
60
+ let cancelled = false;
61
+ void (async () => {
62
+ await tick();
63
+ if (cancelled) {
64
+ return;
65
+ }
66
+ // Force layout so the browser observes `bannerHidden` before we
67
+ // flip to `bannerVisible`. Without this, a fresh mount can
68
+ // compute the final style first and skip the entry transition.
69
+ void bannerEl?.offsetHeight;
70
+ isVisible = true;
71
+ })();
72
+ return () => {
73
+ cancelled = true;
74
+ };
75
+ }
76
+ if (!isVisible) {
77
+ shouldRender = false;
78
+ return;
79
+ }
80
+ if (disableAnim) {
81
+ isVisible = false;
82
+ shouldRender = false;
83
+ return;
84
+ }
85
+ isVisible = false;
86
+ const timer = setTimeout(() => {
87
+ shouldRender = false;
88
+ }, readDurationMs(bannerEl ?? null));
89
+ return () => clearTimeout(timer);
90
+ });
91
+ return {
92
+ get bannerEl() {
93
+ return bannerEl;
94
+ },
95
+ set bannerEl(el) {
96
+ bannerEl = el;
97
+ },
98
+ get isMounted() {
99
+ return isMounted;
100
+ },
101
+ get isVisible() {
102
+ return isVisible;
103
+ },
104
+ get shouldRender() {
105
+ return shouldRender;
106
+ },
107
+ };
108
+ };
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Theme and styling utilities for Svelte components.
3
+ */
4
+ import type { AllThemeKeys, ClassNameStyle, Theme, ThemeCSSVariables } from '@c15t/ui/theme';
5
+ /**
6
+ * Default design tokens for the theme system.
7
+ */
8
+ export declare const defaultTheme: Required<Omit<Theme, "slots">>;
9
+ /**
10
+ * Maps theme tokens to CSS variables.
11
+ */
12
+ export declare const themeToVars: (theme: Theme, isDark?: boolean) => ThemeCSSVariables;
13
+ /**
14
+ * Generates a CSS string for the theme variables.
15
+ */
16
+ export declare const generateThemeCSS: (theme: Theme) => string;
17
+ /**
18
+ * Resolves styles for a component, merging theme slot styles with component styles.
19
+ */
20
+ export declare const resolveComponentStyles: (themeKey: AllThemeKeys, theme: Theme | undefined, componentStyle: ClassNameStyle | undefined, noStyle: boolean | undefined) => ClassNameStyle;
21
+ /** Resolve only host appearance; policy action constraints remain in core. */
22
+ export declare const resolveConsentActionStyle: (theme: Theme | undefined, action: "accept" | "reject" | "customize" | "dismiss" | "save") => {
23
+ variant?: "primary" | "neutral";
24
+ mode?: "filled" | "stroke" | "lighter" | "ghost";
25
+ };
package/dist/utils.js ADDED
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Theme and styling utilities for Svelte components.
3
+ */
4
+ import { defaultTheme as baseDefaultTheme, generateThemeCSS as baseGenerateThemeCSS, themeToVars as baseThemeToVars, } from '@c15t/ui/theme';
5
+ import { resolveStyles as baseResolveStyles } from '@c15t/ui/utils';
6
+ /**
7
+ * Default design tokens for the theme system.
8
+ */
9
+ export const defaultTheme = baseDefaultTheme;
10
+ /**
11
+ * Maps theme tokens to CSS variables.
12
+ */
13
+ export const themeToVars = function themeToVars(theme, isDark = false) {
14
+ return baseThemeToVars(theme, isDark);
15
+ };
16
+ /**
17
+ * Generates a CSS string for the theme variables.
18
+ */
19
+ export const generateThemeCSS = function generateThemeCSS(theme) {
20
+ return baseGenerateThemeCSS(theme);
21
+ };
22
+ /**
23
+ * Resolves styles for a component, merging theme slot styles with component styles.
24
+ */
25
+ export const resolveComponentStyles = function resolveComponentStyles(themeKey, theme, componentStyle, noStyle) {
26
+ return baseResolveStyles(themeKey, theme, componentStyle, noStyle);
27
+ };
28
+ /** Resolve only host appearance; policy action constraints remain in core. */
29
+ export const resolveConsentActionStyle = (theme, action) => {
30
+ const specific = action === 'save' ? undefined : theme?.consentActions?.[action];
31
+ return { ...theme?.consentActions?.default, ...specific };
32
+ };
@@ -0,0 +1 @@
1
+ export declare const version = "3.0.0-alpha.0";
@@ -0,0 +1,2 @@
1
+ // Generated by genversion.
2
+ export const version = '3.0.0-alpha.0';
package/docs/README.md ADDED
@@ -0,0 +1,88 @@
1
+ # @c15t/svelte
2
+
3
+ > Svelte and SvelteKit v3 providers, request loading and static hosting with Inth.
4
+
5
+ These docs ship inside the package so coding agents can read them offline. Open the topic file you need from the list below — paths are relative to this file.
6
+
7
+ ## Using these docs
8
+
9
+ These docs describe v3. Start with Inth hosted setup, identify the framework, router and deployment, then read its quickstart. Static sites can use Inth directly. Use page Markdown and package-bundled docs for targeted context. Verify scripts, rejection, reload and preferences; banner visibility alone is insufficient.
10
+
11
+ ## Start here
12
+
13
+ - [Svelte quickstart](./frameworks/svelte/quickstart.md)
14
+ - [SvelteKit quickstart](./frameworks/sveltekit/quickstart.md)
15
+ - [Customize your consent interface](./customization/overview.md): Choose presentation, theme tokens, slots or custom markup for the change you need.
16
+ - [Verify consent before shipping](./guides/verify-consent.md): Test requests, policy resolution, persistence, navigation and preference changes in a production build.
17
+ - [Upgrade to v3 policies](./upgrade-v3.md): Migrate policy configuration, consent records, callbacks, and custom transports to the v3 policy system.
18
+
19
+ ## More documentation
20
+
21
+ [Documentation index](https://c15t.com/docs/llms.txt) · [Full Markdown context](https://c15t.com/llms-full.txt). Prefer the index and individual pages for focused tasks.
22
+
23
+ ## Frameworks
24
+
25
+ - [Quickstart](./frameworks/svelte/quickstart.md): Mount c15t components and a persistent preferences link in a Svelte 5 application.
26
+ - [Quickstart](./frameworks/sveltekit/quickstart.md): Resolve consent in a SvelteKit server load and hydrate the provider, or initialize in the browser on static hosting.
27
+
28
+ ## Guides
29
+
30
+ - [Understand consent state](./guides/consent-state.md): Distinguish policy resolution, effective permissions, explicit choices, notices and privacy signals.
31
+ - [Data fetching and transports](./guides/data-fetching.md): Choose cached manifests, backend init or offline policy resolution, and understand where consent records are saved.
32
+ - [Choose a deployment mode](./guides/deployment-modes.md): Choose who runs your consent backend, then select manifest, init or offline resolution for your deployment.
33
+ - [Troubleshoot consent](./guides/troubleshooting.md): Diagnose missing banners, early vendor requests, lost choices and hydration differences.
34
+ - [Verify consent before shipping](./guides/verify-consent.md): Test requests, policy resolution, persistence, navigation and preference changes in a production build.
35
+
36
+ ## Customization
37
+
38
+ - [Customize your consent interface](./customization/overview.md): Choose presentation, theme tokens, slots or custom markup for the change you need.
39
+ - [Banner styling recipes](./customization/recipes.md): See real v3 components and reuse the exact theme configuration behind the examples.
40
+ - [Style component slots](./customization/slots.md): Target a specific c15t component part without replacing its markup or behavior.
41
+ - [Theme tokens and CSS](./customization/tokens.md): Style c15t with semantic tokens and use the stylesheet that matches your CSS tooling.
42
+ - [Copy and translations](./customization/translations.md): Change consent wording through i18n and test the complete prompt and preferences flow.
43
+
44
+ ## Integrations
45
+
46
+ - [Adobe Analytics](./integrations/adobe-analytics.md): Configure Adobe Analytics with c15t v3, understand measurement permission and verify loading and revocation.
47
+ - [Ahrefs Analytics](./integrations/ahrefs-analytics.md): Configure Ahrefs Analytics with c15t v3, understand measurement permission and verify loading and revocation.
48
+ - [Amplitude](./integrations/amplitude.md): Configure Amplitude with c15t v3, understand measurement permission and verify loading and revocation.
49
+ - [Custom integrations](./integrations/building-integrations.md): Define loading, initialization and consent-change behavior for a vendor without a helper.
50
+ - [Clearbit](./integrations/clearbit.md): Configure Clearbit with c15t v3, understand marketing permission and verify loading and revocation.
51
+ - [Cloudflare Web Analytics](./integrations/cloudflare-web-analytics.md): Configure Cloudflare Web Analytics with c15t v3, understand measurement permission and verify loading and revocation.
52
+ - [Crisp](./integrations/crisp.md): Configure Crisp with c15t v3, understand functionality permission and verify loading and revocation.
53
+ - [Databuddy](./integrations/databuddy.md): Configure Databuddy's initial and updated consent state with c15t v3.
54
+ - [Fathom Analytics](./integrations/fathom-analytics.md): Configure Fathom Analytics with c15t v3, understand measurement permission and verify loading and revocation.
55
+ - [Google Maps](./integrations/google-maps.md): Prevent a map iframe from mounting before the required permission.
56
+ - [Google Tag](./integrations/google-tag.md): Configure gtag with c15t Consent Mode signals and understand its loading behavior.
57
+ - [Google Tag Manager](./integrations/google-tag-manager.md): Load GTM with c15t consent signals and verify the tags inside your container.
58
+ - [Heap](./integrations/heap.md): Configure Heap with c15t v3, understand measurement permission and verify loading and revocation.
59
+ - [Hightouch](./integrations/hightouch.md): Configure Hightouch with c15t v3, understand measurement permission and verify loading and revocation.
60
+ - [Hotjar](./integrations/hotjar.md): Configure Hotjar with c15t v3, understand measurement permission and verify loading and revocation.
61
+ - [Intercom](./integrations/intercom.md): Load the Intercom messenger with functionality permission and configure its region.
62
+ - [LinkedIn Insight Tag](./integrations/linkedin-insights.md): Configure LinkedIn Insight Tag with c15t v3, understand marketing permission and verify loading and revocation.
63
+ - [LogRocket](./integrations/logrocket.md): Configure LogRocket with c15t v3, understand measurement permission and verify loading and revocation.
64
+ - [Matomo Analytics](./integrations/matomo-analytics.md): Choose gated loading or Matomo consent signaling and configure the correct tracker endpoints.
65
+ - [Meta Pixel](./integrations/meta-pixel.md): Register the Meta Pixel under marketing permission and verify event calls after revocation.
66
+ - [Microsoft Clarity](./integrations/microsoft-clarity.md): Configure Microsoft Clarity with c15t v3, understand measurement permission and verify loading and revocation.
67
+ - [Microsoft UET](./integrations/microsoft-uet.md): Configure Microsoft UET with c15t v3, understand marketing permission and verify loading and revocation.
68
+ - [Mixpanel](./integrations/mixpanel-analytics.md): Configure Mixpanel with c15t v3, understand measurement permission and verify loading and revocation.
69
+ - [OpenAI Pixel](./integrations/openai-pixel.md): Configure the OpenAI Measurement Pixel for ChatGPT Ads with c15t v3, manage marketing permission and verify conversion delivery.
70
+ - [Overview](./integrations/overview.md): Find all c15t integrations for analytics, tag managers, advertising, chat and embedded content.
71
+ - [Pirsch](./integrations/pirsch.md): Configure Pirsch with c15t v3, understand measurement permission and verify loading and revocation.
72
+ - [Plausible Analytics](./integrations/plausible-analytics.md): Configure Plausible Analytics with c15t v3, understand measurement permission and verify loading and revocation.
73
+ - [PostHog](./integrations/posthog.md): Choose PostHog loading and cookieless behavior, configure the region, and synchronize v3 permissions.
74
+ - [Promptwatch](./integrations/promptwatch.md): Configure Promptwatch with c15t v3, understand measurement permission and verify loading and revocation.
75
+ - [Reddit Pixel](./integrations/reddit-pixel.md): Configure Reddit Pixel with c15t v3, understand marketing permission and verify loading and revocation.
76
+ - [RudderStack](./integrations/rudderstack.md): Gate the RudderStack browser SDK or map c15t categories to destination consent IDs.
77
+ - [Rybbit Analytics](./integrations/rybbit-analytics.md): Configure Rybbit Analytics with c15t v3, understand measurement permission and verify loading and revocation.
78
+ - [Segment](./integrations/segment.md): Configure Segment with c15t v3, understand measurement permission and verify loading and revocation.
79
+ - [Snapchat Pixel](./integrations/snapchat-pixel.md): Configure Snapchat Pixel with c15t v3, understand marketing permission and verify loading and revocation.
80
+ - [TikTok Pixel](./integrations/tiktok-pixel.md): Configure TikTok Pixel with c15t v3, understand marketing permission and verify loading and revocation.
81
+ - [Umami Analytics](./integrations/umami-analytics.md): Configure Umami Analytics with c15t v3, understand measurement permission and verify loading and revocation.
82
+ - [Vercel Analytics](./integrations/vercel-analytics.md): Configure Vercel Analytics with c15t v3, understand measurement permission and verify loading and revocation.
83
+ - [X Pixel](./integrations/x-pixel.md): Configure X Pixel with c15t v3, understand marketing permission and verify loading and revocation.
84
+ - [YouTube](./integrations/youtube.md): Gate YouTube embeds with c15t v3 in Next.js, TanStack Start, React, Nuxt, Vue, Astro, Svelte, SvelteKit or JavaScript.
85
+
86
+ ## Reference
87
+
88
+ - [Upgrade to v3 policies](./upgrade-v3.md): Migrate policy configuration, consent records, callbacks, and custom transports to the v3 policy system.
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,45 @@
1
+ ---
2
+ title: Customize your consent interface
3
+ description: Choose presentation, theme tokens, slots or custom markup for the
4
+ change you need.
5
+ group: customization
6
+ ---
7
+
8
+ ## Start with the change you want
9
+
10
+ | Change | Use | Why |
11
+ | ----------------------------------------- | ----------------------------------- | ------------------------------------------------------------ |
12
+ | Banner shape or location | Presentation or banner props | Keeps policy actions and built-in layout behavior |
13
+ | Brand colors, radius, typography, spacing | Theme tokens | Changes related component parts together |
14
+ | One card, footer, title or button group | Component slots | Targets existing markup |
15
+ | Labels, descriptions or language | i18n configuration | Keeps banner and preferences copy consistent |
16
+ | A different component structure | Compound components where available | Retains the component behavior while changing markup |
17
+ | Your own interaction and markup | Headless APIs | You own rendering, focus behavior and policy action coverage |
18
+
19
+ Most brand changes need tokens and a few slots. Start there before opting out
20
+ of the stock styles. The [recipes](./recipes.md) show how each
21
+ choice affects a real banner.
22
+
23
+ ## Keep behavior and appearance separate
24
+
25
+ Presentation controls the prompt's shape, position and blocking behavior.
26
+ Policy controls which actions and rights are required. Changing colors or button
27
+ order does not change a saved choice or policy scope.
28
+
29
+ A choice wall always blocks. Notices never block and cannot become a wall merely
30
+ because `variant: 'wall'` was requested. Preference dialogs remain centered;
31
+ prompt positioning does not move them. Required actions omitted from a custom
32
+ layout can be restored by the policy renderer.
33
+
34
+ ## Use the adapter's configuration shape
35
+
36
+ React and Next.js accept provider `theme`, `presentation` and `components`
37
+ options. Vue and Nuxt expose their own shared configuration, including CSS
38
+ `tokens` and component slots. Svelte accepts its provider options and theme
39
+ contract. Astro serializes integration options and uses the selected adapter for
40
+ dialogs. Do not move a configuration object between frameworks without checking
41
+ the target types.
42
+
43
+ Read [tokens and CSS](./tokens.md),
44
+ [slots](./slots.md) or
45
+ [copy and translations](./translations.md) for the next step.
@@ -0,0 +1,79 @@
1
+ ---
2
+ title: Banner styling recipes
3
+ description: See real v3 components and reuse the exact theme configuration
4
+ behind the examples.
5
+ group: customization
6
+ ---
7
+
8
+ ## A branded floating card
9
+
10
+ This theme uses a green primary action and a four-pixel large radius. Accept and
11
+ Reject keep matching treatment. The component's required action behavior stays
12
+ intact.
13
+
14
+ ![A v3 floating consent card with green Customize action, matching Accept and Reject buttons, and compact corners](../assets/v3/brand-card.png)
15
+
16
+ ```ts
17
+ import { defineTheme } from '@c15t/ui/theme';
18
+
19
+ export const brandTheme = defineTheme({
20
+ colors: { primary: '#2f6f4e' },
21
+ consentActions: {
22
+ primary: { mode: 'filled', variant: 'primary' },
23
+ },
24
+ radius: { lg: '4px' },
25
+ });
26
+
27
+ ```
28
+
29
+ Install `@c15t/ui` to use `defineTheme` directly. Pass `brandTheme` as `theme` in
30
+ your existing React or Next.js provider options. Keep your Inth mode and script
31
+ configuration. The theme source above is also imported by the runnable example,
32
+ so the rendered result and the documentation use the same values.
33
+
34
+ ## Change the shape without rebuilding the banner
35
+
36
+ ```tsx
37
+ <ConsentBanner variant="bar" />
38
+ ```
39
+
40
+ ![The same green theme on a full-width v3 consent bar with the actions arranged across its footer](../assets/v3/brand-bar.png)
41
+
42
+ A bar changes the prompt's footprint. It does not change policy, grant categories
43
+ or require a headless implementation.
44
+
45
+ ```tsx
46
+ <ConsentBanner variant="wall" />
47
+ ```
48
+
49
+ ![A centered v3 choice wall with a backdrop, using the same green action theme](../assets/v3/choice-wall.png)
50
+
51
+ A choice wall blocks interaction with the page. A notice never blocks; requesting
52
+ a wall for a notice falls back to a non-blocking presentation.
53
+
54
+ ## Carry the theme into preferences
55
+
56
+ ![The v3 preferences dialog with optional category toggles and a green Save Settings action](../assets/v3/preferences.png)
57
+
58
+ Keep a preferences link after the banner closes. Test a reject action, reopen
59
+ the dialog, change one category and save. A branded prompt is only part of the
60
+ consent flow.
61
+
62
+ ## Check narrow screens
63
+
64
+ ![The branded v3 floating card at a 375-pixel viewport, with Accept and Reject sharing a row and Customize below](../assets/v3/mobile-card.png)
65
+
66
+ This example fits a 375-pixel viewport without horizontal overflow. Test your
67
+ own longest translations and font settings before adopting the same sizing.
68
+
69
+ ## Run the examples
70
+
71
+ The source repository contains resettable Storybook examples under
72
+ `Docs / Customization`: Brand Card, Brand Bar and Choice Wall. Each demo uses
73
+ in-memory consent and no analytics; Reset example returns it to a fresh choice.
74
+ The screenshots above come from these v3 examples.
75
+
76
+ The stories are suitable for isolated iframe previews on a version-matched
77
+ Storybook deployment. Keep source code and the explanation on this page when
78
+ embedding them, so the recipe remains usable in Markdown and offline package
79
+ docs. A live preview must use the same v3 revision as the documentation.
@@ -0,0 +1,55 @@
1
+ ---
2
+ title: Style component slots
3
+ description: Target a specific c15t component part without replacing its markup or behavior.
4
+ group: customization
5
+ ---
6
+
7
+ ## Use slots for local changes
8
+
9
+ In React and Next.js, put per-part attributes in `options.components`. This
10
+ fragment belongs in an existing provider's options:
11
+
12
+ ```tsx
13
+ components: {
14
+ banner: {
15
+ card: { className: 'rounded-none shadow-none' },
16
+ title: { className: 'font-semibold' },
17
+ footer: { className: 'border-t' },
18
+ },
19
+ }
20
+ ```
21
+
22
+ The class names above assume Tailwind. A slot can also receive `style` and other
23
+ supported element attributes. Keep shared colors and radius scales in tokens;
24
+ use slots when only one component part should change.
25
+
26
+ ## Read attributes on the right element
27
+
28
+ The banner root carries `data-prompt`, `data-model`, `data-variant`,
29
+ `data-position` and `data-blocking`. Its child card does not inherit those HTML
30
+ attributes. In Tailwind, give the root `className: 'group'` and use
31
+ `group-data-[variant=bar]:...` on a child slot.
32
+
33
+ | React banner slot | Use |
34
+ | ---------------------------------- | ------------------------------------- |
35
+ | `root` | Position wrapper and state attributes |
36
+ | `cardShell` | Card sizing and branding container |
37
+ | `card` | Visible card |
38
+ | `header`, `title`, `description` | Heading and explanatory copy |
39
+ | `footer`, `actions`, `actionGroup` | Action layout |
40
+ | `rights`, `rightLink` | Preferences access controls |
41
+ | `overlay` | Backdrop for blocking presentation |
42
+
43
+ Buttons expose `data-action` for action-specific CSS. Test notices as well as
44
+ choice prompts; a notice uses acknowledgement rather than accept/reject.
45
+
46
+ ## When to remove styles
47
+
48
+ `noStyle` removes the built-in component styling. It does not supply replacement
49
+ layout, spacing, focus indicators or responsive behavior. Use it when you intend
50
+ to own all of that work, not as the first response to a token that appears to do
51
+ nothing.
52
+
53
+ If the markup itself must change, use the adapter's compound components or
54
+ headless API. The slot objects above are the React contract; check Vue and Svelte
55
+ slot types before reusing them.
@@ -0,0 +1,76 @@
1
+ ---
2
+ title: Theme tokens and CSS
3
+ description: Style c15t with semantic tokens and use the stylesheet that matches
4
+ your CSS tooling.
5
+ group: customization
6
+ ---
7
+
8
+ ## Load the stock stylesheet once
9
+
10
+ React, Next.js and Svelte provide `styles.css`. Import the adapter's stylesheet
11
+ at the app's global entry point. Vue includes styles in its components; Astro
12
+ adds styles through its integration.
13
+
14
+ ```tsx
15
+ import 'c15t/react/styles.css';
16
+ ```
17
+
18
+ The standard stylesheet places rules in `@layer components`. For Tailwind 3,
19
+ use the `styles.tw3.css` entry instead of the standard stylesheet, between the
20
+ components and utilities directives in your Tailwind entry:
21
+
22
+ ```css
23
+ @tailwind base;
24
+ @tailwind components;
25
+ @import 'c15t/react/styles.tw3.css';
26
+ @tailwind utilities;
27
+ ```
28
+
29
+ Do not load both c15t stylesheet variants. For Tailwind 4 or unlayered CSS,
30
+ inspect layer order before reaching for `!important`.
31
+
32
+ ## Set semantic values together
33
+
34
+ This React theme changes the brand color and large corner radius. Include
35
+ hover and foreground colors when overriding raw variables so the button remains
36
+ readable in each state.
37
+
38
+ ```ts
39
+ import { defineTheme } from '@c15t/ui/theme';
40
+
41
+ export const theme = defineTheme({
42
+ colors: { primary: '#2f6f4e' },
43
+ radius: { lg: '4px' },
44
+ consentActions: {
45
+ primary: { variant: 'primary', mode: 'filled' },
46
+ dismiss: { variant: 'neutral', mode: 'stroke' },
47
+ },
48
+ });
49
+ ```
50
+
51
+ Install `@c15t/ui` if importing its theme helper directly. Pass `theme` in your
52
+ provider options. `consentActions` selects styling by action role. A per-action
53
+ entry overrides `primary`, which overrides `default`.
54
+
55
+ ## Target a prompt with CSS
56
+
57
+ ```css
58
+ [data-prompt][data-model='opt-in'] {
59
+ --c15t-primary: #2f6f4e;
60
+ --c15t-primary-hover: #24563c;
61
+ --c15t-text-on-primary: #fff;
62
+ }
63
+ ```
64
+
65
+ Use attributes exposed by the rendered component, not guessed class names.
66
+ Test the prompt and the preferences dialog separately because tokens scoped to
67
+ one prompt do not automatically reach a portaled dialog.
68
+
69
+ | Size variable | Default | Target |
70
+ | ----------------------------------- | ------- | ------------- |
71
+ | `--consent-banner-max-width` | `440px` | Floating card |
72
+ | `--consent-banner-widget-max-width` | `20rem` | Widget |
73
+ | `--consent-banner-wall-max-width` | `30rem` | Choice wall |
74
+
75
+ Test long translations and small screens after changing width or typography.
76
+ A compact banner must still fit the required actions.
@@ -0,0 +1,49 @@
1
+ ---
2
+ title: Copy and translations
3
+ description: Change consent wording through i18n and test the complete prompt
4
+ and preferences flow.
5
+ group: customization
6
+ ---
7
+
8
+ ## Configure shared messages
9
+
10
+ Use provider `i18n` for wording that should stay consistent across components.
11
+ For React, this fragment belongs in `ConsentProvider` options:
12
+
13
+ ```tsx
14
+ i18n: {
15
+ messages: {
16
+ en: {
17
+ common: {
18
+ acceptAll: 'Accept all',
19
+ rejectAll: 'Reject optional',
20
+ customize: 'Choose cookies',
21
+ acknowledge: 'Got it',
22
+ },
23
+ },
24
+ },
25
+ }
26
+ ```
27
+
28
+ Supply the same message keys in each supported locale. A one-off component prop
29
+ such as `dismissButtonText` is useful for one banner; use translations for a
30
+ site-wide change. Astro's serializable integration options and Vue's module
31
+ configuration have their own types, so verify those shapes before copying a
32
+ React object.
33
+
34
+ ## Write labels that describe the action
35
+
36
+ Accept and Reject record a choice. Customize opens preferences. Acknowledge
37
+ dismisses a notice and does not record a grant. Do not label a notice dismissal
38
+ "Accept all" or make a preferences link sound like it submits an opt-out.
39
+
40
+ The notice acknowledgement uses `common.acknowledge`, with `common.dismiss` as
41
+ a fallback for older translation bundles. Keep the displayed label and the
42
+ command's effect aligned.
43
+
44
+ ## Test more than English
45
+
46
+ Try the longest labels you support at a narrow width, with browser zoom and
47
+ right-to-left text where relevant. Check banner actions, category descriptions,
48
+ legal links and the preferences save action. Translate explanations as well as
49
+ buttons so a visitor can make an informed choice.