lupine.web 1.0.15 → 1.0.17

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 (78) hide show
  1. package/README.md +1 -1
  2. package/package.json +1 -5
  3. package/src/core/bind-lang.ts +6 -5
  4. package/src/core/bind-links.ts +2 -2
  5. package/src/core/bind-meta.tsx +52 -0
  6. package/src/core/bind-theme.ts +11 -9
  7. package/src/core/export-lupine.ts +64 -0
  8. package/src/core/index.ts +3 -1
  9. package/src/core/{core.ts → initialize.ts} +12 -79
  10. package/src/core/page-router.ts +3 -2
  11. package/src/core/server-cookie.ts +5 -3
  12. package/src/index.ts +2 -3
  13. package/src/lib/index.ts +2 -13
  14. package/src/lib/is-frontend.ts +3 -0
  15. package/src/models/index.ts +2 -0
  16. package/src/models/json-props.ts +8 -0
  17. package/src/models/theme-props.ts +7 -0
  18. package/src/{types → styles}/index.ts +0 -2
  19. package/src/assets/themes/base-themes.ts +0 -16
  20. package/src/assets/themes/dark-themes.ts +0 -85
  21. package/src/assets/themes/index.ts +0 -4
  22. package/src/assets/themes/light-themes.ts +0 -92
  23. package/src/assets/themes/shared-themes.ts +0 -50
  24. package/src/components/button-push-animation.tsx +0 -138
  25. package/src/components/button.tsx +0 -55
  26. package/src/components/drag-refresh.tsx +0 -110
  27. package/src/components/editable-label.tsx +0 -83
  28. package/src/components/float-window.tsx +0 -226
  29. package/src/components/grid.tsx +0 -18
  30. package/src/components/html-var.tsx +0 -41
  31. package/src/components/index.ts +0 -36
  32. package/src/components/input-with-title.tsx +0 -24
  33. package/src/components/link-item.tsx +0 -13
  34. package/src/components/link-list.tsx +0 -62
  35. package/src/components/menu-bar.tsx +0 -220
  36. package/src/components/menu-item-props.tsx +0 -10
  37. package/src/components/menu-sidebar.tsx +0 -289
  38. package/src/components/message-box.tsx +0 -44
  39. package/src/components/meta-data.tsx +0 -54
  40. package/src/components/meta-description.tsx +0 -19
  41. package/src/components/meta-title.tsx +0 -19
  42. package/src/components/modal.tsx +0 -29
  43. package/src/components/notice-message.tsx +0 -119
  44. package/src/components/paging-link.tsx +0 -100
  45. package/src/components/panel.tsx +0 -24
  46. package/src/components/popup-menu.tsx +0 -218
  47. package/src/components/progress.tsx +0 -91
  48. package/src/components/redirect.tsx +0 -19
  49. package/src/components/resizable-splitter.tsx +0 -129
  50. package/src/components/select-with-title.tsx +0 -37
  51. package/src/components/spinner.tsx +0 -100
  52. package/src/components/svg.tsx +0 -24
  53. package/src/components/tabs.tsx +0 -252
  54. package/src/components/text-glow.tsx +0 -36
  55. package/src/components/text-wave.tsx +0 -54
  56. package/src/components/theme-selector.tsx +0 -35
  57. package/src/components/toggle-base.tsx +0 -260
  58. package/src/components/toggle-switch.tsx +0 -156
  59. package/src/lib/date-utils.ts +0 -317
  60. package/src/lib/deep-merge.ts +0 -37
  61. package/src/lib/document-ready.ts +0 -36
  62. package/src/lib/dom/calculate-text-width.ts +0 -13
  63. package/src/lib/dom/download-stream.ts +0 -17
  64. package/src/lib/dom/download.ts +0 -12
  65. package/src/lib/dom/index.ts +0 -71
  66. package/src/lib/dynamical-load.ts +0 -138
  67. package/src/lib/format-bytes.ts +0 -11
  68. package/src/lib/lite-dom.ts +0 -227
  69. package/src/lib/message-hub.ts +0 -105
  70. package/src/lib/observable.ts +0 -188
  71. package/src/lib/promise-timeout.ts +0 -1
  72. package/src/lib/simple-storage.ts +0 -40
  73. package/src/lib/stop-propagation.ts +0 -7
  74. package/src/lib/upload-file.ts +0 -68
  75. package/src/types/css-types.ts +0 -17
  76. package/src/types/media-query.ts +0 -93
  77. /package/src/lib/{dom/cookie.ts → cookie.ts} +0 -0
  78. /package/src/{types → styles}/css-styles.ts +0 -0
