nuxt-hs-ui 1.0.10 → 2.0.2

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 (112) hide show
  1. package/README.md +11 -4
  2. package/dist/module.d.mts +10 -2
  3. package/dist/module.d.ts +10 -2
  4. package/dist/module.json +5 -2
  5. package/dist/module.mjs +90 -51
  6. package/dist/runtime/assets/flatpickr-dark.css +1 -0
  7. package/dist/runtime/assets/flatpickr-month-select-style.css +1 -0
  8. package/dist/runtime/assets/tabulator-custom.css +1 -0
  9. package/dist/runtime/assets/tabulator.css +1 -0
  10. package/dist/runtime/assets/vue-select.css +1 -0
  11. package/dist/runtime/components/{hs-fc/btn/line-loading.vue → form/btn-line-loading.vue} +28 -42
  12. package/dist/runtime/components/form/btn.vue +488 -0
  13. package/dist/runtime/components/form/check-box.vue +352 -0
  14. package/dist/runtime/components/form/check-list.vue +354 -0
  15. package/dist/runtime/components/form/datepicker copy.vue +770 -0
  16. package/dist/runtime/components/form/datepicker.vue +897 -0
  17. package/dist/runtime/components/form/input-frame.vue +272 -0
  18. package/dist/runtime/components/form/radio.vue +685 -0
  19. package/dist/runtime/components/form/select-img-icon.vue +53 -0
  20. package/dist/runtime/components/form/select.vue +438 -0
  21. package/dist/runtime/components/form/text-box.vue +375 -0
  22. package/dist/runtime/components/form/textarea.vue +466 -0
  23. package/dist/runtime/components/form/value-box.vue +681 -0
  24. package/dist/runtime/components/interactive/alert.vue +113 -0
  25. package/dist/runtime/components/{hs-ui → interactive}/block-loading.vue +42 -59
  26. package/dist/runtime/components/{hs-ui/dialog/index.vue → interactive/dialog.vue} +132 -127
  27. package/dist/runtime/components/interactive/modal-bg.vue +82 -0
  28. package/dist/runtime/components/interactive/modal.vue +143 -0
  29. package/dist/runtime/components/{hs-ui/toast/index.vue → interactive/toast.vue} +76 -109
  30. package/dist/runtime/components/{hs-ui → interactive}/window-loader.vue +12 -9
  31. package/dist/runtime/components/{hs-ui → layout}/accordion.vue +21 -30
  32. package/dist/runtime/components/layout/aspect-box.vue +71 -0
  33. package/dist/runtime/components/layout/card-item.vue +193 -0
  34. package/dist/runtime/components/layout/card.vue +42 -0
  35. package/dist/runtime/components/layout/container.vue +40 -0
  36. package/dist/runtime/components/misc/breadcrumb.vue +96 -0
  37. package/dist/runtime/components/misc/tabulator.vue +187 -0
  38. package/dist/runtime/components/misc/view-name-display-target.vue +39 -0
  39. package/dist/runtime/components/misc/view-name-display.vue +90 -0
  40. package/dist/runtime/composables/use-hs-dialog.d.ts +40 -0
  41. package/dist/runtime/composables/{use-hs-ui-dialog.js → use-hs-dialog.js} +15 -10
  42. package/dist/runtime/composables/{use-hs-form-focus.d.ts → use-hs-focus.d.ts} +1 -1
  43. package/dist/runtime/composables/{use-hs-form-focus.js → use-hs-focus.js} +2 -4
  44. package/dist/runtime/composables/use-hs-misc.d.ts +22 -0
  45. package/dist/runtime/composables/use-hs-misc.js +62 -0
  46. package/dist/runtime/composables/use-hs-modal.d.ts +31 -0
  47. package/dist/runtime/{components/hs-ui/modal/use-ui-modal.js → composables/use-hs-modal.js} +18 -16
  48. package/dist/runtime/composables/use-hs-multi-lang.d.ts +14 -6
  49. package/dist/runtime/composables/use-hs-multi-lang.js +44 -11
  50. package/dist/runtime/composables/{use-hs-ui-toast.d.ts → use-hs-toast.d.ts} +3 -3
  51. package/dist/runtime/composables/{use-hs-ui-toast.js → use-hs-toast.js} +4 -5
  52. package/dist/runtime/composables/{use-hs-ui-window-loader.d.ts → use-hs-window-loader.d.ts} +1 -1
  53. package/dist/runtime/composables/{use-hs-ui-window-loader.js → use-hs-window-loader.js} +1 -2
  54. package/dist/runtime/plugin/v-select.d.ts +2 -0
  55. package/dist/runtime/plugin/v-select.js +5 -0
  56. package/dist/runtime/style.css +22 -1
  57. package/dist/runtime/tailwind.css +78 -0
  58. package/dist/runtime/types/app.config.d.ts +5 -0
  59. package/dist/runtime/{components/hs-ui/dialog/index.type.d.ts → types/dialog.d.ts} +3 -3
  60. package/dist/runtime/{components/hs-ui/toast/index.type.d.ts → types/toast.d.ts} +1 -2
  61. package/dist/runtime/{components/hs-ui/toast/index.type.js → types/toast.js} +0 -1
  62. package/dist/runtime/utils/class-style.d.ts +6 -0
  63. package/dist/runtime/utils/class-style.js +27 -0
  64. package/dist/runtime/utils/com.d.ts +6 -0
  65. package/dist/runtime/{lib → utils}/com.js +1 -4
  66. package/dist/runtime/utils/dayjs.d.ts +53 -0
  67. package/dist/runtime/utils/dayjs.js +124 -0
  68. package/dist/runtime/utils/float.d.ts +2 -0
  69. package/dist/runtime/utils/float.js +35 -0
  70. package/dist/runtime/utils/multi-lang-object.d.ts +17 -0
  71. package/dist/runtime/utils/multi-lang-object.js +34 -0
  72. package/dist/runtime/{lib → utils}/multi-lang.d.ts +1 -1
  73. package/dist/runtime/{lib → utils}/multi-lang.js +31 -27
  74. package/dist/runtime/{lib → utils}/number.d.ts +2 -4
  75. package/dist/runtime/{lib → utils}/number.js +29 -69
  76. package/dist/runtime/utils/object.d.ts +46 -0
  77. package/dist/runtime/utils/object.js +107 -0
  78. package/dist/runtime/utils/select-item.d.ts +31 -0
  79. package/dist/runtime/utils/select.d.ts +14 -0
  80. package/dist/runtime/utils/select.js +36 -0
  81. package/dist/runtime/utils/string.d.ts +39 -0
  82. package/dist/runtime/utils/string.js +125 -0
  83. package/dist/runtime/utils/tabulator.d.ts +108 -0
  84. package/dist/runtime/utils/tabulator.js +296 -0
  85. package/dist/runtime/utils/theme.d.ts +21 -0
  86. package/dist/runtime/utils/theme.js +31 -0
  87. package/dist/runtime/utils/tv.d.ts +101 -0
  88. package/dist/runtime/utils/tv.js +26 -0
  89. package/dist/runtime/utils/wareki.d.ts +3 -0
  90. package/dist/runtime/utils/wareki.js +106 -0
  91. package/dist/types.d.mts +1 -17
  92. package/dist/types.d.ts +1 -17
  93. package/package.json +99 -37
  94. package/dist/runtime/components/hs-fc/btn/index.vue +0 -510
  95. package/dist/runtime/components/hs-ui/aspect-box.vue +0 -83
  96. package/dist/runtime/components/hs-ui/card-item.vue +0 -141
  97. package/dist/runtime/components/hs-ui/card.vue +0 -54
  98. package/dist/runtime/components/hs-ui/container.vue +0 -50
  99. package/dist/runtime/components/hs-ui/modal/bg.vue +0 -94
  100. package/dist/runtime/components/hs-ui/modal/index.vue +0 -206
  101. package/dist/runtime/components/hs-ui/modal/use-ui-modal.d.ts +0 -20
  102. package/dist/runtime/components/v-test.vue +0 -60
  103. package/dist/runtime/composables/use-hs-ui-dialog.d.ts +0 -22
  104. package/dist/runtime/lib/class-style.d.ts +0 -8
  105. package/dist/runtime/lib/class-style.js +0 -59
  106. package/dist/runtime/lib/com.d.ts +0 -14
  107. package/dist/runtime/lib/prefix.d.ts +0 -2
  108. package/dist/runtime/lib/prefix.js +0 -17
  109. package/dist/runtime/lib/theme.d.ts +0 -2
  110. package/dist/runtime/lib/theme.js +0 -21
  111. /package/dist/runtime/{components/hs-ui/dialog/index.type.js → types/dialog.js} +0 -0
  112. /package/dist/runtime/{components/hs-fc/hoge → utils/select-item.js} +0 -0
