@3birds/midori-ui 0.0.41 → 0.0.42

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.
@@ -16,7 +16,7 @@
16
16
  <p class="text-sm text-base-content/60">絞り込み:</p>
17
17
  {#each items as item}
18
18
  <input
19
- class="btn m-0.5 rounded-full btn-outline btn-sm"
19
+ class="btn m-0.5 rounded-full bg-base-100 btn-outline btn-sm"
20
20
  type="checkbox"
21
21
  name="frameworks"
22
22
  aria-label={item.label}
@@ -1,4 +1,10 @@
1
1
  import type { PriorityChoice } from '../types';
2
+ export declare const MAP_ATTRIBUTION: string;
3
+ export declare const MAP_DEFAULT_ICON_SIZE: number[];
4
+ export declare const MAP_DEFAULT_ICON_ANCHOR: number[];
5
+ export declare const MAP_MAX_ZOOM: number;
6
+ export declare const MAP_DEFAULT_LATITUDE: number;
7
+ export declare const MAP_DEFAULT_LONGITUDE: number;
2
8
  export declare const PRIORITIES: PriorityChoice[];
3
9
  export declare const PRIORITIES_WITHOUT_LOG: PriorityChoice[];
4
10
  export declare const PREFECTURE_SVG: Record<string, string>;
@@ -1,3 +1,9 @@
1
+ export const MAP_ATTRIBUTION = '<a href="https://github.com/protomaps/basemaps">Protomaps</a> © <a href="https://openstreetmap.org">OpenStreetMap</a>';
2
+ export const MAP_DEFAULT_ICON_SIZE = [20, 20];
3
+ export const MAP_DEFAULT_ICON_ANCHOR = [10, 10];
4
+ export const MAP_MAX_ZOOM = 20;
5
+ export const MAP_DEFAULT_LATITUDE = 35.658;
6
+ export const MAP_DEFAULT_LONGITUDE = 139.745;
1
7
  export const PRIORITIES = [
2
8
  { label: 'フィールド', value: '50' },
3
9
  { label: 'イベント', value: '40' },
package/dist/index.d.ts CHANGED
@@ -247,5 +247,6 @@ export { authState } from './auth.svelte.ts';
247
247
  export * as firebase from './auth';
248
248
  export { auth } from './firebase';
249
249
  export * as modal from './modals-context.ts';
250
+ export * from './utils/index.ts';
250
251
  export { PRIORITIES, PRIORITIES_WITHOUT_LOG, PREFECTURE_SVG, POI_ICON } from './constants/index.ts';
251
- export type { BtnType, InputType, AlertType, AlertState, BreadcrumbsItem, FilterItem, Priority, PriorityChoice, ModalsContext, Data, ContentCasual, ContentGeo, Dashboard, DashboardPref } from './types/index.ts';
252
+ export type { BtnType, InputType, AlertType, AlertState, BreadcrumbsItem, FilterItem, Priority, PriorityChoice, ModalsContext, Data, ContentAdditionalInfo, ContentAdmin, ContentImage, ContentReview, ContentMinimal, ContentCasual, ContentFormal, ContentGeo, Dashboard, DashboardPref } from './types/index.ts';
package/dist/index.js CHANGED
@@ -248,4 +248,5 @@ export { authState } from "./auth.svelte.js";
248
248
  export * as firebase from './auth';
249
249
  export { auth } from './firebase';
250
250
  export * as modal from "./modals-context.js";
251
+ export * from "./utils/index.js";
251
252
  export { PRIORITIES, PRIORITIES_WITHOUT_LOG, PREFECTURE_SVG, POI_ICON } from "./constants/index.js";
@@ -31,6 +31,33 @@ export interface Data<T> {
31
31
  data?: T;
32
32
  message?: string;
33
33
  }
34
+ export interface ContentImage {
35
+ src: string;
36
+ credit: string;
37
+ link: string;
38
+ }
39
+ export interface ContentAdditionalInfo {
40
+ title: string;
41
+ body: string;
42
+ }
43
+ export interface ContentReview {
44
+ rating: number;
45
+ body: string;
46
+ photo?: string;
47
+ content_id: string;
48
+ content_name: string;
49
+ reviewer_nickname: string;
50
+ reviewer_icon?: string;
51
+ }
52
+ export interface ContentMinimal {
53
+ id: string;
54
+ name: string;
55
+ }
56
+ export interface ContentAdmin {
57
+ name: string;
58
+ midori: boolean;
59
+ photo?: string;
60
+ }
34
61
  export interface ContentCasual {
35
62
  id: string;
36
63
  name: string;
@@ -42,6 +69,34 @@ export interface ContentCasual {
42
69
  rate_average: number;
43
70
  schedules: string[];
44
71
  }
72
+ export interface ContentFormal {
73
+ id: string;
74
+ name: string;
75
+ latitude: number;
76
+ longitude: number;
77
+ map_zoom_level: number;
78
+ marker_color: string;
79
+ marker_icon: string;
80
+ address: string;
81
+ overview: string;
82
+ hp: string;
83
+ x: string;
84
+ instagram: string;
85
+ facebook: string;
86
+ images: ContentImage[];
87
+ parents: ContentMinimal[];
88
+ rate_average: number;
89
+ review_count: number;
90
+ schedules: string[];
91
+ fields: ContentCasual[];
92
+ events: ContentCasual[];
93
+ contents: ContentCasual[];
94
+ amenities: ContentCasual[];
95
+ logs: ContentCasual[];
96
+ additional_infos: ContentAdditionalInfo[];
97
+ reviews: ContentReview[];
98
+ admins: ContentAdmin[];
99
+ }
45
100
  export interface ContentGeo {
46
101
  latitude: number;
47
102
  longitude: number;
@@ -0,0 +1,7 @@
1
+ export declare const yen: (amount: number) => string;
2
+ export declare const withoutFormatText: (text?: string) => string;
3
+ export declare const autoFormatText: (text: string) => string;
4
+ export declare const date: (datetime: string) => string;
5
+ export declare const datetime: (datetime: string) => string;
6
+ export declare const datetimeForInput: (datetime: string) => string;
7
+ export declare const truncateWithEllipsis: (text: string, maxLength: number) => string;
@@ -0,0 +1,69 @@
1
+ export const yen = (amount) => `${amount.toLocaleString()}円`;
2
+ const processCustomMarkup = (text, type, replacer) => {
3
+ let pattern;
4
+ switch (type) {
5
+ case 'link':
6
+ pattern = /@link\[([^\]]*)\]\(([^\)]*)\)/g;
7
+ break;
8
+ case 'bold':
9
+ pattern = /@bold\[([^\]]*)\]/g;
10
+ break;
11
+ case 'small':
12
+ pattern = /@small\[([^\]]*)\]/g;
13
+ break;
14
+ }
15
+ return text.replace(pattern, (_, display, link) => replacer(display, link));
16
+ };
17
+ const stripCustomMarkup = (text, type) => {
18
+ return processCustomMarkup(text, type, (display) => display);
19
+ };
20
+ export const withoutFormatText = (text) => {
21
+ if (!text)
22
+ return '';
23
+ text = stripCustomMarkup(text, 'link');
24
+ text = stripCustomMarkup(text, 'bold');
25
+ text = stripCustomMarkup(text, 'small');
26
+ return text.replace(/\s+/g, '');
27
+ };
28
+ export const autoFormatText = (text) => {
29
+ text = escapeHtml(text);
30
+ text = processCustomMarkup(text, 'link', (display, link) => `<a href="${sanitizeUrl(link)}" target="_blank" rel="noopener noreferrer" class="link">${display}</a>`);
31
+ text = processCustomMarkup(text, 'bold', (display) => `<span class="font-bold">${display}</span>`);
32
+ text = processCustomMarkup(text, 'small', (display) => `<span class="text-xs">${display}</span>`);
33
+ return text;
34
+ };
35
+ export const date = (datetime) => {
36
+ return datetime.slice(0, 10).replace(/-/g, '/');
37
+ };
38
+ export const datetime = (datetime) => {
39
+ return datetime.slice(0, 16).replace(/-/g, '/').replace('T', ' ');
40
+ };
41
+ export const datetimeForInput = (datetime) => {
42
+ return datetime.slice(0, 16);
43
+ };
44
+ export const truncateWithEllipsis = (text, maxLength) => {
45
+ return text.length > maxLength ? `${text.slice(0, maxLength)}…` : text;
46
+ };
47
+ const escapeHtml = (text) => text
48
+ .replace(/&/g, '&amp;')
49
+ .replace(/</g, '&lt;')
50
+ .replace(/>/g, '&gt;')
51
+ .replace(/"/g, '&quot;')
52
+ .replace(/'/g, '&#39;');
53
+ const unescapeHtml = (text) => text
54
+ .replace(/&amp;/g, '&')
55
+ .replace(/&lt;/g, '<')
56
+ .replace(/&gt;/g, '>')
57
+ .replace(/&quot;/g, '"')
58
+ .replace(/&#39;/g, "'");
59
+ const sanitizeUrl = (url) => {
60
+ try {
61
+ const parsed = new URL(unescapeHtml(url));
62
+ if (parsed.protocol === 'http:' || parsed.protocol === 'https:')
63
+ return parsed.href;
64
+ }
65
+ catch {
66
+ // 不正なURL形式
67
+ }
68
+ return '#';
69
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@3birds/midori-ui",
3
- "version": "0.0.41",
3
+ "version": "0.0.42",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite dev",