@3birds/midori-ui 0.0.50 → 0.0.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/auth.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- export declare function signIn(email: string, password: string): Promise<boolean>;
2
- export declare function signUp(email: string, password: string): Promise<boolean>;
3
- export declare function resetPassword(email: string): Promise<boolean>;
1
+ export declare function signIn(email: string, password: string): Promise<void>;
2
+ export declare function signUp(email: string, password: string): Promise<void>;
3
+ export declare function resetPassword(email: string): Promise<void>;
4
4
  export declare function signOut(): Promise<void>;
5
5
  export declare function toSigninErrorMessage(code: string): string;
6
6
  export declare function toSignupErrorMessage(code: string): string;
package/dist/auth.js CHANGED
@@ -1,34 +1,27 @@
1
1
  import { signInWithEmailAndPassword, createUserWithEmailAndPassword, sendPasswordResetEmail, signOut as firebaseSignOut } from 'firebase/auth';
2
2
  import { auth } from './firebase';
3
- import { alert } from './alert';
4
3
  export async function signIn(email, password) {
5
4
  try {
6
5
  await signInWithEmailAndPassword(auth, email, password);
7
- return true;
8
6
  }
9
7
  catch (e) {
10
- alert.trigger(toSigninErrorMessage(e.code), 'error', 10000);
11
- return false;
8
+ throw new Error(toSigninErrorMessage(e.code));
12
9
  }
13
10
  }
14
11
  export async function signUp(email, password) {
15
12
  try {
16
13
  await createUserWithEmailAndPassword(auth, email, password);
17
- return true;
18
14
  }
19
15
  catch (e) {
20
- alert.trigger(toSignupErrorMessage(e.code), 'error', 10000);
21
- return false;
16
+ throw new Error(toSigninErrorMessage(e.code));
22
17
  }
23
18
  }
24
19
  export async function resetPassword(email) {
25
20
  try {
26
21
  await sendPasswordResetEmail(auth, email);
27
- return true;
28
22
  }
29
23
  catch (e) {
30
- alert.trigger(toResetPasswordErrorMessage(e.code), 'error', 10000);
31
- return false;
24
+ throw new Error(toSigninErrorMessage(e.code));
32
25
  }
33
26
  }
