snice 1.14.3 → 2.1.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.
- package/bin/templates/base/tsconfig.json +5 -4
- package/components/accordion/demo.html +403 -0
- package/components/accordion/snice-accordion-item.css +85 -0
- package/components/accordion/snice-accordion-item.ts +226 -0
- package/components/accordion/snice-accordion.css +31 -0
- package/components/accordion/snice-accordion.ts +182 -0
- package/components/accordion/snice-accordion.types.ts +32 -0
- package/components/alert/demo.html +445 -0
- package/components/alert/snice-alert.css +195 -0
- package/components/alert/snice-alert.ts +141 -0
- package/components/alert/snice-alert.types.ts +12 -0
- package/components/avatar/demo.html +598 -0
- package/components/avatar/snice-avatar.css +131 -0
- package/components/avatar/snice-avatar.ts +136 -0
- package/components/avatar/snice-avatar.types.ts +13 -0
- package/components/badge/demo.html +523 -0
- package/components/badge/snice-badge.css +161 -0
- package/components/badge/snice-badge.ts +117 -0
- package/components/badge/snice-badge.types.ts +16 -0
- package/components/breadcrumbs/demo.html +404 -0
- package/components/breadcrumbs/snice-breadcrumbs.css +133 -0
- package/components/breadcrumbs/snice-breadcrumbs.ts +191 -0
- package/components/breadcrumbs/snice-breadcrumbs.types.ts +26 -0
- package/components/breadcrumbs/snice-crumb.ts +26 -0
- package/components/button/demo.html +42 -0
- package/components/button/snice-button.css +230 -0
- package/components/button/snice-button.ts +169 -0
- package/components/button/snice-button.types.ts +25 -0
- package/components/card/demo.html +525 -0
- package/components/card/snice-card.css +140 -0
- package/components/card/snice-card.ts +102 -0
- package/components/card/snice-card.types.ts +10 -0
- package/components/checkbox/demo.html +253 -0
- package/components/checkbox/snice-checkbox.css +164 -0
- package/components/checkbox/snice-checkbox.ts +223 -0
- package/components/checkbox/snice-checkbox.types.ts +22 -0
- package/components/chip/demo.html +383 -0
- package/components/chip/snice-chip.css +195 -0
- package/components/chip/snice-chip.ts +139 -0
- package/components/chip/snice-chip.types.ts +15 -0
- package/components/date-picker/README.md +233 -0
- package/components/date-picker/demo.html +191 -0
- package/components/date-picker/snice-date-picker.css +330 -0
- package/components/date-picker/snice-date-picker.ts +777 -0
- package/components/date-picker/snice-date-picker.types.ts +83 -0
- package/components/divider/demo.html +233 -0
- package/components/divider/snice-divider.css +155 -0
- package/components/divider/snice-divider.ts +69 -0
- package/components/divider/snice-divider.types.ts +15 -0
- package/components/drawer/demo.html +328 -0
- package/components/drawer/snice-drawer.css +476 -0
- package/components/drawer/snice-drawer.ts +287 -0
- package/components/drawer/snice-drawer.types.ts +17 -0
- package/components/global.d.ts +14 -0
- package/components/input/demo.html +303 -0
- package/components/input/snice-input.css +257 -0
- package/components/input/snice-input.ts +442 -0
- package/components/input/snice-input.types.ts +59 -0
- package/components/input/test.html +77 -0
- package/components/layout/README.md +260 -0
- package/components/layout/demo.html +538 -0
- package/components/layout/snice-layout-blog.css +129 -0
- package/components/layout/snice-layout-blog.ts +48 -0
- package/components/layout/snice-layout-card.css +104 -0
- package/components/layout/snice-layout-card.ts +35 -0
- package/components/layout/snice-layout-centered.css +51 -0
- package/components/layout/snice-layout-centered.ts +22 -0
- package/components/layout/snice-layout-dashboard.css +98 -0
- package/components/layout/snice-layout-dashboard.ts +45 -0
- package/components/layout/snice-layout-fullscreen.css +72 -0
- package/components/layout/snice-layout-fullscreen.ts +34 -0
- package/components/layout/snice-layout-landing.css +92 -0
- package/components/layout/snice-layout-landing.ts +47 -0
- package/components/layout/snice-layout-minimal.css +16 -0
- package/components/layout/snice-layout-minimal.ts +19 -0
- package/components/layout/snice-layout-sidebar.css +117 -0
- package/components/layout/snice-layout-sidebar.ts +48 -0
- package/components/layout/snice-layout-split.css +103 -0
- package/components/layout/snice-layout-split.ts +29 -0
- package/components/layout/snice-layout.css +72 -0
- package/components/layout/snice-layout.ts +35 -0
- package/components/layout/snice-layout.types.ts +5 -0
- package/components/login/demo-auth-controller.ts +185 -0
- package/components/login/demo.html +470 -0
- package/components/login/snice-login.css +204 -0
- package/components/login/snice-login.ts +337 -0
- package/components/login/snice-login.types.ts +34 -0
- package/components/modal/demo.html +291 -0
- package/components/modal/snice-modal.css +203 -0
- package/components/modal/snice-modal.ts +233 -0
- package/components/modal/snice-modal.types.ts +21 -0
- package/components/pagination/demo.html +395 -0
- package/components/pagination/snice-pagination.ts +333 -0
- package/components/pagination/snice-pagination.types.ts +21 -0
- package/components/progress/demo.html +510 -0
- package/components/progress/snice-progress.css +267 -0
- package/components/progress/snice-progress.ts +247 -0
- package/components/progress/snice-progress.types.ts +19 -0
- package/components/radio/demo.html +287 -0
- package/components/radio/snice-radio.css +171 -0
- package/components/radio/snice-radio.ts +218 -0
- package/components/radio/snice-radio.types.ts +21 -0
- package/components/select/demo.html +511 -0
- package/components/select/snice-option.ts +52 -0
- package/components/select/snice-option.types.ts +14 -0
- package/components/select/snice-select.css +392 -0
- package/components/select/snice-select.ts +796 -0
- package/components/select/snice-select.types.ts +55 -0
- package/components/skeleton/demo.html +514 -0
- package/components/skeleton/snice-skeleton.css +109 -0
- package/components/skeleton/snice-skeleton.ts +126 -0
- package/components/skeleton/snice-skeleton.types.ts +11 -0
- package/components/switch/demo.html +284 -0
- package/components/switch/snice-switch.css +221 -0
- package/components/switch/snice-switch.ts +229 -0
- package/components/switch/snice-switch.types.ts +23 -0
- package/components/symbols.ts +23 -0
- package/components/table/demo-table-controller.ts +100 -0
- package/components/table/demo.html +480 -0
- package/components/table/snice-cell-boolean.ts +112 -0
- package/components/table/snice-cell-date.ts +210 -0
- package/components/table/snice-cell-duration.ts +91 -0
- package/components/table/snice-cell-filesize.ts +90 -0
- package/components/table/snice-cell-number.ts +165 -0
- package/components/table/snice-cell-progress.ts +83 -0
- package/components/table/snice-cell-rating.ts +82 -0
- package/components/table/snice-cell-sparkline.ts +253 -0
- package/components/table/snice-cell-text.ts +125 -0
- package/components/table/snice-cell.css +296 -0
- package/components/table/snice-cell.ts +473 -0
- package/components/table/snice-column.ts +353 -0
- package/components/table/snice-header.css +243 -0
- package/components/table/snice-header.ts +261 -0
- package/components/table/snice-progress.ts +66 -0
- package/components/table/snice-rating.ts +45 -0
- package/components/table/snice-row.css +255 -0
- package/components/table/snice-row.ts +331 -0
- package/components/table/snice-table.css +241 -0
- package/components/table/snice-table.ts +737 -0
- package/components/table/snice-table.types.ts +158 -0
- package/components/tabs/demo.html +487 -0
- package/components/tabs/snice-tab-panel.css +264 -0
- package/components/tabs/snice-tab-panel.ts +47 -0
- package/components/tabs/snice-tab.css +96 -0
- package/components/tabs/snice-tab.ts +65 -0
- package/components/tabs/snice-tabs.css +189 -0
- package/components/tabs/snice-tabs.ts +332 -0
- package/components/tabs/snice-tabs.types.ts +28 -0
- package/components/theme/theme.css +234 -0
- package/components/toast/demo.html +329 -0
- package/components/toast/snice-toast-container.ts +256 -0
- package/components/toast/snice-toast.css +213 -0
- package/components/toast/snice-toast.ts +276 -0
- package/components/toast/snice-toast.types.ts +35 -0
- package/components/tooltip/demo.html +350 -0
- package/components/tooltip/snice-tooltip-portal.css +79 -0
- package/components/tooltip/snice-tooltip.css +117 -0
- package/components/tooltip/snice-tooltip.ts +612 -0
- package/components/tooltip/snice-tooltip.types.ts +32 -0
- package/components/transitions.ts +94 -0
- package/components/tsconfig.json +18 -0
- package/dist/index.cjs +441 -329
- package/dist/index.cjs.map +1 -1
- package/dist/index.cjs.min.map +1 -1
- package/dist/index.esm.js +441 -329
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +3 -3
- package/dist/index.esm.min.js.map +1 -1
- package/dist/index.iife.js +441 -329
- package/dist/index.iife.js.map +1 -1
- package/dist/index.iife.min.js +3 -3
- package/dist/index.iife.min.js.map +1 -1
- package/dist/symbols.esm.js +1 -1
- package/dist/transitions.esm.js +1 -1
- package/dist/types/controller.d.ts +1 -1
- package/dist/types/element.d.ts +10 -10
- package/dist/types/events.d.ts +2 -2
- package/dist/types/index.d.ts +1 -1
- package/dist/types/observe.d.ts +1 -1
- package/dist/types/request-response.d.ts +2 -3
- package/dist/types/router.d.ts +1 -1
- package/package.json +9 -3
- package/dist/index.cjs.min +0 -15
- package/dist/symbols.cjs +0 -103
- package/dist/transitions.cjs +0 -219
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// Import all transitions from core
|
|
2
|
+
import {
|
|
3
|
+
fadeTransition,
|
|
4
|
+
slideTransition,
|
|
5
|
+
slideRightTransition,
|
|
6
|
+
slideUpTransition,
|
|
7
|
+
slideDownTransition,
|
|
8
|
+
scaleTransition,
|
|
9
|
+
rotateTransition,
|
|
10
|
+
flipTransition,
|
|
11
|
+
zoomTransition,
|
|
12
|
+
noneTransition,
|
|
13
|
+
type Transition,
|
|
14
|
+
performTransition
|
|
15
|
+
} from 'snice/transitions';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Map of all transitions for components to use
|
|
19
|
+
* This is in components folder to avoid affecting tree-shaking in core library
|
|
20
|
+
*/
|
|
21
|
+
export const transitions: Record<string, Transition> = {
|
|
22
|
+
fade: fadeTransition,
|
|
23
|
+
slide: slideTransition,
|
|
24
|
+
'slide-right': slideRightTransition,
|
|
25
|
+
'slide-up': slideUpTransition,
|
|
26
|
+
'slide-down': slideDownTransition,
|
|
27
|
+
scale: scaleTransition,
|
|
28
|
+
rotate: rotateTransition,
|
|
29
|
+
flip: flipTransition,
|
|
30
|
+
zoom: zoomTransition,
|
|
31
|
+
none: noneTransition
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Perform a transition between two panels that need to stay in the DOM
|
|
36
|
+
* Unlike performTransition, this doesn't add/remove elements
|
|
37
|
+
*/
|
|
38
|
+
export async function performPanelTransition(
|
|
39
|
+
oldPanel: HTMLElement,
|
|
40
|
+
newPanel: HTMLElement,
|
|
41
|
+
transition: Transition = {}
|
|
42
|
+
): Promise<void> {
|
|
43
|
+
// If panels are the same, just return
|
|
44
|
+
if (oldPanel === newPanel) return;
|
|
45
|
+
|
|
46
|
+
// Get parent container
|
|
47
|
+
const parent = oldPanel.parentElement;
|
|
48
|
+
if (!parent) return;
|
|
49
|
+
|
|
50
|
+
// Create temporary container to perform the transition
|
|
51
|
+
const container = document.createElement('div');
|
|
52
|
+
container.style.position = 'relative';
|
|
53
|
+
container.style.width = '100%';
|
|
54
|
+
container.style.overflow = 'hidden';
|
|
55
|
+
|
|
56
|
+
// Calculate container height to prevent layout shift
|
|
57
|
+
const oldHeight = oldPanel.offsetHeight;
|
|
58
|
+
container.style.minHeight = `${oldHeight}px`;
|
|
59
|
+
|
|
60
|
+
// Clone the panels for transition
|
|
61
|
+
const oldClone = oldPanel.cloneNode(true) as HTMLElement;
|
|
62
|
+
const newClone = newPanel.cloneNode(true) as HTMLElement;
|
|
63
|
+
|
|
64
|
+
// Insert container before old panel
|
|
65
|
+
parent.insertBefore(container, oldPanel);
|
|
66
|
+
|
|
67
|
+
// Add the old clone to the container first
|
|
68
|
+
container.appendChild(oldClone);
|
|
69
|
+
|
|
70
|
+
// Hide the original panels during transition
|
|
71
|
+
oldPanel.style.visibility = 'hidden';
|
|
72
|
+
oldPanel.style.position = 'absolute';
|
|
73
|
+
newPanel.hidden = false;
|
|
74
|
+
newPanel.style.visibility = 'hidden';
|
|
75
|
+
newPanel.style.position = 'absolute';
|
|
76
|
+
|
|
77
|
+
try {
|
|
78
|
+
// Perform the transition with clones
|
|
79
|
+
// performTransition expects oldClone to already be in container
|
|
80
|
+
await performTransition(container, oldClone, newClone, transition);
|
|
81
|
+
} catch (error) {
|
|
82
|
+
console.error('Transition error:', error);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Restore original panels
|
|
86
|
+
oldPanel.style.visibility = '';
|
|
87
|
+
oldPanel.style.position = '';
|
|
88
|
+
oldPanel.hidden = true;
|
|
89
|
+
newPanel.style.visibility = '';
|
|
90
|
+
newPanel.style.position = '';
|
|
91
|
+
|
|
92
|
+
// Remove temporary container
|
|
93
|
+
container.remove();
|
|
94
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"noEmit": false,
|
|
5
|
+
"outDir": "../dist/components",
|
|
6
|
+
"rootDir": ".",
|
|
7
|
+
"declaration": true,
|
|
8
|
+
"emitDeclarationOnly": false,
|
|
9
|
+
"sourceMap": true,
|
|
10
|
+
"noUnusedLocals": false,
|
|
11
|
+
"noUnusedParameters": false,
|
|
12
|
+
"paths": {
|
|
13
|
+
"snice": ["../dist/types/index.d.ts"]
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"include": ["."],
|
|
17
|
+
"exclude": ["**/*.test.ts", "**/*.spec.ts", "**/*.html", "**/demo*", "**/*.md"]
|
|
18
|
+
}
|