@@ -1,40 +0,0 @@
1
- // This class is used by both BE and FE (cookie for SSR).
2
- export class SimpleStorage {
3
- private settings: { [key: string]: string } = {};
4
-
5
- constructor(settings: { [key: string]: string }) {
6
- this.settings = settings;
7
- }
8
-
9
- contains(key: string): boolean {
10
- return key in this.settings;
11
- }
12
- set(key: string, value: string) {
13
- return (this.settings[key] = value);
14
- }
15
- get(key: string, defaultValue: string): string {
16
- return key in this.settings ? this.settings[key] : defaultValue;
17
- }
18
- getInt(key: string, defaultValue: number): number {
19
- if (key in this.settings) {
20
- const i = parseInt(this.settings[key]);
21
- if (!isNaN(i)) {
22
- return i;
23
- }
24
- }
25
- return defaultValue;
26
- }
27
- getBoolean(key: string, defaultValue: boolean): boolean {
28
- return key in this.settings
29
- ? this.settings[key] === '1' || this.settings[key].toLowerCase() === 'true'
30
- : defaultValue;
31
- }
32
- getJson(key: string, defaultValue: object): object {
33
- if (key in this.settings) {
34
- try {
35
- return JSON.parse(this.settings[key]);
36
- } catch (error) {}
37
- }
38
- return defaultValue;
39
- }
40
- }
@@ -1,7 +0,0 @@
1
- export const stopPropagation = (event: any) => {
2
- if (!event) return;
3
- if (event.stopPropagation) event.stopPropagation();
4
- if (event.preventDefault) event.preventDefault();
5
- event.cancelBubble = true;
6
- event.returnValue = false;
7
- };
@@ -1,68 +0,0 @@
1
- const _saveChunkSize = {
2
- size: 1024 * 500,
3
- };
4
- export const setChunkSize = (chunkSize: number) => {
5
- _saveChunkSize.size = chunkSize;
6
- };
7
- export const getChunkSize = () => {
8
- return _saveChunkSize.size;
9
- };
10
- export const checkUploadedFileSize = async (uploadUrl: string) => {
11
- const response = await fetch(uploadUrl + '?check-size=1', {
12
- method: 'POST',
13
- });
14
- const json = await response.json();
15
- return json && json.size ? json.size : 0;
16
- };
17
-
18
- // should return { chunkNumber: number }
19
- export const uploadFileChunk = async (
20
- chunk: any,
21
- chunkNumber: number,
22
- totalChunks: number,
23
- uploadUrl: string,
24
- key: string
25
- ) => {
26
- // this must be the FE so we can use fetch
27
- let url = uploadUrl + (uploadUrl.indexOf('?') === -1 ? '?' : '');
28
- url += `&chunkNumber=${chunkNumber.toString()}`;
29
- url += `&totalChunks=${totalChunks.toString()}`;
30
- if (key) {
31
- url += `&key=${key}`;
32
- }
33
- const response = await fetch(url, {
34
- method: 'POST',
35
- body: chunk,
36
- });
37
- const json = await response.json();
38
- return json;
39
- };
40
-
41
- export const uploadFile = async (
42
- file: File,
43
- uploadUrl: string,
44
- progressFn?: (percentage: number, chunkNumber: number, totalChunks: number) => void,
45
- chunkSize = _saveChunkSize.size
46
- ) => {
47
- // const uploadedSize = await checkUploadedFileSize(uploadUrl);
48
- let key = '';
49
- if (file.size <= chunkSize) {
50
- return await uploadFileChunk(file, 0, 1, uploadUrl, key);
51
- }
52
-
53
- const totalChunks = Math.ceil(file.size / chunkSize);
54
- for (let i = 0; i < totalChunks; i++) {
55
- const start = i * chunkSize;
56
- const end = Math.min((i + 1) * chunkSize, file.size);
57
- const chunk = file.slice(start, end);
58
- const uploaded = await uploadFileChunk(chunk, i, totalChunks, uploadUrl, key);
59
- if (!uploaded || uploaded.chunkNumber === i.toString() || !uploaded.key) {
60
- return false;
61
- }
62
- key = uploaded.key;
63
- if (progressFn) {
64
- progressFn(Math.round(((i + 1) / totalChunks) * 100) / 100, i, totalChunks);
65
- }
66
- }
67
- return true;
68
- };
@@ -1,17 +0,0 @@
1
- export enum ContentPosition {
2
- center = 'center',
3
- end = 'end',
4
- flexEnd = 'flex-end',
5
- flexStart = 'flex-start',
6
- start = 'start',
7
- }
8
-
9
- export type SelfPosition = 'center' | 'end' | 'flex-end' | 'flex-start' | 'self-end' | 'self-start' | 'start';
10
-
11
- export enum Position {
12
- absolute = 'absolute',
13
- fixed = 'fixed',
14
- relative = 'relative',
15
- static = 'static',
16
- sticky = 'sticky',
17
- }
@@ -1,93 +0,0 @@
1
- // export enum MediaQuery {
2
- // ExtraSmall = "@media only screen and (max-width: 480px)",
3
- // Mobile = "@media only screen and (min-width: 481px) and (max-width: 767px)",
4
- // Tablet = "@media only screen and (min-width: 768px) and (max-width: 991px)",
5
- // Desktop = "@media only screen and (min-width: 992px) and (max-width: 1399px)",
6
- // ExtraLarge = "@media only screen and (min-width: 1400px)",
7
- // }
8
-
9
- /*
10
- --> Bootstrap – 576px, 768px, 992px, 1200px, 1400px
11
- Tailwind - 640px, 768px, 1024px, 1280px, 1536px
12
- Foundation: <640px, ≥640px, ≥1200px
13
- Bulma: <769px, ≥769px, ≥1024px, ≥1216px, and ≥1408px
14
- Semantic UI: <768px, ≥768px, ≥992px, ≥1400px, ≥1920px
15
- Primer: <544px, ≥544px, ≥768px, ≥1012px, ≥1280px
16
- UIKit: <479px, ≥480px, ≥768px, ≥960px, ≥1200px
17
- */
18
-
19
- export class MediaQueryMaxWidth {
20
- private static _ExtraSmall = '480px';
21
- private static _Mobile = '767px'; // Grid: col-1, 12
22
- private static _Tablet = '991px'; // Grid: col-1-md, 12-md
23
- private static _Desktop = '1399px'; // Grid: col-1-lg, 12-lg
24
- public static get ExtraSmallMax() {
25
- return MediaQueryMaxWidth._ExtraSmall;
26
- }
27
- public static get MobileMax() {
28
- return MediaQueryMaxWidth._Mobile;
29
- }
30
- public static get TabletMax() {
31
- return MediaQueryMaxWidth._Tablet;
32
- }
33
- public static get DesktopMax() {
34
- return MediaQueryMaxWidth._Desktop;
35
- }
36
-
37
- public static set ExtraSmallMax(value: string) {
38
- MediaQueryMaxWidth._ExtraSmall = value;
39
- }
40
- public static set MobileMax(value: string) {
41
- MediaQueryMaxWidth._Mobile = value;
42
- }
43
- public static set TabletMax(value: string) {
44
- MediaQueryMaxWidth._Tablet = value;
45
- }
46
- public static set DesktopMax(value: string) {
47
- MediaQueryMaxWidth._Desktop = value;
48
- }
49
- }
50
- export class MediaQueryRange {
51
- public static get ExtraSmallBelow() {
52
- return `@media only screen and (max-width: ${MediaQueryMaxWidth.ExtraSmallMax})`;
53
- }
54
- public static get ExtraSmallAbove() {
55
- return `@media only screen and (min-width: ${MediaQueryMaxWidth.ExtraSmallMax})`;
56
- }
57
- public static get MobileBelow() {
58
- return `@media only screen and (max-width: ${MediaQueryMaxWidth.MobileMax})`;
59
- }
60
- public static get MobileAbove() {
61
- return `@media only screen and (min-width: ${MediaQueryMaxWidth.MobileMax})`;
62
- }
63
- public static get TabletBelow() {
64
- return `@media only screen and (max-width: ${MediaQueryMaxWidth.TabletMax})`;
65
- }
66
- public static get TabletAbove() {
67
- return `@media only screen and (min-width: ${MediaQueryMaxWidth.TabletMax})`;
68
- }
69
- public static get DesktopBelow() {
70
- return `@media only screen and (max-width: ${MediaQueryMaxWidth.DesktopMax})`;
71
- }
72
- public static get DesktopAbove() {
73
- return `@media only screen and (min-width: ${MediaQueryMaxWidth.DesktopMax})`;
74
- }
75
- }
76
-
77
- export enum MediaQueryDirection {
78
- Below,
79
- Above,
80
- }
81
- export function adjustedMediaQueryRange(
82
- direction: MediaQueryDirection,
83
- mediaQueryWidth: string,
84
- adjustWidth: number
85
- ): string {
86
- const adjustedWidth = Number.parseInt(mediaQueryWidth) + adjustWidth;
87
- if (direction === MediaQueryDirection.Below) {
88
- return `@media only screen and (max-width: ${adjustedWidth}px)`;
89
- } else {
90
- // if (direction === MediaQueryRangeDirection.Above) {
91
- return `@media only screen and (min-width: ${adjustedWidth}px)`;
92
- }
93
- }
File without changes
File without changes