cclkit4svelte 3.0.0 → 4.0.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 (40) hide show
  1. package/README.md +5 -0
  2. package/dist/BookCard.svelte +7 -2
  3. package/dist/Carousel.svelte +3 -3
  4. package/dist/ChangeHistory.svelte +14 -9
  5. package/dist/ChangeHistory.svelte.d.ts +11 -0
  6. package/dist/DatePicker.svelte +7 -2
  7. package/dist/Dialog.svelte.d.ts +1 -1
  8. package/dist/PrismaticAmbientGlow.svelte +115 -0
  9. package/dist/PrismaticAmbientGlow.svelte.d.ts +36 -0
  10. package/dist/PrismaticBookCard.svelte +175 -0
  11. package/dist/PrismaticBookCard.svelte.d.ts +34 -0
  12. package/dist/PrismaticGradientButton.svelte +211 -0
  13. package/dist/PrismaticGradientButton.svelte.d.ts +51 -0
  14. package/dist/PrismaticSectionHeading.svelte +70 -0
  15. package/dist/PrismaticSectionHeading.svelte.d.ts +28 -0
  16. package/dist/PrismaticSiteFooter.svelte +216 -0
  17. package/dist/PrismaticSiteFooter.svelte.d.ts +44 -0
  18. package/dist/PrismaticSiteHeader.svelte +239 -0
  19. package/dist/PrismaticSiteHeader.svelte.d.ts +43 -0
  20. package/dist/PrismaticStoryCard.svelte +264 -0
  21. package/dist/PrismaticStoryCard.svelte.d.ts +43 -0
  22. package/dist/PrismaticWorkCard.svelte +228 -0
  23. package/dist/PrismaticWorkCard.svelte.d.ts +36 -0
  24. package/dist/Select.svelte +5 -3
  25. package/dist/Select.svelte.d.ts +8 -4
  26. package/dist/TabPanel.svelte +2 -1
  27. package/dist/Tabs.svelte +3 -2
  28. package/dist/const/colorMap.js +8 -9
  29. package/dist/const/config.d.ts +153 -14
  30. package/dist/const/config.js +146 -16
  31. package/dist/const/variables.css +139 -0
  32. package/dist/index.d.ts +9 -1
  33. package/dist/index.js +9 -1
  34. package/dist/scripts/accordionContext.d.ts +1 -1
  35. package/dist/scripts/accordionContext.js +1 -1
  36. package/dist/scripts/date.js +1 -1
  37. package/dist/scripts/tabsContext.d.ts +11 -1
  38. package/dist/scripts/tabsContext.js +1 -1
  39. package/dist/toast.js +23 -37
  40. package/package.json +9 -3
package/README.md CHANGED
@@ -10,6 +10,11 @@ CANDY CHUPS Labのサイトで使うコンポーネントのキットです。
10
10
 
11
11
  このライブラリの開発を行うにはSvelteの導入が必要です。
12
12
 
13
+ ## Svelte互換性
14
+
15
+ `cclkit4svelte` 4.x はSvelte 5専用です。Svelte 4はサポート対象外です。
16
+ 実装方針と段階的な移行ルールは[docs/SVELTE_5_MIGRATION.md](docs/SVELTE_5_MIGRATION.md)を参照してください。
17
+
13
18
  ## Figma
14
19
 