34
27
  export async function signOut() {
@@ -0,0 +1,59 @@
1
+ <script lang="ts" module>
2
+ let scriptPromise: Promise<void> | undefined;
3
+
4
+ const loadAdsense = (client: string): Promise<void> => {
5
+ if (scriptPromise) return scriptPromise;
6
+
7
+ scriptPromise = new Promise<void>((resolve, reject) => {
8
+ const script = document.createElement('script');
9
+ script.async = true;
10
+ script.crossOrigin = 'anonymous';
11
+ script.src = `https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=${client}`;
12
+ script.onload = () => resolve();
13
+ script.onerror = () => {
14
+ scriptPromise = undefined; // 広告ブロッカー等で失敗しても、再試行できるようにする
15
+ reject(new Error('AdSense の読み込みに失敗しました'));
16
+ };
17
+ document.head.appendChild(script);
18
+ });
19
+
20
+ return scriptPromise;
21
+ };
22
+ </script>
23
+
24
+ <script lang="ts">
25
+ import { onMount } from 'svelte';
26
+ import { dev } from '$app/environment';
27
+ import { PUBLIC_ADSENSE_CLIENT } from '$env/static/public';
28
+
29
+ let {
30
+ slot = '8044265066',
31
+ format = 'auto',
32
+ responsive = 'false',
33
+ class: className
34
+ }: {
35
+ slot?: string;
36
+ format?: string;
37
+ responsive?: 'true' | 'false';
38
+ class?: string;
39
+ } = $props();
40
+
41
+ onMount(async () => {
42
+ try {
43
+ await loadAdsense(PUBLIC_ADSENSE_CLIENT);
44
+ (window.adsbygoogle = window.adsbygoogle || []).push({});
45
+ } catch (e) {
46
+ console.warn(e);
47
+ }
48
+ });
49
+ </script>
50
+
51
+ <ins
52
+ class="adsbygoogle {className}"
53
+ style="display:block"
54
+ data-ad-client={PUBLIC_ADSENSE_CLIENT}
55
+ data-ad-slot={slot}
56
+ data-ad-format={format}
57
+ data-full-width-responsive={responsive}
58
+ data-adtest={dev ? 'on' : undefined}
59
+ ></ins>
@@ -0,0 +1,9 @@
1
+ type $$ComponentProps = {
2
+ slot?: string;
3
+ format?: string;
4
+ responsive?: 'true' | 'false';
5
+ class?: string;
6
+ };
7
+ declare const AdsenseAd: import("svelte").Component<$$ComponentProps, {}, "">;
8
+ type AdsenseAd = ReturnType<typeof AdsenseAd>;
9
+ export default AdsenseAd;
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- import { Btn, closeSvg, Img, type ContentGeo } from '..';
2
+ import { Btn, closeSvg, Img, type ContentGeo } from '@3birds/midori-ui';
3
3
 
4
4
  let {
5
5
  content,
@@ -12,17 +12,19 @@
12
12
  } = $props();
13
13
  </script>
14
14
 
15
- <a
16
- class="card fixed right-22 bottom-4 left-4 z-20 mx-auto card-side h-32 max-w-sm rounded-3xl bg-base-100 shadow-sm card-sm sm:right-4"
17
- href="/contents/{content.id}{searchParams}"
18
- >
19
- <Btn class="absolute top-2 right-2 btn-circle btn-sm" onclick={onClickClose}>
15
+ <div class="fixed right-22 bottom-4 left-4 z-20 mx-auto h-32 max-w-sm sm:right-4">
16
+ <Btn class="absolute top-2 right-2 z-20 btn-circle btn-sm" onclick={onClickClose}>
20
17
  <Img src={closeSvg} alt="削除" class="size-4" />
21
18
  </Btn>
22
- <figure class="aspect-1">
23
- <Img src={content.thumbnail} alt={content.name} class="h-full w-full object-cover" />
24
- </figure>
25
- <div class="card-body justify-center">
26
- <h2 class="card-title">{content.name}</h2>
27
- </div>
28
- </a>
19
+ <a
20
+ class="card card-side h-full w-full rounded-3xl bg-base-100 shadow-sm card-sm"
21
+ href="/contents/{content.id}{searchParams}"
22
+ >
23
+ <figure class="aspect-1">
24
+ <Img src={content.thumbnail} alt={content.name} class="h-full w-full object-cover" />
25
+ </figure>
26
+ <div class="card-body justify-center">
27
+ <h2 class="card-title">{content.name}</h2>
28
+ </div>
29
+ </a>
30
+ </div>
@@ -1,4 +1,4 @@
1
- import { type ContentGeo } from '..';
1
+ import { type ContentGeo } from '@3birds/midori-ui';
2
2
  type $$ComponentProps = {
3
3
  content: ContentGeo;
4
4
  searchParams?: string;
@@ -0,0 +1,16 @@
1
+ <script lang="ts">
2
+ let {
3
+ children,
4
+ checked = $bindable(false),
5
+ class: className
6
+ }: {
7
+ children: import('svelte').Snippet;
8
+ checked: boolean;
9
+ class?: string;
10
+ } = $props();
11
+ </script>
12
+
13
+ <label class="label">
14
+ <input type="checkbox" class="checkbox {className}" bind:checked />
15
+ {@render children()}
16
+ </label>
@@ -0,0 +1,8 @@
1
+ type $$ComponentProps = {
2
+ children: import('svelte').Snippet;
3
+ checked: boolean;
4
+ class?: string;
5
+ };
6
+ declare const Checkbox: import("svelte").Component<$$ComponentProps, {}, "checked">;
7
+ type Checkbox = ReturnType<typeof Checkbox>;
8
+ export default Checkbox;
@@ -1,4 +1,5 @@
1
1
  <script lang="ts">
2
+ import { page as pageState } from '$app/state';
2
3
  import { Btn } from '@3birds/midori-ui';
3
4
 
4
5
  let {
@@ -8,22 +9,23 @@
8
9
  class: className
9
10
  }: { value: number; per: number; deadend: boolean; class?: string } = $props();
10
11
 
11
- const onClickPrev = () => {
12
- value--;
13
- window.scrollTo({ top: 0, behavior: 'smooth' });
14
- };
12
+ const generatePaginationHref = (value: number): string => {
13
+ const searchParams: URLSearchParams = new URLSearchParams(pageState.url.searchParams);
14
+
15
+ searchParams.set('page', value.toString());
15
16
 
16
- const onClickNext = () => {
17
- value++;
18
- window.scrollTo({ top: 0, behavior: 'smooth' });
17
+ return `${pageState.url.pathname}?${searchParams.toString()}`;
19
18
  };
19
+
20
+ const prevHref = $derived(value === 1 ? '' : generatePaginationHref(value - 1));
21
+ const nextHref = $derived(deadend ? '' : generatePaginationHref(value + 1));
20
22
  </script>
21
23
 
22
24
  <div class="join col-span-8 col-start-3 grid grid-cols-2 {className}">
23
- <Btn class="join-item rounded-r-none btn-outline" disabled={value === 1} onclick={onClickPrev}
25
+ <Btn class="join-item rounded-r-none btn-outline" href={prevHref} disabled={value === 1}
24
26
  >前の{per}件</Btn
25
27
  >
26
- <Btn class="join-item rounded-l-none btn-outline" disabled={deadend} onclick={onClickNext}
28
+ <Btn class="join-item rounded-l-none btn-outline" disabled={deadend} href={nextHref}
27
29
  >次の{per}件</Btn
28
30
  >
29
31
  </div>
@@ -2,8 +2,11 @@ import type { PriorityChoice } from '../types';
2
2
  import type { PointExpression } from 'leaflet';
3
3
  export declare const MAP_ATTRIBUTION: string;
4
4
  export declare const MAP_DEFAULT_ICON_SIZE: PointExpression;
5
+ export declare const MAP_DEFAULT_MYLOCATION_ICON_SIZE: PointExpression;
5
6
  export declare const MAP_DEFAULT_ICON_ANCHOR: PointExpression;
7
+ export declare const MAP_DEFAULT_MYLOCATION_ICON_ANCHOR: PointExpression;
6
8
  export declare const MAP_MAX_ZOOM: number;
9
+ export declare const MAP_DEFAULT_MYLOCATION_ZOOM: number;
7
10
  export declare const MAP_DEFAULT_LATITUDE: number;
8
11
  export declare const MAP_DEFAULT_LONGITUDE: number;
9
12
  export declare const PRIORITIES: PriorityChoice[];
@@ -1,7 +1,10 @@
1
1
  export const MAP_ATTRIBUTION = '<a href="https://github.com/protomaps/basemaps">Protomaps</a> © <a href="https://openstreetmap.org">OpenStreetMap</a>';
2
2
  export const MAP_DEFAULT_ICON_SIZE = [20, 20];
3
+ export const MAP_DEFAULT_MYLOCATION_ICON_SIZE = [18, 18];
3
4
  export const MAP_DEFAULT_ICON_ANCHOR = [10, 10];
5
+ export const MAP_DEFAULT_MYLOCATION_ICON_ANCHOR = [9, 9];
4
6
  export const MAP_MAX_ZOOM = 20;
7
+ export const MAP_DEFAULT_MYLOCATION_ZOOM = 15;
5
8
  export const MAP_DEFAULT_LATITUDE = 35.658;
6
9
  export const MAP_DEFAULT_LONGITUDE = 139.745;
7
10
  export const PRIORITIES = [
package/dist/index.d.ts CHANGED
@@ -14,6 +14,8 @@ export { default as Img } from './components/Img.svelte';
14
14
  export { default as Map } from './components/Map.svelte';
15
15
  export { default as Range } from './components/Range.svelte';
16
16
  export { default as Textarea } from './components/Textarea.svelte';
17
+ export { default as AdsenseAd } from './components/AdsenseAd.svelte';
18
+ export { default as Checkbox } from './components/Checkbox.svelte';
17
19
  export { default as accountSvg } from './assets/account.svg';
18
20
  export { default as alertSvg } from './assets/alert.svg';
19
21
  export { default as calendarMonthSvg } from './assets/calendar-month.svg';
@@ -254,5 +256,5 @@ export { auth } from './firebase';
254
256
  export * as modal from './modals-context.ts';
255
257
  export * from './utils/index.ts';
256
258
  export { image } from './image.ts';
257
- export { MAP_ATTRIBUTION, MAP_DEFAULT_ICON_SIZE, PRIORITIES, RATING_OPTIONS, MAP_DEFAULT_ICON_ANCHOR, MAP_MAX_ZOOM, MAP_DEFAULT_LATITUDE, MAP_DEFAULT_LONGITUDE, PRIORITIES_WITHOUT_LOG, PREFECTURE_SVG, POI_ICON } from './constants/index.ts';
258
- export type { BtnType, InputType, AlertType, ImageType, AlertState, BreadcrumbsItem, FilterItem, Priority, PriorityChoice, ModalsContext, Data, ContentAdditionalInfo, ContentAdmin, ContentImage, ContentReview, ContentMinimal, ContentCasual, ContentFormal, ContentGeo, ContentChildren, ContentReviews, Account, Dashboard, DashboardPref } from './types/index.ts';
259
+ export { MAP_ATTRIBUTION, MAP_DEFAULT_ICON_SIZE, PRIORITIES, RATING_OPTIONS, MAP_DEFAULT_ICON_ANCHOR, MAP_MAX_ZOOM, MAP_DEFAULT_LATITUDE, MAP_DEFAULT_LONGITUDE, PRIORITIES_WITHOUT_LOG, PREFECTURE_SVG, POI_ICON, MAP_DEFAULT_MYLOCATION_ICON_ANCHOR, MAP_DEFAULT_MYLOCATION_ICON_SIZE, MAP_DEFAULT_MYLOCATION_ZOOM } from './constants/index.ts';
260
+ export type { BtnType, InputType, AlertType, ImageType, AlertState, BreadcrumbsItem, FilterItem, Priority, PriorityChoice, ModalsContext, Data, ContentAdditionalInfo, ContentAdmin, ContentImage, ContentReview, ContentMinimal, ContentCasual, ContentFormal, ContentGeo, ContentChildren, ContentReviews, Notice, Dashboard, DashboardPref } from './types/index.ts';
package/dist/index.js CHANGED
@@ -15,6 +15,8 @@ export { default as Img } from './components/Img.svelte';
15
15
  export { default as Map } from './components/Map.svelte';
16
16
  export { default as Range } from './components/Range.svelte';
17
17
  export { default as Textarea } from './components/Textarea.svelte';
18
+ export { default as AdsenseAd } from './components/AdsenseAd.svelte';
19
+ export { default as Checkbox } from './components/Checkbox.svelte';
18
20
  export { default as accountSvg } from './assets/account.svg';
19
21
  export { default as alertSvg } from './assets/alert.svg';
20
22
  export { default as calendarMonthSvg } from './assets/calendar-month.svg';
@@ -255,4 +257,4 @@ export { auth } from './firebase';
255
257
  export * as modal from "./modals-context.js";
256
258
  export * from "./utils/index.js";
257
259
  export { image } from "./image.js";
258
- export { MAP_ATTRIBUTION, MAP_DEFAULT_ICON_SIZE, PRIORITIES, RATING_OPTIONS, MAP_DEFAULT_ICON_ANCHOR, MAP_MAX_ZOOM, MAP_DEFAULT_LATITUDE, MAP_DEFAULT_LONGITUDE, PRIORITIES_WITHOUT_LOG, PREFECTURE_SVG, POI_ICON } from "./constants/index.js";
260
+ export { MAP_ATTRIBUTION, MAP_DEFAULT_ICON_SIZE, PRIORITIES, RATING_OPTIONS, MAP_DEFAULT_ICON_ANCHOR, MAP_MAX_ZOOM, MAP_DEFAULT_LATITUDE, MAP_DEFAULT_LONGITUDE, PRIORITIES_WITHOUT_LOG, PREFECTURE_SVG, POI_ICON, MAP_DEFAULT_MYLOCATION_ICON_ANCHOR, MAP_DEFAULT_MYLOCATION_ICON_SIZE, MAP_DEFAULT_MYLOCATION_ZOOM } from "./constants/index.js";
@@ -31,6 +31,7 @@ export interface Data<T> {
31
31
  status: number;
32
32
  data?: T;
33
33
  message?: string;
34
+ meta?: string;
34
35
  }
35
36
  export interface ContentImage {
36
37
  src: string;
@@ -119,20 +120,12 @@ export interface ContentChildren extends ContentAttribute {
119
120
  export interface ContentReviews extends ContentAttribute {
120
121
  reviews: ContentReview[];
121
122
  }
122
- export interface Account {
123
+ export interface Notice {
123
124
  id: string;
124
- photo?: string;
125
- email: string;
126
- password: string;
127
- stripe_customer_id: string;
128
- plan_id: string;
129
- nickname: string;
130
- management_condition: ManagementCondition;
131
- }
132
- interface ManagementCondition {
133
- content_review_ids: string[];
134
- favorite_content_ids: string[];
135
- ads: boolean;
125
+ pinned: boolean;
126
+ updated_at: string;
127
+ title: string;
128
+ body: string;
136
129
  }
137
130
  export interface Dashboard {
138
131
  hot_contents: ContentCasual[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@3birds/midori-ui",
3
- "version": "0.0.50",
3
+ "version": "0.0.52",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite dev",