@@ -0,0 +1,296 @@
1
+ import { Int } from "./number.js";
2
+ import { ObjectCopy } from "./object.js";
3
+ import { useHsMultiLang } from "../composables/use-hs-multi-lang.js";
4
+ import { GetGolorCode } from "../utils/theme.js";
5
+ export const cellMouseOut = (e) => {
6
+ const elm = e.target;
7
+ const overlays = elm.querySelectorAll("span.overlay");
8
+ Array.from(overlays).forEach((child) => {
9
+ child.classList.remove("flash");
10
+ });
11
+ };
12
+ export const cellMouseUp = (e) => {
13
+ const elm = e.target;
14
+ const overlays = elm.querySelectorAll("span.overlay");
15
+ Array.from(overlays).forEach((child) => {
16
+ child.classList.remove("flash");
17
+ });
18
+ };
19
+ export const cellMouseDown = (e) => {
20
+ const elm = e.target;
21
+ if (elm.classList.contains("table-cell-btn") === true) {
22
+ const offsetX = e.offsetX;
23
+ const offsetY = e.offsetY;
24
+ const width = Int(elm.clientWidth) + 20;
25
+ const overlays = elm.querySelectorAll("span.overlay");
26
+ Array.from(overlays).forEach((child) => {
27
+ child.style.top = `${-width + offsetY}px`;
28
+ child.style.left = `${-width + offsetX}px`;
29
+ child.style.width = `${width * 2}px`;
30
+ child.style.height = `${width * 2}px`;
31
+ child.classList.add("flash");
32
+ setTimeout(() => child.classList.remove("flash"), 1e4);
33
+ });
34
+ }
35
+ };
36
+ export const ColumnsPropsDisplay = {
37
+ headerSort: false,
38
+ download: false
39
+ };
40
+ export const ColumnsDisplay = (field = void 0, width = void 0) => {
41
+ return {
42
+ headerSort: false,
43
+ download: false,
44
+ field,
45
+ width: width === void 0 ? void 0 : String(width),
46
+ minWidth: width === void 0 ? void 0 : String(width)
47
+ };
48
+ };
49
+ export const InitEmitFunc = () => {
50
+ return {
51
+ // tableExcelDownload: async () => {
52
+ // console.error('初期化が完了していません');
53
+ // await Sleep(1);
54
+ // },
55
+ tableReBuild: () => {
56
+ console.error("\u521D\u671F\u5316\u304C\u5B8C\u4E86\u3057\u3066\u3044\u307E\u305B\u3093");
57
+ },
58
+ tableRedraw: () => {
59
+ console.error("\u521D\u671F\u5316\u304C\u5B8C\u4E86\u3057\u3066\u3044\u307E\u305B\u3093");
60
+ },
61
+ tableRefresh: () => {
62
+ console.error("\u521D\u671F\u5316\u304C\u5B8C\u4E86\u3057\u3066\u3044\u307E\u305B\u3093");
63
+ },
64
+ tableRefreshStopToggle: () => {
65
+ console.error("\u521D\u671F\u5316\u304C\u5B8C\u4E86\u3057\u3066\u3044\u307E\u305B\u3093");
66
+ }
67
+ };
68
+ };
69
+ export const TabulatorInitEmitFunc = InitEmitFunc;
70
+ export const Option = (option) => {
71
+ return Object.assign(
72
+ {
73
+ locale: "ja",
74
+ langs: {
75
+ ja: {
76
+ columns: {},
77
+ data: {
78
+ loading: "Loading",
79
+ // data loader text
80
+ error: "Error"
81
+ // data error text
82
+ },
83
+ groups: {
84
+ item: "item",
85
+ // the singular for item
86
+ items: "items"
87
+ // the plural for items
88
+ },
89
+ pagination: {
90
+ page_size: "\u8868\u793A\u4EF6\u6570",
91
+ page_title: "Show Page",
92
+ first: "",
93
+ // text for the first page button
94
+ first_title: "\u6700\u521D\u306E\u30DA\u30FC\u30B8",
95
+ // tooltip text for the first page button
96
+ last: "",
97
+ last_title: "\u6700\u5F8C\u306E\u30DA\u30FC\u30B8",
98
+ prev: "",
99
+ prev_title: "Prev Page",
100
+ next: "",
101
+ next_title: "Next Page",
102
+ all: "All",
103
+ counter: {
104
+ showing: "Showing",
105
+ of: "of",
106
+ rows: "rows",
107
+ pages: "pages"
108
+ }
109
+ }
110
+ },
111
+ en: {
112
+ columns: {},
113
+ data: {
114
+ loading: "Loading",
115
+ // data loader text
116
+ error: "Error"
117
+ // data error text
118
+ },
119
+ groups: {
120
+ item: "item",
121
+ // the singular for item
122
+ items: "items"
123
+ // the plural for items
124
+ },
125
+ pagination: {
126
+ page_size: "Page Size ",
127
+ page_title: "Show Page",
128
+ first: "",
129
+ // text for the first page button
130
+ first_title: "First",
131
+ // tooltip text for the first page button
132
+ last: "",
133
+ last_title: "Last",
134
+ prev: "",
135
+ prev_title: "Prev ",
136
+ next: "",
137
+ next_title: "Next",
138
+ all: "All",
139
+ counter: {
140
+ showing: "Showing",
141
+ of: "of",
142
+ rows: "rows",
143
+ pages: "pages"
144
+ }
145
+ }
146
+ }
147
+ },
148
+ layout: "fitColumns",
149
+ downloadConfig: {
150
+ columnHeaders: true,
151
+ // do not include column headers in downloaded table
152
+ columnGroups: false,
153
+ // do not include column groups in column headers for downloaded table
154
+ rowGroups: false,
155
+ // do not include row groups in downloaded table
156
+ columnCalcs: false,
157
+ // do not include column calcs in downloaded table
158
+ dataTree: false
159
+ // do not include data tree in downloaded table
160
+ }
161
+ // pagination: true,
162
+ // paginationSize: 20,
163
+ // paginationSizeSelector: [20, 50, 100],
164
+ // clipboard: true,
165
+ // ...option,
166
+ },
167
+ option
168
+ );
169
+ };
170
+ export const TabulatorFunc = {
171
+ cellMouseOut,
172
+ cellMouseUp,
173
+ cellMouseDown,
174
+ ColumnsDisplay,
175
+ InitEmitFunc,
176
+ Option
177
+ };
178
+ export const ReplaceFolderName = (str) => {
179
+ const specialChars = /:|\?|\.|"|<|>|\|/g;
180
+ const slash = /\//g;
181
+ const spaces = /\s{2,}/g;
182
+ const backSlashs = /\\{2,}/g;
183
+ const sandwich = /(\s\\|\\\s)+(\s|\\)?/g;
184
+ const beginningEnd = /^(\s|\\)+|(\s|\\)+$/g;
185
+ const replacedStr = str.replace(specialChars, `-`).replace(slash, `\\`).replace(spaces, ` `).replace(backSlashs, `\\`).replace(sandwich, `\\`).replace(beginningEnd, ``);
186
+ return replacedStr;
187
+ };
188
+ export const SortIconClassName = (uid) => {
189
+ return (key) => {
190
+ return `table-sort-${uid}-` + key;
191
+ };
192
+ };
193
+ const headerStyle = `style="--row-height:28px;"`;
194
+ const rowStyle = `style="--row-height:28px;"`;
195
+ export const GetCellHtml = (html) => `<div class="v-cell-container" ${rowStyle}>{replace}</div>`.replace(
196
+ /\{replace\}/g,
197
+ html
198
+ );
199
+ export const GetHeaderHtml = (html) => `<div class="v-cell-container" ${headerStyle}>{replace}</div>`.replace(
200
+ /\{replace\}/g,
201
+ html
202
+ );
203
+ export const GetListTableBtnSetting = (arg) => {
204
+ const {
205
+ detailUrl,
206
+ mode,
207
+ actionBtnTheme,
208
+ componentName,
209
+ TabulatorFunc: TabulatorFunc2,
210
+ emit,
211
+ size
212
+ } = arg;
213
+ const storeMultiLang = useHsMultiLang();
214
+ const tx = storeMultiLang.tx;
215
+ return {
216
+ ...TabulatorFunc2.ColumnsDisplay("", 100),
217
+ title: ``,
218
+ formatter: (cell) => {
219
+ const row = cell.getRow().getData();
220
+ const baseUrl = detailUrl;
221
+ const herf = mode === "detail" ? `href="${baseUrl.replace(/new/, "")}${row.pId}"` : "";
222
+ const style = [
223
+ `border:solid 2px ${GetGolorCode(actionBtnTheme)}`,
224
+ `color:${GetGolorCode(actionBtnTheme)}`,
225
+ `width:100%`
226
+ ].join(";");
227
+ const overlayBg = `bg-${actionBtnTheme}`;
228
+ const caption = mode === "detail" ? tx({ ja: "\u8A73\u7D30", en: "Detail" }).value : tx({ ja: "\u9078\u629E", en: "Select" }).value;
229
+ const icon = mode === "detail" ? `<i class="fa-solid fa-window-restore me-1"></i>` : `<i class="fa-solid fa-pen-to-square me-1"></i>`;
230
+ return GetCellHtml(`
231
+ <div class="v-cell-row" style="--row-size:${size};">
232
+ <div class="v-cell" style="width:100%">
233
+ <a class="table-cell-btn cursor-pointer" style="${style}" onclick="window.${componentName}_func(event);" ${herf}>
234
+ ${icon}${caption}
235
+ <span class='overlay ${overlayBg}'></span>
236
+ </a>
237
+ </div>
238
+ </div>
239
+ `);
240
+ },
241
+ cellClick: (e, cell) => {
242
+ if (window[`${componentName}_flag`] === true) return;
243
+ const row = cell.getRow().getData();
244
+ if (e.target.classList.contains("table-cell-btn") === true) {
245
+ emit("selected-id", row.id);
246
+ emit("select-private-id", row.pId);
247
+ }
248
+ },
249
+ cellMouseUp: TabulatorFunc2.cellMouseUp,
250
+ cellMouseOut: TabulatorFunc2.cellMouseOut,
251
+ cellMouseDown: TabulatorFunc2.cellMouseDown
252
+ };
253
+ };
254
+ export const ListOriginSortItems = (arg) => {
255
+ const { a, b, sortCount, SortReverse, sort } = arg;
256
+ for (let i = 0; i < sortCount; i++) {
257
+ const row = sort[i];
258
+ const isReverse = SortReverse.includes(row.key) === true ? -1 : 1;
259
+ const aRow = a[row.key];
260
+ const bRow = b[row.key];
261
+ if (aRow === null) return 1;
262
+ if (bRow === null) return -1;
263
+ if (aRow > bRow) return -1 * row.order * isReverse;
264
+ if (aRow < bRow) return 1 * row.order * isReverse;
265
+ }
266
+ return null;
267
+ };
268
+ export const ListPage = (arg) => {
269
+ const { size, index, list } = arg;
270
+ const st = index * size;
271
+ const end = (index + 1) * size - 1;
272
+ return list.map((row) => row).filter((row, index2) => {
273
+ if (index2 < st) return false;
274
+ if (end < index2) return false;
275
+ return true;
276
+ });
277
+ };
278
+ export const SortToggle = (arg) => {
279
+ const { key, sort } = arg;
280
+ let temp = ObjectCopy(sort);
281
+ const getActiveSortItem = (key2) => {
282
+ const ret = temp.find((row) => row.key === key2);
283
+ if (ret) return ret;
284
+ return null;
285
+ };
286
+ const item = getActiveSortItem(key);
287
+ if (item === null) {
288
+ temp.unshift({ key, order: -1 });
289
+ } else {
290
+ temp = temp.filter((row) => row.key !== item.key);
291
+ if (item.order === -1) {
292
+ temp.unshift({ key, order: 1 });
293
+ }
294
+ }
295
+ return temp.filter((row, index) => index < 4);
296
+ };
@@ -0,0 +1,21 @@
1
+ export declare const Theme: {
2
+ readonly main0: "main0";
3
+ readonly main1: "main1";
4
+ readonly main2: "main2";
5
+ readonly main3: "main3";
6
+ readonly accent1: "accent1";
7
+ readonly accent2: "accent2";
8
+ readonly info: "info";
9
+ readonly link: "link";
10
+ readonly download: "download";
11
+ readonly success: "success";
12
+ readonly warn: "warn";
13
+ readonly error: "error";
14
+ readonly white: "white";
15
+ readonly black: "black";
16
+ readonly dark: "dark";
17
+ readonly back: "back";
18
+ };
19
+ export type Theme = (typeof Theme)[keyof typeof Theme];
20
+ export declare const ThemeKyes: [keyof typeof Theme];
21
+ export declare const GetGolorCode: (code: string) => any;
@@ -0,0 +1,31 @@
1
+ import { useRuntimeConfig } from "#imports";
2
+ export const Theme = {
3
+ main0: "main0",
4
+ main1: "main1",
5
+ main2: "main2",
6
+ main3: "main3",
7
+ //
8
+ accent1: "accent1",
9
+ accent2: "accent2",
10
+ //
11
+ info: "info",
12
+ link: "link",
13
+ download: "download",
14
+ success: "success",
15
+ warn: "warn",
16
+ error: "error",
17
+ //
18
+ white: "white",
19
+ black: "black",
20
+ dark: "dark",
21
+ back: "back"
22
+ };
23
+ export const ThemeKyes = Object.keys(Theme);
24
+ export const GetGolorCode = (code) => {
25
+ const { public: config } = useRuntimeConfig();
26
+ const colors = config.hsui.colors || {};
27
+ if (code in colors) {
28
+ return colors[code] || "#000000";
29
+ }
30
+ return "#000000";
31
+ };
@@ -0,0 +1,101 @@
1
+ export declare const tv: import("tailwind-variants").CreateTV<boolean | ("sm" | "md" | "lg" | "xl" | "2xl")[] | {} | undefined>;
2
+ export declare const TvTheme: import("tailwind-variants").TVReturnType<{
3
+ theme: {
4
+ main0: string;
5
+ main1: string;
6
+ main2: string;
7
+ main3: string;
8
+ accent1: string;
9
+ accent2: string;
10
+ info: string;
11
+ link: string;
12
+ download: string;
13
+ success: string;
14
+ warn: string;
15
+ error: string;
16
+ white: string;
17
+ black: string;
18
+ dark: string;
19
+ back: string;
20
+ };
21
+ }, undefined, undefined, {
22
+ responsiveVariants?: boolean | ("sm" | "md" | "lg" | "xl" | "2xl")[] | {
23
+ theme?: boolean | ("sm" | "md" | "lg" | "xl" | "2xl")[] | undefined;
24
+ } | undefined;
25
+ } & import("tailwind-variants/dist/config.js").TWMConfig & (boolean | ("sm" | "md" | "lg" | "xl" | "2xl")[] | {} | undefined), {
26
+ theme: {
27
+ main0: string;
28
+ main1: string;
29
+ main2: string;
30
+ main3: string;
31
+ accent1: string;
32
+ accent2: string;
33
+ info: string;
34
+ link: string;
35
+ download: string;
36
+ success: string;
37
+ warn: string;
38
+ error: string;
39
+ white: string;
40
+ black: string;
41
+ dark: string;
42
+ back: string;
43
+ };
44
+ }, undefined, import("tailwind-variants").TVReturnType<{
45
+ theme: {
46
+ main0: string;
47
+ main1: string;
48
+ main2: string;
49
+ main3: string;
50
+ accent1: string;
51
+ accent2: string;
52
+ info: string;
53
+ link: string;
54
+ download: string;
55
+ success: string;
56
+ warn: string;
57
+ error: string;
58
+ white: string;
59
+ black: string;
60
+ dark: string;
61
+ back: string;
62
+ };
63
+ }, undefined, undefined, import("tailwind-variants/dist/config.js").TVConfig<{
64
+ theme: {
65
+ main0: string;
66
+ main1: string;
67
+ main2: string;
68
+ main3: string;
69
+ accent1: string;
70
+ accent2: string;
71
+ info: string;
72
+ link: string;
73
+ download: string;
74
+ success: string;
75
+ warn: string;
76
+ error: string;
77
+ white: string;
78
+ black: string;
79
+ dark: string;
80
+ back: string;
81
+ };
82
+ }, {
83
+ theme: {
84
+ main0: string;
85
+ main1: string;
86
+ main2: string;
87
+ main3: string;
88
+ accent1: string;
89
+ accent2: string;
90
+ info: string;
91
+ link: string;
92
+ download: string;
93
+ success: string;
94
+ warn: string;
95
+ error: string;
96
+ white: string;
97
+ black: string;
98
+ dark: string;
99
+ back: string;
100
+ };
101
+ }>, unknown, unknown, undefined>>;
@@ -0,0 +1,26 @@
1
+ import { createTV } from "tailwind-variants";
2
+ import _appConfig from "#build/app.config";
3
+ const appConfig = _appConfig;
4
+ export const tv = createTV(appConfig.tv || {});
5
+ export const TvTheme = tv({
6
+ variants: {
7
+ theme: {
8
+ main0: "",
9
+ main1: "",
10
+ main2: "",
11
+ main3: "",
12
+ accent1: "",
13
+ accent2: "",
14
+ info: "",
15
+ link: "",
16
+ download: "",
17
+ success: "",
18
+ warn: "",
19
+ error: "",
20
+ white: "",
21
+ black: "",
22
+ dark: "",
23
+ back: ""
24
+ }
25
+ }
26
+ });
@@ -0,0 +1,3 @@
1
+ export declare const WarekiShort: (yyyy: any, nullText?: string) => string;
2
+ export declare const Wareki: (yyyy: any, withoutUnit?: boolean, nullText?: string, len?: number | undefined, lang?: string) => string;
3
+ export declare const WarekiToYYYYMMDD: (wareki: string | null) => number;
@@ -0,0 +1,106 @@
1
+ import { Int } from "./number.js";
2
+ import { PaddingLeft } from "./string.js";
3
+ export const WarekiShort = (yyyy, nullText = "") => {
4
+ try {
5
+ if (yyyy === void 0 || yyyy == null) return nullText;
6
+ yyyy = Int(yyyy);
7
+ if (yyyy > 2019) {
8
+ return `R${String(yyyy - 2018)}`;
9
+ } else if (yyyy === 2019) {
10
+ return `R1`;
11
+ } else if (yyyy > 1989) {
12
+ return `H${String(yyyy - 1988)}`;
13
+ } else if (yyyy === 1989) {
14
+ return `H1`;
15
+ } else if (yyyy > 1926) {
16
+ return `S${String(yyyy - 1925)}`;
17
+ } else {
18
+ return `?`;
19
+ }
20
+ } catch {
21
+ return nullText;
22
+ }
23
+ };
24
+ export const Wareki = (yyyy, withoutUnit = false, nullText = "", len = void 0, lang = "ja") => {
25
+ try {
26
+ const unit = lang === "ja" ? "\u5E74" : "y";
27
+ if (yyyy === void 0 || yyyy == null) return nullText;
28
+ yyyy = Int(yyyy);
29
+ if (yyyy > 2019) {
30
+ if (withoutUnit) {
31
+ if (len === void 0) {
32
+ return `R${String(yyyy - 2018)}`;
33
+ } else {
34
+ return `R${PaddingLeft(String(yyyy - 2018), len, "0")}`;
35
+ }
36
+ } else {
37
+ return `R${String(yyyy - 2018)} (${String(yyyy)}${unit})`;
38
+ }
39
+ } else if (yyyy === 2019) {
40
+ if (withoutUnit) {
41
+ return `R1`;
42
+ } else {
43
+ return `R1 (${String(yyyy)}${unit})`;
44
+ }
45
+ } else if (yyyy > 1989) {
46
+ if (withoutUnit) {
47
+ if (len === void 0) {
48
+ return `H${String(yyyy - 1988)}`;
49
+ } else {
50
+ return `H${PaddingLeft(String(yyyy - 1988), len, "0")}`;
51
+ }
52
+ } else {
53
+ return `H${String(yyyy - 1988)} (${String(yyyy)}${unit})`;
54
+ }
55
+ } else if (yyyy === 1989) {
56
+ if (withoutUnit) {
57
+ return `H1`;
58
+ } else {
59
+ return `H1 (${String(yyyy)}${unit})`;
60
+ }
61
+ } else if (yyyy > 1926) {
62
+ if (withoutUnit) {
63
+ if (len === void 0) {
64
+ return `S${String(yyyy - 1925)}`;
65
+ } else {
66
+ return `S${PaddingLeft(String(yyyy - 1925), len, "0")}`;
67
+ }
68
+ } else {
69
+ return `S${String(yyyy - 1925)} (${String(yyyy)}${unit})`;
70
+ }
71
+ } else {
72
+ return `${String(yyyy)}`;
73
+ }
74
+ } catch {
75
+ return nullText;
76
+ }
77
+ };
78
+ export const WarekiToYYYYMMDD = (wareki) => {
79
+ try {
80
+ let YYYYMMDD = "";
81
+ if (wareki === null || wareki === "") return 0;
82
+ const arr = wareki.replace(/日/g, "").replace(/月/g, "-").replace(/年/g, "-").split("-");
83
+ if (arr.length > 0) {
84
+ if (/令和/.test(arr[0]) === true) {
85
+ YYYYMMDD += String(Int(arr[0].replace(/令和/g, "")) + 2018);
86
+ } else if (/平成/.test(arr[0]) === true) {
87
+ YYYYMMDD += String(Int(arr[0].replace(/平成/g, "")) + 1988);
88
+ } else if (/昭和/.test(arr[0]) === true) {
89
+ YYYYMMDD += String(Int(arr[0].replace(/昭和/g, "")) + 1925);
90
+ }
91
+ }
92
+ if (YYYYMMDD.length === 0) return 0;
93
+ YYYYMMDD = ("0000" + YYYYMMDD).slice(-4);
94
+ for (let i = 1; i <= 2; i++) {
95
+ if (arr.length > i && arr[i] !== "") {
96
+ YYYYMMDD += ("00" + arr[i]).slice(-2);
97
+ } else {
98
+ YYYYMMDD += "00";
99
+ }
100
+ }
101
+ return Int(YYYYMMDD);
102
+ } catch (error) {
103
+ console.error(error);
104
+ return 0;
105
+ }
106
+ };
package/dist/types.d.mts CHANGED
@@ -1,17 +1 @@
1
-
2
- import type { ModuleOptions } from './module.js'
3
-
4
-
5
-
6
- declare module '@nuxt/schema' {
7
- interface NuxtConfig { ['hsui']?: Partial<ModuleOptions> }
8
- interface NuxtOptions { ['hsui']?: ModuleOptions }
9
- }
10
-
11
- declare module 'nuxt/schema' {
12
- interface NuxtConfig { ['hsui']?: Partial<ModuleOptions> }
13
- interface NuxtOptions { ['hsui']?: ModuleOptions }
14
- }
15
-
16
-
17
- export type { ModuleOptions, default } from './module.js'
1
+ export { type ModuleOptions, default } from './module.js'
package/dist/types.d.ts CHANGED
@@ -1,17 +1 @@
1
-
2
- import type { ModuleOptions } from './module'
3
-
4
-
5
-
6
- declare module '@nuxt/schema' {
7
- interface NuxtConfig { ['hsui']?: Partial<ModuleOptions> }
8
- interface NuxtOptions { ['hsui']?: ModuleOptions }
9
- }
10
-
11
- declare module 'nuxt/schema' {
12
- interface NuxtConfig { ['hsui']?: Partial<ModuleOptions> }
13
- interface NuxtOptions { ['hsui']?: ModuleOptions }
14
- }
15
-
16
-
17
- export type { ModuleOptions, default } from './module'
1
+ export { type ModuleOptions, default } from './module'