15
20
  [Figma](https://www.figma.com/file/RWLq3IaUeF0soEH666sXQC/Common-Component?type=design&node-id=0%3A1&mode=design&t=ESVNyUtQevAFIe3o-1)
@@ -1,5 +1,7 @@
1
1
  <script lang="ts">
2
2
  import Button from './Button.svelte';
3
+ import { CCLVividColor } from './const/config';
4
+ import type { ColorVar } from './const/config';
3
5
 
4
6
  /**
5
7
  * 書籍のタイトル
@@ -43,7 +45,10 @@
43
45
  * @default --strawberry-pink
44
46
  * @type string
45
47
  */
46
- export let borderColor: string = '--strawberry-pink';
48
+ export let borderColor: string = CCLVividColor.STRAWBERRY_PINK;
49
+ let buttonColor: ColorVar;
50
+ // Preserve support for consumer-defined CSS custom properties at the public boundary.
51
+ $: buttonColor = borderColor as ColorVar;
47
52
 
48
53
  function handleLinkClick() {
49
54
  if (linkUrl) {
@@ -63,7 +68,7 @@
63
68
  </div>
64
69
  {#if linkUrl}
65
70
  <div class="BookCardLinkWrapper">
66
- <Button label={linkText} bgColor={borderColor} onClick={handleLinkClick} />
71
+ <Button label={linkText} bgColor={buttonColor} onClick={handleLinkClick} />
67
72
  </div>
68
73
  {/if}
69
74
  </div>
@@ -44,12 +44,12 @@
44
44
  >
45
45
  <div class="slides">
46
46
  {#each src as item, index}
47
- <img class="slide" src={item.src} alt={item.alt} />
47
+ <img class="slide" src={item.src} alt={item.alt} aria-hidden={index !== currentIndex} />
48
48
  {/each}
49
49
  </div>
50
50
  <div class="buttons">
51
- <button on:click={prevSlide}>❮</button>
52
- <button on:click={nextSlide}>❯</button>
51
+ <button type="button" aria-label="前のスライドへ" on:click={prevSlide}>❮</button>
52
+ <button type="button" aria-label="次のスライドへ" on:click={nextSlide}>❯</button>
53
53
  </div>
54
54
  </div>
55
55
 
@@ -1,3 +1,17 @@
1
+ <script context="module" lang="ts">
2
+ /**
3
+ * 更新履歴の表示項目
4
+ */
5
+ export interface HistoryItem {
6
+ date: string;
7
+ title: string;
8
+ tag?: string;
9
+ color?: string;
10
+ version?: string;
11
+ details?: string[];
12
+ }
13
+ </script>
14
+
1
15
  <script lang="ts">
2
16
  import { CCLVividColor, CCLPastelColor } from './const/config';
3
17
 
@@ -10,15 +24,6 @@
10
24
  * @property {string} [version] - バージョン番号 (例: "v1.1.0")。省略可能
11
25
  * @property {string[]} [details] - 更新内容の詳細なリスト。省略可能
12
26
  */
13
- export interface HistoryItem {
14
- date: string;
15
- title: string;
16
- tag?: string;
17
- color?: string;
18
- version?: string;
19
- details?: string[];
20
- }
21
-
22
27
  /**
23
28
  * 表示する更新履歴の配列
24
29
  * @type {HistoryItem[]}
@@ -1,3 +1,14 @@
1
+ /**
2
+ * 更新履歴の表示項目
3
+ */
4
+ export interface HistoryItem {
5
+ date: string;
6
+ title: string;
7
+ tag?: string;
8
+ color?: string;
9
+ version?: string;
10
+ details?: string[];
11
+ }
1
12
  interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
2
13
  new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
14
  $$bindings?: Bindings;
@@ -1,5 +1,6 @@
1
1
  <script lang="ts">
2
2
  import { createEventDispatcher } from 'svelte';
3
+ import type { Action } from 'svelte/action';
3
4
  import { DateTime } from 'luxon';
4
5
 
5
6
  const dispatch = createEventDispatcher();
@@ -89,7 +90,11 @@
89
90
  * Svelte Action to detect clicks outside an element.
90
91
  * @param {HTMLElement} node
91
92
  */
92
- function clickOutside(node: HTMLElement) {
93
+ const clickOutside: Action<
94
+ HTMLElement,
95
+ undefined,
96
+ { 'on:click_outside': (event: CustomEvent<void>) => void }
97
+ > = (node) => {
93
98
  const handleClick = (event: MouseEvent) => {
94
99
  if (node && !node.contains(event.target as Node) && !event.defaultPrevented) {
95
100
  // 'click_outside' というカスタムイベントを発行
@@ -104,7 +109,7 @@
104
109
  document.removeEventListener('click', handleClick, true);
105
110
  }
106
111
  };
107
- }
112
+ };
108
113
 
109
114
  $: daysInMonth = getDaysInMonth(currentMonth);
110
115
  </script>
@@ -31,7 +31,7 @@ declare const Dialog: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWit
31
31
  */ closeOnOutside?: boolean;
32
32
  /**
33
33
  * アクセント色(境界線やタイトルに使用)
34
- */ borderColor?: any;
34
+ */ borderColor?: "--strawberry-pink" | "--pineapple-yellow" | "--soda-blue" | "--melon-green" | "--grape-purple" | "--wrap-grey";
35
35
  }, {
36
36
  title: {};
37
37
  default: {};
@@ -0,0 +1,115 @@
1
+ <script context="module" lang="ts">
2
+ export type PrismaticAmbientGlowTone =
3
+ | '--peach-pink'
4
+ | '--sugar-blue'
5
+ | '--lemon-yellow'
6
+ | '--akebi-purple';
7
+
8
+ export type PrismaticAmbientGlowSize = 'small' | 'medium' | 'large';
9
+ export type PrismaticAmbientGlowOpacity = 'subtle' | 'standard' | 'strong';
10
+ export type PrismaticAmbientGlowBlur = 'soft' | 'medium' | 'diffuse';
11
+ export type PrismaticAmbientGlowPosition =
12
+ | 'top-left'
13
+ | 'top-right'
14
+ | 'center'
15
+ | 'bottom-left'
16
+ | 'bottom-right';
17
+
18
+ export type PrismaticAmbientGlowProps = {
19
+ tone?: PrismaticAmbientGlowTone;
20
+ size?: PrismaticAmbientGlowSize;
21
+ opacity?: PrismaticAmbientGlowOpacity;
22
+ blur?: PrismaticAmbientGlowBlur;
23
+ position?: PrismaticAmbientGlowPosition;
24
+ };
25
+ </script>
26
+
27
+ <script lang="ts">
28
+ import { CCLPastelColor } from './const/config';
29
+
30
+ const sizes: Record<PrismaticAmbientGlowSize, string> = {
31
+ small: '220px',
32
+ medium: '380px',
33
+ large: '620px'
34
+ };
35
+
36
+ const opacities: Record<PrismaticAmbientGlowOpacity, string> = {
37
+ subtle: '0.28',
38
+ standard: '0.48',
39
+ strong: '0.68'
40
+ };
41
+
42
+ const blurs: Record<PrismaticAmbientGlowBlur, string> = {
43
+ soft: '44px',
44
+ medium: '76px',
45
+ diffuse: '112px'
46
+ };
47
+
48
+ export let tone: PrismaticAmbientGlowTone = CCLPastelColor.PEACH_PINK;
49
+ export let size: PrismaticAmbientGlowSize = 'medium';
50
+ export let opacity: PrismaticAmbientGlowOpacity = 'standard';
51
+ export let blur: PrismaticAmbientGlowBlur = 'medium';
52
+ export let position: PrismaticAmbientGlowPosition = 'center';
53
+
54
+ $: glowSize = sizes[size];
55
+ $: glowOpacity = opacities[opacity];
56
+ $: glowBlur = blurs[blur];
57
+ </script>
58
+
59
+ <!-- The containing block should use position: relative and isolation: isolate. -->
60
+ <span
61
+ class="ambient-glow {position}"
62
+ aria-hidden="true"
63
+ data-testid="prismatic-ambient-glow"
64
+ data-tone={tone}
65
+ data-size={size}
66
+ data-opacity={opacity}
67
+ data-blur={blur}
68
+ data-position={position}
69
+ style="--glow-color: var({tone}); --glow-size: {glowSize}; --glow-opacity: {glowOpacity}; --glow-blur: {glowBlur};"
70
+ ></span>
71
+
72
+ <style>
73
+ .ambient-glow {
74
+ position: absolute;
75
+ z-index: -1;
76
+ display: block;
77
+ width: var(--glow-size);
78
+ height: var(--glow-size);
79
+ border-radius: 50%;
80
+ background: var(--glow-color);
81
+ filter: blur(var(--glow-blur));
82
+ opacity: var(--glow-opacity);
83
+ pointer-events: none;
84
+ }
85
+
86
+ .top-left {
87
+ top: 0;
88
+ left: 0;
89
+ transform: translate(-35%, -35%);
90
+ }
91
+
92
+ .top-right {
93
+ top: 0;
94
+ right: 0;
95
+ transform: translate(35%, -35%);
96
+ }
97
+
98
+ .center {
99
+ top: 50%;
100
+ left: 50%;
101
+ transform: translate(-50%, -50%);
102
+ }
103
+
104
+ .bottom-left {
105
+ bottom: 0;
106
+ left: 0;
107
+ transform: translate(-35%, 35%);
108
+ }
109
+
110
+ .bottom-right {
111
+ right: 0;
112
+ bottom: 0;
113
+ transform: translate(35%, 35%);
114
+ }
115
+ </style>
@@ -0,0 +1,36 @@
1
+ export type PrismaticAmbientGlowTone = '--peach-pink' | '--sugar-blue' | '--lemon-yellow' | '--akebi-purple';
2
+ export type PrismaticAmbientGlowSize = 'small' | 'medium' | 'large';
3
+ export type PrismaticAmbientGlowOpacity = 'subtle' | 'standard' | 'strong';
4
+ export type PrismaticAmbientGlowBlur = 'soft' | 'medium' | 'diffuse';
5
+ export type PrismaticAmbientGlowPosition = 'top-left' | 'top-right' | 'center' | 'bottom-left' | 'bottom-right';
6
+ export type PrismaticAmbientGlowProps = {
7
+ tone?: PrismaticAmbientGlowTone;
8
+ size?: PrismaticAmbientGlowSize;
9
+ opacity?: PrismaticAmbientGlowOpacity;
10
+ blur?: PrismaticAmbientGlowBlur;
11
+ position?: PrismaticAmbientGlowPosition;
12
+ };
13
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
14
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
15
+ $$bindings?: Bindings;
16
+ } & Exports;
17
+ (internal: unknown, props: Props & {
18
+ $$events?: Events;
19
+ $$slots?: Slots;
20
+ }): Exports & {
21
+ $set?: any;
22
+ $on?: any;
23
+ };
24
+ z_$$bindings?: Bindings;
25
+ }
26
+ declare const PrismaticAmbientGlow: $$__sveltets_2_IsomorphicComponent<{
27
+ tone?: PrismaticAmbientGlowTone;
28
+ size?: PrismaticAmbientGlowSize;
29
+ opacity?: PrismaticAmbientGlowOpacity;
30
+ blur?: PrismaticAmbientGlowBlur;
31
+ position?: PrismaticAmbientGlowPosition;
32
+ }, {
33
+ [evt: string]: CustomEvent<any>;
34
+ }, {}, {}, string>;
35
+ type PrismaticAmbientGlow = InstanceType<typeof PrismaticAmbientGlow>;
36
+ export default PrismaticAmbientGlow;
@@ -0,0 +1,175 @@
1
+ <script context="module" lang="ts">
2
+ export type PrismaticBookCardTone =
3
+ | '--strawberry-pink'
4
+ | '--pineapple-yellow'
5
+ | '--soda-blue'
6
+ | '--melon-green'
7
+ | '--grape-purple'
8
+ | '--wrap-grey';
9
+
10
+ export type PrismaticBookCardProps = {
11
+ href?: string;
12
+ linkLabel?: string;
13
+ imageUrl?: string;
14
+ imageAlt?: string;
15
+ tone?: PrismaticBookCardTone;
16
+ };
17
+ </script>
18
+
19
+ <script lang="ts">
20
+ import { CCLPastelColor, CCLVividColor } from './const/config';
21
+ import type { ColorVar } from './const/config';
22
+
23
+ export let href: string | undefined = undefined;
24
+ export let linkLabel: string = 'READ MORE';
25
+ export let imageUrl: string | undefined = undefined;
26
+ export let imageAlt: string = '';
27
+ export let tone: PrismaticBookCardTone = CCLVividColor.STRAWBERRY_PINK;
28
+
29
+ const gradientEndColors: Record<string, ColorVar> = {
30
+ [CCLVividColor.STRAWBERRY_PINK]: CCLPastelColor.LEMON_YELLOW,
31
+ [CCLVividColor.PINEAPPLE_YELLOW]: CCLPastelColor.PEACH_PINK,
32
+ [CCLVividColor.SODA_BLUE]: CCLPastelColor.AKEBI_PURPLE,
33
+ [CCLVividColor.MELON_GREEN]: CCLPastelColor.SUGAR_BLUE,
34
+ [CCLVividColor.GRAPE_PURPLE]: CCLPastelColor.LEMON_YELLOW,
35
+ [CCLVividColor.WRAP_GREY]: CCLPastelColor.SUGAR_BLUE
36
+ };
37
+ const linkElement = 'a';
38
+
39
+ $: gradientStart = `var(${tone})`;
40
+ $: gradientEnd = `var(${gradientEndColors[tone] ?? CCLPastelColor.LEMON_YELLOW})`;
41
+ $: accentColor = `var(${tone})`;
42
+ </script>
43
+
44
+ <article
45
+ class="prismatic-book-card"
46
+ style="--gradient-start: {gradientStart}; --gradient-end: {gradientEnd}; --accent-color: {accentColor};"
47
+ >
48
+ <div class="cover-slot" aria-label={imageUrl ? undefined : imageAlt || undefined}>
49
+ {#if imageUrl}
50
+ <img class="cover-image" src={imageUrl} alt={imageAlt} />
51
+ {:else}
52
+ <slot name="image">
53
+ <span class="cover-fallback" aria-hidden="true"></span>
54
+ </slot>
55
+ {/if}
56
+ </div>
57
+
58
+ {#if href}
59
+ <svelte:element
60
+ this={linkElement}
61
+ class="link"
62
+ {href}
63
+ target="_blank"
64
+ rel="noopener noreferrer"
65
+ >
66
+ <span>{linkLabel}</span>
67
+ <svg class="link-icon" viewBox="0 0 16 16" aria-hidden="true" focusable="false">
68
+ <path d="M5 3.5L9.5 8L5 12.5" />
69
+ <path d="M9 8H2.5" />
70
+ </svg>
71
+ </svelte:element>
72
+ {:else}
73
+ <span class="link-label">
74
+ <span>{linkLabel}</span>
75
+ <svg class="link-icon" viewBox="0 0 16 16" aria-hidden="true" focusable="false">
76
+ <path d="M5 3.5L9.5 8L5 12.5" />
77
+ <path d="M9 8H2.5" />
78
+ </svg>
79
+ </span>
80
+ {/if}
81
+ </article>
82
+
83
+ <style>
84
+ .prismatic-book-card {
85
+ display: flex;
86
+ flex-direction: column;
87
+ align-items: flex-start;
88
+ gap: 20px;
89
+ width: min(100%, 300px);
90
+ height: 500px;
91
+ box-sizing: border-box;
92
+ padding: 24px;
93
+ border: 1.5px solid color-mix(in srgb, var(--gradient-end) 60%, transparent);
94
+ border-radius: 34px;
95
+ background: color-mix(in srgb, var(--color-surface-glass) 82%, transparent);
96
+ font-family: Inter, sans-serif;
97
+ letter-spacing: 0;
98
+ }
99
+
100
+ .cover-slot {
101
+ position: relative;
102
+ display: flex;
103
+ align-items: center;
104
+ justify-content: center;
105
+ width: 100%;
106
+ height: 360px;
107
+ overflow: hidden;
108
+ border-radius: 18px;
109
+ background: linear-gradient(90deg, var(--gradient-start), var(--gradient-end));
110
+ }
111
+
112
+ .cover-image,
113
+ .cover-fallback {
114
+ display: block;
115
+ width: 100%;
116
+ height: 100%;
117
+ }
118
+
119
+ .cover-image,
120
+ .cover-slot :global(img),
121
+ .cover-slot :global(video) {
122
+ display: block;
123
+ width: 100%;
124
+ height: 100%;
125
+ object-fit: cover;
126
+ }
127
+
128
+ .link,
129
+ .link-label {
130
+ display: inline-flex;
131
+ align-items: center;
132
+ gap: 6px;
133
+ width: fit-content;
134
+ max-width: 100%;
135
+ color: var(--accent-color);
136
+ font-size: 13px;
137
+ font-weight: 700;
138
+ line-height: normal;
139
+ text-decoration: none;
140
+ overflow-wrap: anywhere;
141
+ }
142
+
143
+ .link-icon {
144
+ display: block;
145
+ flex: 0 0 16px;
146
+ width: 16px;
147
+ height: 16px;
148
+ fill: none;
149
+ stroke: currentColor;
150
+ stroke-width: 1.8;
151
+ stroke-linecap: round;
152
+ stroke-linejoin: round;
153
+ }
154
+
155
+ .link:hover {
156
+ text-decoration: underline;
157
+ }
158
+
159
+ .link:focus-visible {
160
+ outline: 3px solid color-mix(in srgb, var(--accent-color) 42%, Canvas);
161
+ outline-offset: 4px;
162
+ }
163
+
164
+ @media (max-width: 320px) {
165
+ .prismatic-book-card {
166
+ height: auto;
167
+ min-height: 500px;
168
+ }
169
+
170
+ .cover-slot {
171
+ height: auto;
172
+ aspect-ratio: 7 / 10;
173
+ }
174
+ }
175
+ </style>
@@ -0,0 +1,34 @@
1
+ export type PrismaticBookCardTone = '--strawberry-pink' | '--pineapple-yellow' | '--soda-blue' | '--melon-green' | '--grape-purple' | '--wrap-grey';
2
+ export type PrismaticBookCardProps = {
3
+ href?: string;
4
+ linkLabel?: string;
5
+ imageUrl?: string;
6
+ imageAlt?: string;
7
+ tone?: PrismaticBookCardTone;
8
+ };
9
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
10
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
11
+ $$bindings?: Bindings;
12
+ } & Exports;
13
+ (internal: unknown, props: Props & {
14
+ $$events?: Events;
15
+ $$slots?: Slots;
16
+ }): Exports & {
17
+ $set?: any;
18
+ $on?: any;
19
+ };
20
+ z_$$bindings?: Bindings;
21
+ }
22
+ declare const PrismaticBookCard: $$__sveltets_2_IsomorphicComponent<{
23
+ href?: string | undefined;
24
+ linkLabel?: string;
25
+ imageUrl?: string | undefined;
26
+ imageAlt?: string;
27
+ tone?: PrismaticBookCardTone;
28
+ }, {
29
+ [evt: string]: CustomEvent<any>;
30
+ }, {
31
+ image: {};
32
+ }, {}, string>;
33
+ type PrismaticBookCard = InstanceType<typeof PrismaticBookCard>;
34
+ export default PrismaticBookCard;