snice 2.5.4 → 3.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/README.md +501 -882
- package/bin/templates/base/src/components/counter-button.ts +13 -26
- package/bin/templates/base/src/controllers/counter-controller.ts +3 -3
- package/dist/components/accordion/snice-accordion-item.d.ts +4 -5
- package/dist/components/accordion/snice-accordion-item.js +37 -39
- package/dist/components/accordion/snice-accordion-item.js.map +1 -1
- package/dist/components/accordion/snice-accordion.d.ts +5 -11
- package/dist/components/accordion/snice-accordion.js +51 -52
- package/dist/components/accordion/snice-accordion.js.map +1 -1
- package/dist/components/alert/snice-alert.d.ts +2 -6
- package/dist/components/alert/snice-alert.js +41 -56
- package/dist/components/alert/snice-alert.js.map +1 -1
- package/dist/components/avatar/snice-avatar.d.ts +2 -6
- package/dist/components/avatar/snice-avatar.js +64 -71
- package/dist/components/avatar/snice-avatar.js.map +1 -1
- package/dist/components/badge/snice-badge.d.ts +2 -3
- package/dist/components/badge/snice-badge.js +22 -23
- package/dist/components/badge/snice-badge.js.map +1 -1
- package/dist/components/breadcrumbs/snice-breadcrumbs.d.ts +5 -12
- package/dist/components/breadcrumbs/snice-breadcrumbs.js +88 -89
- package/dist/components/breadcrumbs/snice-breadcrumbs.js.map +1 -1
- package/dist/components/button/snice-button.d.ts +3 -7
- package/dist/components/button/snice-button.js +37 -58
- package/dist/components/button/snice-button.js.map +1 -1
- package/dist/components/card/snice-card.d.ts +5 -8
- package/dist/components/card/snice-card.js +71 -56
- package/dist/components/card/snice-card.js.map +1 -1
- package/dist/components/checkbox/snice-checkbox.d.ts +4 -13
- package/dist/components/checkbox/snice-checkbox.js +66 -137
- package/dist/components/checkbox/snice-checkbox.js.map +1 -1
- package/dist/components/chip/snice-chip.d.ts +5 -11
- package/dist/components/chip/snice-chip.js +44 -47
- package/dist/components/chip/snice-chip.js.map +1 -1
- package/dist/components/date-picker/snice-date-picker.d.ts +11 -11
- package/dist/components/date-picker/snice-date-picker.js +134 -133
- package/dist/components/date-picker/snice-date-picker.js.map +1 -1
- package/dist/components/divider/snice-divider.d.ts +2 -4
- package/dist/components/divider/snice-divider.js +14 -22
- package/dist/components/divider/snice-divider.js.map +1 -1
- package/dist/components/drawer/snice-drawer.d.ts +4 -4
- package/dist/components/drawer/snice-drawer.js +25 -19
- package/dist/components/drawer/snice-drawer.js.map +1 -1
- package/dist/components/input/snice-input.d.ts +8 -6
- package/dist/components/input/snice-input.js +122 -105
- package/dist/components/input/snice-input.js.map +1 -1
- package/dist/components/layout/snice-layout-blog.d.ts +4 -4
- package/dist/components/layout/snice-layout-blog.js +21 -19
- package/dist/components/layout/snice-layout-blog.js.map +1 -1
- package/dist/components/layout/snice-layout-card.d.ts +2 -2
- package/dist/components/layout/snice-layout-card.js +16 -9
- package/dist/components/layout/snice-layout-card.js.map +1 -1
- package/dist/components/layout/snice-layout-centered.d.ts +2 -2
- package/dist/components/layout/snice-layout-centered.js +14 -7
- package/dist/components/layout/snice-layout-centered.js.map +1 -1
- package/dist/components/layout/snice-layout-dashboard.d.ts +5 -5
- package/dist/components/layout/snice-layout-dashboard.js +38 -30
- package/dist/components/layout/snice-layout-dashboard.js.map +1 -1
- package/dist/components/layout/snice-layout-fullscreen.d.ts +2 -2
- package/dist/components/layout/snice-layout-fullscreen.js +17 -10
- package/dist/components/layout/snice-layout-fullscreen.js.map +1 -1
- package/dist/components/layout/snice-layout-landing.d.ts +4 -4
- package/dist/components/layout/snice-layout-landing.js +21 -19
- package/dist/components/layout/snice-layout-landing.js.map +1 -1
- package/dist/components/layout/snice-layout-minimal.d.ts +2 -2
- package/dist/components/layout/snice-layout-minimal.js +17 -6
- package/dist/components/layout/snice-layout-minimal.js.map +1 -1
- package/dist/components/layout/snice-layout-sidebar.d.ts +5 -4
- package/dist/components/layout/snice-layout-sidebar.js +42 -20
- package/dist/components/layout/snice-layout-sidebar.js.map +1 -1
- package/dist/components/layout/snice-layout-split.d.ts +2 -2
- package/dist/components/layout/snice-layout-split.js +14 -7
- package/dist/components/layout/snice-layout-split.js.map +1 -1
- package/dist/components/layout/snice-layout.d.ts +4 -4
- package/dist/components/layout/snice-layout.js +16 -10
- package/dist/components/layout/snice-layout.js.map +1 -1
- package/dist/components/login/snice-login.d.ts +6 -11
- package/dist/components/login/snice-login.js +97 -71
- package/dist/components/login/snice-login.js.map +1 -1
- package/dist/components/modal/snice-modal.d.ts +5 -9
- package/dist/components/modal/snice-modal.js +47 -78
- package/dist/components/modal/snice-modal.js.map +1 -1
- package/dist/components/nav/snice-nav.d.ts +13 -7
- package/dist/components/nav/snice-nav.js +191 -100
- package/dist/components/nav/snice-nav.js.map +1 -1
- package/dist/components/nav/snice-nav.types.d.ts +3 -3
- package/dist/components/pagination/snice-pagination.d.ts +6 -7
- package/dist/components/pagination/snice-pagination.js +94 -81
- package/dist/components/pagination/snice-pagination.js.map +1 -1
- package/dist/components/progress/snice-progress.d.ts +2 -7
- package/dist/components/progress/snice-progress.js +41 -98
- package/dist/components/progress/snice-progress.js.map +1 -1
- package/dist/components/radio/snice-radio.d.ts +4 -4
- package/dist/components/radio/snice-radio.js +52 -44
- package/dist/components/radio/snice-radio.js.map +1 -1
- package/dist/components/select/snice-option.d.ts +2 -1
- package/dist/components/select/snice-option.js +12 -5
- package/dist/components/select/snice-option.js.map +1 -1
- package/dist/components/select/snice-select.d.ts +9 -21
- package/dist/components/select/snice-select.js +98 -170
- package/dist/components/select/snice-select.js.map +1 -1
- package/dist/components/skeleton/snice-skeleton.d.ts +2 -6
- package/dist/components/skeleton/snice-skeleton.js +18 -49
- package/dist/components/skeleton/snice-skeleton.js.map +1 -1
- package/dist/components/snice-cell-BLFVdxPp.js +4 -0
- package/dist/components/snice-cell-BLFVdxPp.js.map +1 -0
- package/dist/components/switch/snice-switch.d.ts +2 -2
- package/dist/components/switch/snice-switch.js +38 -26
- package/dist/components/switch/snice-switch.js.map +1 -1
- package/dist/components/table/snice-cell-actions.d.ts +24 -0
- package/dist/components/table/snice-cell-actions.js +149 -0
- package/dist/components/table/snice-cell-actions.js.map +1 -0
- package/dist/components/table/snice-cell-boolean.d.ts +2 -2
- package/dist/components/table/snice-cell-boolean.js +13 -7
- package/dist/components/table/snice-cell-boolean.js.map +1 -1
- package/dist/components/table/snice-cell-color.d.ts +18 -0
- package/dist/components/table/snice-cell-color.js +149 -0
- package/dist/components/table/snice-cell-color.js.map +1 -0
- package/dist/components/table/snice-cell-currency.d.ts +24 -0
- package/dist/components/table/snice-cell-currency.js +235 -0
- package/dist/components/table/snice-cell-currency.js.map +1 -0
- package/dist/components/table/snice-cell-date.d.ts +2 -2
- package/dist/components/table/snice-cell-date.js +14 -8
- package/dist/components/table/snice-cell-date.js.map +1 -1
- package/dist/components/table/snice-cell-duration.d.ts +2 -2
- package/dist/components/table/snice-cell-duration.js +12 -6
- package/dist/components/table/snice-cell-duration.js.map +1 -1
- package/dist/components/table/snice-cell-email.d.ts +15 -0
- package/dist/components/table/snice-cell-email.js +125 -0
- package/dist/components/table/snice-cell-email.js.map +1 -0
- package/dist/components/table/snice-cell-filesize.d.ts +2 -2
- package/dist/components/table/snice-cell-filesize.js +12 -6
- package/dist/components/table/snice-cell-filesize.js.map +1 -1
- package/dist/components/table/snice-cell-image.d.ts +20 -0
- package/dist/components/table/snice-cell-image.js +162 -0
- package/dist/components/table/snice-cell-image.js.map +1 -0
- package/dist/components/table/snice-cell-json.d.ts +20 -0
- package/dist/components/table/snice-cell-json.js +186 -0
- package/dist/components/table/snice-cell-json.js.map +1 -0
- package/dist/components/table/snice-cell-link.d.ts +17 -0
- package/dist/components/table/snice-cell-link.js +142 -0
- package/dist/components/table/snice-cell-link.js.map +1 -0
- package/dist/components/table/snice-cell-location.d.ts +19 -0
- package/dist/components/table/snice-cell-location.js +185 -0
- package/dist/components/table/snice-cell-location.js.map +1 -0
- package/dist/components/table/snice-cell-number.d.ts +2 -2
- package/dist/components/table/snice-cell-number.js +12 -6
- package/dist/components/table/snice-cell-number.js.map +1 -1
- package/dist/components/table/snice-cell-percentage.d.ts +22 -0
- package/dist/components/table/snice-cell-percentage.js +208 -0
- package/dist/components/table/snice-cell-percentage.js.map +1 -0
- package/dist/components/table/snice-cell-phone.d.ts +18 -0
- package/dist/components/table/snice-cell-phone.js +153 -0
- package/dist/components/table/snice-cell-phone.js.map +1 -0
- package/dist/components/table/snice-cell-progress.d.ts +2 -2
- package/dist/components/table/snice-cell-progress.js +12 -6
- package/dist/components/table/snice-cell-progress.js.map +1 -1
- package/dist/components/table/snice-cell-rating.d.ts +2 -2
- package/dist/components/table/snice-cell-rating.js +12 -6
- package/dist/components/table/snice-cell-rating.js.map +1 -1
- package/dist/components/table/snice-cell-sparkline.d.ts +2 -2
- package/dist/components/table/snice-cell-sparkline.js +13 -7
- package/dist/components/table/snice-cell-sparkline.js.map +1 -1
- package/dist/components/table/snice-cell-status.d.ts +17 -0
- package/dist/components/table/snice-cell-status.js +144 -0
- package/dist/components/table/snice-cell-status.js.map +1 -0
- package/dist/components/table/snice-cell-tag.d.ts +16 -0
- package/dist/components/table/snice-cell-tag.js +131 -0
- package/dist/components/table/snice-cell-tag.js.map +1 -0
- package/dist/components/table/snice-cell-text.d.ts +2 -2
- package/dist/components/table/snice-cell-text.js +14 -8
- package/dist/components/table/snice-cell-text.js.map +1 -1
- package/dist/components/table/snice-cell.d.ts +2 -2
- package/dist/components/table/snice-cell.js +12 -6
- package/dist/components/table/snice-cell.js.map +1 -1
- package/dist/components/table/snice-column.d.ts +1 -1
- package/dist/components/table/snice-column.js +6 -3
- package/dist/components/table/snice-column.js.map +1 -1
- package/dist/components/table/snice-header.d.ts +5 -5
- package/dist/components/table/snice-header.js +60 -50
- package/dist/components/table/snice-header.js.map +1 -1
- package/dist/components/table/snice-progress.d.ts +2 -2
- package/dist/components/table/snice-progress.js +18 -11
- package/dist/components/table/snice-progress.js.map +1 -1
- package/dist/components/table/snice-rating.d.ts +2 -2
- package/dist/components/table/snice-rating.js +15 -8
- package/dist/components/table/snice-rating.js.map +1 -1
- package/dist/components/table/snice-row.d.ts +17 -6
- package/dist/components/table/snice-row.js +95 -44
- package/dist/components/table/snice-row.js.map +1 -1
- package/dist/components/table/snice-table.d.ts +18 -10
- package/dist/components/table/snice-table.js +355 -173
- package/dist/components/table/snice-table.js.map +1 -1
- package/dist/components/table/snice-table.types.d.ts +101 -2
- package/dist/components/tabs/snice-tab-panel.d.ts +2 -2
- package/dist/components/tabs/snice-tab-panel.js +12 -6
- package/dist/components/tabs/snice-tab-panel.js.map +1 -1
- package/dist/components/tabs/snice-tab.d.ts +6 -5
- package/dist/components/tabs/snice-tab.js +36 -19
- package/dist/components/tabs/snice-tab.js.map +1 -1
- package/dist/components/tabs/snice-tabs.d.ts +5 -5
- package/dist/components/tabs/snice-tabs.js +38 -28
- package/dist/components/tabs/snice-tabs.js.map +1 -1
- package/dist/components/toast/snice-toast-container.d.ts +7 -7
- package/dist/components/toast/snice-toast-container.js +19 -12
- package/dist/components/toast/snice-toast-container.js.map +1 -1
- package/dist/components/toast/snice-toast.d.ts +3 -15
- package/dist/components/toast/snice-toast.js +49 -108
- package/dist/components/toast/snice-toast.js.map +1 -1
- package/dist/components/tooltip/snice-tooltip.d.ts +2 -2
- package/dist/components/tooltip/snice-tooltip.js +14 -7
- package/dist/components/tooltip/snice-tooltip.js.map +1 -1
- package/dist/context.d.ts +44 -0
- package/dist/element-ready.d.ts +40 -0
- package/dist/{types/element.d.ts → element.d.ts} +2 -8
- package/dist/{types/events.d.ts → events.d.ts} +0 -4
- package/dist/index.cjs +2589 -605
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +21 -0
- package/dist/index.esm.js +2568 -604
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +2589 -605
- package/dist/index.iife.js.map +1 -1
- package/dist/method-decorators.d.ts +121 -0
- package/dist/on.d.ts +59 -0
- package/dist/parts.d.ts +159 -0
- package/dist/render-debug.d.ts +27 -0
- package/dist/render-tracker.d.ts +14 -0
- package/dist/render.d.ts +96 -0
- package/dist/symbols.cjs +163 -0
- package/dist/symbols.cjs.map +1 -1
- package/dist/{types/symbols.d.ts → symbols.d.ts} +22 -0
- package/dist/symbols.esm.js +27 -3
- package/dist/symbols.esm.js.map +1 -1
- package/dist/template.d.ts +100 -0
- package/dist/transitions.cjs +219 -0
- package/dist/transitions.esm.js +2 -2
- package/dist/types/context.d.ts +48 -0
- package/dist/types/element-options.d.ts +26 -0
- package/dist/types/index.d.ts +25 -9
- package/dist/types/nav-context.d.ts +19 -0
- package/dist/types/{types/on-options.d.ts → on-options.d.ts} +2 -0
- package/dist/types/{types/placard.d.ts → placard.d.ts} +0 -1
- package/docs/ai/README.md +17 -0
- package/docs/ai/api.md +175 -0
- package/docs/ai/architecture.md +160 -0
- package/docs/ai/components/accordion.md +174 -0
- package/docs/ai/components/alert.md +77 -0
- package/docs/ai/components/avatar.md +61 -0
- package/docs/ai/components/badge.md +69 -0
- package/docs/ai/components/breadcrumbs.md +74 -0
- package/docs/ai/components/button.md +75 -0
- package/docs/ai/components/card.md +61 -0
- package/docs/ai/components/checkbox.md +74 -0
- package/docs/ai/components/chip.md +73 -0
- package/docs/ai/components/date-picker.md +75 -0
- package/docs/ai/components/divider.md +66 -0
- package/docs/ai/components/drawer.md +80 -0
- package/docs/ai/components/input.md +111 -0
- package/docs/ai/components/login.md +109 -0
- package/docs/ai/components/modal.md +67 -0
- package/docs/ai/components/nav.md +76 -0
- package/docs/ai/components/pagination.md +55 -0
- package/docs/ai/components/progress.md +72 -0
- package/docs/ai/components/radio.md +79 -0
- package/docs/ai/components/select.md +92 -0
- package/docs/ai/components/skeleton.md +57 -0
- package/docs/ai/components/switch.md +53 -0
- package/docs/ai/components/table.md +227 -0
- package/docs/ai/components/tabs.md +83 -0
- package/docs/ai/components/toast.md +140 -0
- package/docs/ai/components/tooltip.md +146 -0
- package/docs/ai/patterns.md +244 -0
- package/docs/components/accordion.md +558 -0
- package/docs/components/drawer.md +602 -0
- package/docs/components/modal.md +558 -0
- package/docs/components/nav.md +239 -0
- package/docs/components/pagination.md +289 -0
- package/docs/components/select.md +599 -0
- package/docs/components/switch.md +354 -0
- package/docs/components/tabs.md +546 -0
- package/docs/components/toast.md +506 -0
- package/docs/components/tooltip.md +523 -0
- package/docs/controllers.md +744 -0
- package/docs/elements.md +855 -0
- package/docs/events.md +807 -0
- package/docs/migration-v2-to-v3.md +569 -0
- package/docs/observe.md +588 -0
- package/docs/placards.md +401 -0
- package/docs/request-response.md +852 -0
- package/docs/routing.md +1186 -0
- package/package.json +10 -11
- package/dist/components/snice-cell-C9N6yGxQ.js +0 -4
- package/dist/components/snice-cell-C9N6yGxQ.js.map +0 -1
- package/dist/types/types/index.d.ts +0 -23
- /package/dist/{types/controller.d.ts → controller.d.ts} +0 -0
- /package/dist/{types/global.d.ts → global.d.ts} +0 -0
- /package/dist/{types/observe.d.ts → observe.d.ts} +0 -0
- /package/dist/{types/request-response.d.ts → request-response.d.ts} +0 -0
- /package/dist/{types/router.d.ts → router.d.ts} +0 -0
- /package/dist/{types/testing.d.ts → testing.d.ts} +0 -0
- /package/dist/{types/transitions.d.ts → transitions.d.ts} +0 -0
- /package/dist/types/{types/adopted-options.d.ts → adopted-options.d.ts} +0 -0
- /package/dist/types/{types/app-context.d.ts → app-context.d.ts} +0 -0
- /package/dist/types/{types/dispatch-options.d.ts → dispatch-options.d.ts} +0 -0
- /package/dist/types/{types/guard.d.ts → guard.d.ts} +0 -0
- /package/dist/types/{types/i-controller.d.ts → i-controller.d.ts} +0 -0
- /package/dist/types/{types/moved-options.d.ts → moved-options.d.ts} +0 -0
- /package/dist/types/{types/observe-options.d.ts → observe-options.d.ts} +0 -0
- /package/dist/types/{types/page-options.d.ts → page-options.d.ts} +0 -0
- /package/dist/types/{types/part-options.d.ts → part-options.d.ts} +0 -0
- /package/dist/types/{types/property-converter.d.ts → property-converter.d.ts} +0 -0
- /package/dist/types/{types/property-options.d.ts → property-options.d.ts} +0 -0
- /package/dist/types/{types/query-options.d.ts → query-options.d.ts} +0 -0
- /package/dist/types/{types/request-options.d.ts → request-options.d.ts} +0 -0
- /package/dist/types/{types/respond-options.d.ts → respond-options.d.ts} +0 -0
- /package/dist/types/{types/route-params.d.ts → route-params.d.ts} +0 -0
- /package/dist/types/{types/router-instance.d.ts → router-instance.d.ts} +0 -0
- /package/dist/types/{types/router-options.d.ts → router-options.d.ts} +0 -0
- /package/dist/types/{types/simple-array.d.ts → simple-array.d.ts} +0 -0
- /package/dist/types/{types/snice-element.d.ts → snice-element.d.ts} +0 -0
- /package/dist/types/{types/snice-global.d.ts → snice-global.d.ts} +0 -0
- /package/dist/types/{types/transition.d.ts → transition.d.ts} +0 -0
- /package/dist/{types/utils.d.ts → utils.d.ts} +0 -0
|
@@ -6,6 +6,8 @@ export declare const IS_ELEMENT_CLASS: symbol;
|
|
|
6
6
|
export declare const CHANNEL_HANDLERS: symbol;
|
|
7
7
|
export declare const READY_PROMISE: symbol;
|
|
8
8
|
export declare const READY_RESOLVE: symbol;
|
|
9
|
+
export declare const RENDERED_PROMISE: symbol;
|
|
10
|
+
export declare const RENDERED_RESOLVE: symbol;
|
|
9
11
|
export declare const CONTROLLER: symbol;
|
|
10
12
|
export declare const INITIALIZED: symbol;
|
|
11
13
|
export declare const ON_HANDLERS: symbol;
|
|
@@ -17,6 +19,7 @@ export declare const NATIVE_CONTROLLER: symbol;
|
|
|
17
19
|
export declare const CLEANUP: symbol;
|
|
18
20
|
export declare const PROPERTIES: symbol;
|
|
19
21
|
export declare const PROPERTY_VALUES: symbol;
|
|
22
|
+
export declare const PRE_INIT_PROPERTY_VALUES: symbol;
|
|
20
23
|
export declare const PROPERTIES_INITIALIZED: symbol;
|
|
21
24
|
export declare const PROPERTY_WATCHERS: symbol;
|
|
22
25
|
export declare const EXPLICITLY_SET_PROPERTIES: symbol;
|
|
@@ -35,3 +38,22 @@ export declare const PART_TIMERS: symbol;
|
|
|
35
38
|
export declare const MOVED_TIMERS: symbol;
|
|
36
39
|
export declare const ADOPTED_TIMERS: symbol;
|
|
37
40
|
export declare const DISPATCH_TIMERS: symbol;
|
|
41
|
+
export declare const RENDER_METHOD: symbol;
|
|
42
|
+
export declare const RENDER_OPTIONS: symbol;
|
|
43
|
+
export declare const RENDER_INSTANCE: symbol;
|
|
44
|
+
export declare const RENDER_SCHEDULED: symbol;
|
|
45
|
+
export declare const RENDER_TIMERS: symbol;
|
|
46
|
+
export declare const RENDER_CALLBACKS: symbol;
|
|
47
|
+
export declare const STYLES_METHOD: symbol;
|
|
48
|
+
export declare const STYLES_APPLIED: symbol;
|
|
49
|
+
export declare const CONTEXT_HANDLER: symbol;
|
|
50
|
+
export declare const CONTEXT_METHOD_NAME: symbol;
|
|
51
|
+
export declare const NAVIGATION_CONTEXT_INSTANCE: symbol;
|
|
52
|
+
export declare const REGISTERED_ELEMENTS: symbol;
|
|
53
|
+
export declare const IS_UPDATING: symbol;
|
|
54
|
+
export declare const CONTEXT_REGISTER: symbol;
|
|
55
|
+
export declare const CONTEXT_UNREGISTER: symbol;
|
|
56
|
+
export declare const CONTEXT_NOTIFY_ELEMENT: symbol;
|
|
57
|
+
export declare const CONTEXT_OPTIONS: symbol;
|
|
58
|
+
export declare const CONTEXT_TIMER: symbol;
|
|
59
|
+
export declare const CONTEXT_CALLED: symbol;
|
package/dist/symbols.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* snice
|
|
3
|
-
* Imperative TypeScript framework for building vanilla web components with decorators, routing, and controllers. No virtual DOM, no build complexity.
|
|
2
|
+
* snice v3.0.0
|
|
3
|
+
* Imperative TypeScript framework for building vanilla web components with decorators, differential rendering, routing, and controllers. No virtual DOM, no build complexity.
|
|
4
4
|
* (c) 2024
|
|
5
5
|
* Released under the MIT License.
|
|
6
6
|
*/
|
|
@@ -36,6 +36,8 @@ const CHANNEL_HANDLERS = getSymbol('channel-handlers');
|
|
|
36
36
|
// Internal element state symbols
|
|
37
37
|
const READY_PROMISE = getSymbol('ready-promise');
|
|
38
38
|
const READY_RESOLVE = getSymbol('ready-resolve');
|
|
39
|
+
const RENDERED_PROMISE = getSymbol('rendered-promise');
|
|
40
|
+
const RENDERED_RESOLVE = getSymbol('rendered-resolve');
|
|
39
41
|
const CONTROLLER = getSymbol('controller');
|
|
40
42
|
const INITIALIZED = getSymbol('initialized');
|
|
41
43
|
// Event handler symbols
|
|
@@ -51,6 +53,7 @@ const CLEANUP = getSymbol('cleanup');
|
|
|
51
53
|
// Property symbols
|
|
52
54
|
const PROPERTIES = getSymbol('properties');
|
|
53
55
|
const PROPERTY_VALUES = getSymbol('property-values');
|
|
56
|
+
const PRE_INIT_PROPERTY_VALUES = getSymbol('pre-init-property-values');
|
|
54
57
|
const PROPERTIES_INITIALIZED = getSymbol('properties-initialized');
|
|
55
58
|
const PROPERTY_WATCHERS = getSymbol('property-watchers');
|
|
56
59
|
const EXPLICITLY_SET_PROPERTIES = getSymbol('explicitly-set-properties');
|
|
@@ -75,6 +78,27 @@ const MOVED_TIMERS = getSymbol('moved-timers');
|
|
|
75
78
|
const ADOPTED_TIMERS = getSymbol('adopted-timers');
|
|
76
79
|
// Dispatch timing symbols
|
|
77
80
|
const DISPATCH_TIMERS = getSymbol('dispatch-timers');
|
|
81
|
+
// Render symbols (v3.0.0)
|
|
82
|
+
const RENDER_METHOD = getSymbol('render-method');
|
|
83
|
+
const RENDER_OPTIONS = getSymbol('render-options');
|
|
84
|
+
const RENDER_INSTANCE = getSymbol('render-instance');
|
|
85
|
+
const RENDER_SCHEDULED = getSymbol('render-scheduled');
|
|
86
|
+
const RENDER_TIMERS = getSymbol('render-timers');
|
|
87
|
+
const RENDER_CALLBACKS = getSymbol('render-callbacks');
|
|
88
|
+
const STYLES_METHOD = getSymbol('styles-method');
|
|
89
|
+
const STYLES_APPLIED = getSymbol('styles-applied');
|
|
90
|
+
// Navigation context symbols
|
|
91
|
+
const CONTEXT_HANDLER = getSymbol('context-handler');
|
|
92
|
+
const CONTEXT_METHOD_NAME = getSymbol('context-method-name');
|
|
93
|
+
const NAVIGATION_CONTEXT_INSTANCE = getSymbol('navigation-context-instance');
|
|
94
|
+
const REGISTERED_ELEMENTS = getSymbol('registered-elements');
|
|
95
|
+
const IS_UPDATING = getSymbol('is-updating');
|
|
96
|
+
const CONTEXT_REGISTER = getSymbol('context-register');
|
|
97
|
+
const CONTEXT_UNREGISTER = getSymbol('context-unregister');
|
|
98
|
+
const CONTEXT_NOTIFY_ELEMENT = getSymbol('context-notify-element');
|
|
99
|
+
const CONTEXT_OPTIONS = getSymbol('context-options');
|
|
100
|
+
const CONTEXT_TIMER = getSymbol('context-timer');
|
|
101
|
+
const CONTEXT_CALLED = getSymbol('context-called');
|
|
78
102
|
|
|
79
|
-
export { ADOPTED_HANDLERS, ADOPTED_TIMERS, CHANNEL_HANDLERS, CLEANUP, CONTEXT_REQUEST_HANDLER, CONTROLLER, CONTROLLER_ID, CONTROLLER_KEY, CONTROLLER_NAME_KEY, CONTROLLER_OPERATIONS, CREATED_AT, CURRENT_PAGE_MARKER, DISPATCH_TIMERS, DISPOSE_HANDLERS, EXPLICITLY_SET_PROPERTIES, INITIALIZED, IS_CONTROLLER_CLASS, IS_CONTROLLER_INSTANCE, IS_ELEMENT_CLASS, MOVED_HANDLERS, MOVED_TIMERS, NATIVE_CONTROLLER, OBSERVERS, ON_HANDLERS, PAGE_TRANSITION, PARTS, PART_TIMERS, PROPERTIES, PROPERTIES_INITIALIZED, PROPERTY_VALUES, PROPERTY_WATCHERS, READY_HANDLERS, READY_PROMISE, READY_RESOLVE, ROUTER_CONTEXT, getSymbol };
|
|
103
|
+
export { ADOPTED_HANDLERS, ADOPTED_TIMERS, CHANNEL_HANDLERS, CLEANUP, CONTEXT_CALLED, CONTEXT_HANDLER, CONTEXT_METHOD_NAME, CONTEXT_NOTIFY_ELEMENT, CONTEXT_OPTIONS, CONTEXT_REGISTER, CONTEXT_REQUEST_HANDLER, CONTEXT_TIMER, CONTEXT_UNREGISTER, CONTROLLER, CONTROLLER_ID, CONTROLLER_KEY, CONTROLLER_NAME_KEY, CONTROLLER_OPERATIONS, CREATED_AT, CURRENT_PAGE_MARKER, DISPATCH_TIMERS, DISPOSE_HANDLERS, EXPLICITLY_SET_PROPERTIES, INITIALIZED, IS_CONTROLLER_CLASS, IS_CONTROLLER_INSTANCE, IS_ELEMENT_CLASS, IS_UPDATING, MOVED_HANDLERS, MOVED_TIMERS, NATIVE_CONTROLLER, NAVIGATION_CONTEXT_INSTANCE, OBSERVERS, ON_HANDLERS, PAGE_TRANSITION, PARTS, PART_TIMERS, PRE_INIT_PROPERTY_VALUES, PROPERTIES, PROPERTIES_INITIALIZED, PROPERTY_VALUES, PROPERTY_WATCHERS, READY_HANDLERS, READY_PROMISE, READY_RESOLVE, REGISTERED_ELEMENTS, RENDERED_PROMISE, RENDERED_RESOLVE, RENDER_CALLBACKS, RENDER_INSTANCE, RENDER_METHOD, RENDER_OPTIONS, RENDER_SCHEDULED, RENDER_TIMERS, ROUTER_CONTEXT, STYLES_APPLIED, STYLES_METHOD, getSymbol };
|
|
80
104
|
//# sourceMappingURL=symbols.esm.js.map
|
package/dist/symbols.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"symbols.esm.js","sources":["../src/global.ts","../src/symbols.ts"],"sourcesContent":[null,null],"names":[],"mappings":";;;;;;AAAA;AACA;AAKA;AACA,SAAS,mBAAmB,GAAA;AAC1B,IAAA,IAAI,CAAE,UAAkB,CAAC,KAAK,EAAE;QAC7B,UAAkB,CAAC,KAAK,GAAG;YAC1B,kBAAkB,EAAE,IAAI,GAAG,EAAE;AAC7B,YAAA,mBAAmB,EAAE,CAAC;YACtB,OAAO,EAAE,IAAI,GAAG;SACjB;IACH;IACA,OAAQ,UAAkB,CAAC,KAAK;AAClC;AAEA;AACO,MAAM,KAAK,GAAG,mBAAmB,EAAE;AAE1C;AACM,SAAU,SAAS,CAAC,IAAY,EAAA;IACpC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CA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a,KAAK,GAAG,SAAS,CAAC,OAAO;MACzB,WAAW,GAAG,SAAS,CAAC,aAAa;AAElD;MACa,YAAY,GAAG,SAAS,CAAC,cAAc;MACvC,cAAc,GAAG,SAAS,CAAC,gBAAgB;AAExD;MACa,eAAe,GAAG,SAAS,CAAC,iBAAiB;AAE1D;MACa,aAAa,GAAG,SAAS,CAAC,eAAe;MACzC,cAAc,GAAG,SAAS,CAAC,gBAAgB;MAC3C,eAAe,GAAG,SAAS,CAAC,iBAAiB;MAC7C,gBAAgB,GAAG,SAAS,CAAC,kBAAkB;MAC/C,aAAa,GAAG,SAAS,CAAC,eAAe;MACzC,gBAAgB,GAAG,SAAS,CAAC,kBAAkB;MAC/C,aAAa,GAAG,SAAS,CAAC,eAAe;MACzC,cAAc,GAAG,SAAS,CAAC,gBAAgB;AAExD;MACa,eAAe,GAAG,SAAS,CAAC,iBAAiB;MAC7C,mBAAmB,GAAG,SAAS,CAAC,qBAAqB;MACrD,2BAA2B,GAAG,SAAS,CAAC,6BAA6B;MACrE,mBAAmB,GAAG,SAAS,CAAC,qBAAqB;MACrD,WAAW,GAAG,SAAS,CAAC,aAAa;MACrC,gBAAgB,GAAG,SAAS,CAAC,kBAAkB;MAC/C,kBAAkB,GAAG,SAAS,CAAC,oBAAoB;MACnD,sBAAsB,GAAG,SAAS,CAAC,wBAAwB;MAC3D,eAAe,GAAG,SAAS,CAAC,iBAAiB;MAC7C,aAAa,GAAG,SAAS,CAAC,eAAe;MACzC,cAAc,GAAG,SAAS,CAAC,gBAAgB;;;;"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Template system for Snice v3.0.0
|
|
3
|
+
* Inspired by lit-html but custom implementation
|
|
4
|
+
* Provides html`` and css`` tagged template processors with differential rendering
|
|
5
|
+
*/
|
|
6
|
+
export declare const HTML_RESULT: unique symbol;
|
|
7
|
+
export declare const CSS_RESULT: unique symbol;
|
|
8
|
+
/**
|
|
9
|
+
* Result of html`` tagged template
|
|
10
|
+
* Contains static strings and dynamic values for differential rendering
|
|
11
|
+
*/
|
|
12
|
+
export interface TemplateResult {
|
|
13
|
+
readonly _$litType$: typeof HTML_RESULT;
|
|
14
|
+
readonly strings: TemplateStringsArray;
|
|
15
|
+
readonly values: readonly any[];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Result of css`` tagged template
|
|
19
|
+
* Contains CSS text for style injection
|
|
20
|
+
*/
|
|
21
|
+
export interface CSSResult {
|
|
22
|
+
readonly _$litType$: typeof CSS_RESULT;
|
|
23
|
+
readonly cssText: string;
|
|
24
|
+
styleSheet?: CSSStyleSheet;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Tagged template function for creating HTML templates
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* html`<div class="card">
|
|
32
|
+
* <h1>${this.title}</h1>
|
|
33
|
+
* <button @click=${this.handleClick}>Click me</button>
|
|
34
|
+
* </div>`
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare function html(strings: TemplateStringsArray, ...values: any[]): TemplateResult;
|
|
38
|
+
/**
|
|
39
|
+
* Tagged template function for creating CSS
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```typescript
|
|
43
|
+
* css`:host {
|
|
44
|
+
* display: block;
|
|
45
|
+
* padding: 1rem;
|
|
46
|
+
* }`
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export declare function css(strings: TemplateStringsArray, ...values: any[]): CSSResult;
|
|
50
|
+
/**
|
|
51
|
+
* Check if a value is a TemplateResult
|
|
52
|
+
*/
|
|
53
|
+
export declare function isTemplateResult(value: any): value is TemplateResult;
|
|
54
|
+
/**
|
|
55
|
+
* Check if a value is a CSSResult
|
|
56
|
+
*/
|
|
57
|
+
export declare function isCSSResult(value: any): value is CSSResult;
|
|
58
|
+
/**
|
|
59
|
+
* Type guard for primitive values
|
|
60
|
+
*/
|
|
61
|
+
export declare function isPrimitive(value: any): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Sanitize HTML to prevent XSS
|
|
64
|
+
* Only allows safe HTML, escapes dangerous content
|
|
65
|
+
*/
|
|
66
|
+
export declare function sanitize(value: any): string;
|
|
67
|
+
/**
|
|
68
|
+
* Nothing - represents no value (different from null/undefined)
|
|
69
|
+
* Used to remove content from templates
|
|
70
|
+
*/
|
|
71
|
+
export declare const nothing: unique symbol;
|
|
72
|
+
/**
|
|
73
|
+
* Type for template values that represent "no content"
|
|
74
|
+
*/
|
|
75
|
+
export type Nothing = typeof nothing;
|
|
76
|
+
declare const UNSAFE_HTML: unique symbol;
|
|
77
|
+
/**
|
|
78
|
+
* Wrapper for raw HTML strings that should not be escaped
|
|
79
|
+
* WARNING: Only use with sanitized/trusted content to prevent XSS
|
|
80
|
+
*/
|
|
81
|
+
export interface UnsafeHTML {
|
|
82
|
+
readonly _$litType$: typeof UNSAFE_HTML;
|
|
83
|
+
readonly html: string;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Mark a string as raw HTML that should not be escaped
|
|
87
|
+
* WARNING: Only use with sanitized content - using user input can lead to XSS!
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```typescript
|
|
91
|
+
* const htmlString = '<span class="bold">Hello</span>';
|
|
92
|
+
* html`<div>${unsafeHTML(htmlString)}</div>`
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
export declare function unsafeHTML(html: string): UnsafeHTML;
|
|
96
|
+
/**
|
|
97
|
+
* Check if a value is an UnsafeHTML wrapper
|
|
98
|
+
*/
|
|
99
|
+
export declare function isUnsafeHTML(value: any): value is UnsafeHTML;
|
|
100
|
+
export {};
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* snice v3.0.0
|
|
3
|
+
* Imperative TypeScript framework for building vanilla web components with decorators, differential rendering, routing, and controllers. No virtual DOM, no build complexity.
|
|
4
|
+
* (c) 2024
|
|
5
|
+
* Released under the MIT License.
|
|
6
|
+
*/
|
|
7
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Generic transition system for animating between elements
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Parse CSS property string into an object
|
|
14
|
+
*/
|
|
15
|
+
function parseStyles(styleString) {
|
|
16
|
+
const styles = {};
|
|
17
|
+
styleString.split(';').forEach(rule => {
|
|
18
|
+
const [prop, value] = rule.split(':').map(s => s.trim());
|
|
19
|
+
if (prop && value) {
|
|
20
|
+
styles[prop] = value;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
return styles;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Perform a transition between two elements
|
|
27
|
+
*/
|
|
28
|
+
async function performTransition(container, oldElement, newElement, transition = {}) {
|
|
29
|
+
const outDuration = transition.outDuration || 300;
|
|
30
|
+
const inDuration = transition.inDuration || 300;
|
|
31
|
+
const mode = transition.mode || 'sequential';
|
|
32
|
+
// Default transitions
|
|
33
|
+
const outStyles = transition.out ? parseStyles(transition.out) : { opacity: '0' };
|
|
34
|
+
const inStartStyles = { opacity: '0' }; // Always start invisible
|
|
35
|
+
const inEndStyles = transition.in ? parseStyles(transition.in) : { opacity: '1' };
|
|
36
|
+
// Set container to relative positioning to allow absolute positioning
|
|
37
|
+
// Skip for layout elements to avoid jumpy transitions
|
|
38
|
+
const containerStyle = container.style;
|
|
39
|
+
const originalPosition = containerStyle.position;
|
|
40
|
+
const isLayoutElement = container.tagName.includes('-') && container.shadowRoot;
|
|
41
|
+
if (!isLayoutElement) {
|
|
42
|
+
containerStyle.position = 'relative';
|
|
43
|
+
}
|
|
44
|
+
// Check if elements are slotted (inside a layout)
|
|
45
|
+
const isSlottedTransition = oldElement.hasAttribute('slot') || newElement.hasAttribute('slot');
|
|
46
|
+
if (isSlottedTransition) {
|
|
47
|
+
// For slotted elements, use absolute with width/height for crossfade
|
|
48
|
+
oldElement.style.position = 'absolute';
|
|
49
|
+
oldElement.style.width = '100%';
|
|
50
|
+
oldElement.style.height = '100%';
|
|
51
|
+
oldElement.style.transition = `opacity ${outDuration}ms ease-in-out`;
|
|
52
|
+
newElement.style.position = 'absolute';
|
|
53
|
+
newElement.style.width = '100%';
|
|
54
|
+
newElement.style.height = '100%';
|
|
55
|
+
newElement.style.transition = `opacity ${inDuration}ms ease-in-out`;
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
// Original absolute positioning for non-slotted elements
|
|
59
|
+
oldElement.style.position = 'absolute';
|
|
60
|
+
oldElement.style.top = '0';
|
|
61
|
+
oldElement.style.left = '0';
|
|
62
|
+
oldElement.style.width = '100%';
|
|
63
|
+
oldElement.style.transition = `all ${outDuration}ms ease-in-out`;
|
|
64
|
+
newElement.style.position = 'absolute';
|
|
65
|
+
newElement.style.top = '0';
|
|
66
|
+
newElement.style.left = '0';
|
|
67
|
+
newElement.style.width = '100%';
|
|
68
|
+
}
|
|
69
|
+
Object.assign(newElement.style, inStartStyles);
|
|
70
|
+
newElement.style.transition = `all ${inDuration}ms ease-in-out`;
|
|
71
|
+
// Add new element to container
|
|
72
|
+
container.appendChild(newElement);
|
|
73
|
+
// Force browser to calculate styles
|
|
74
|
+
void newElement.offsetHeight;
|
|
75
|
+
if (mode === 'simultaneous') {
|
|
76
|
+
// Start both transitions at once
|
|
77
|
+
Object.assign(oldElement.style, outStyles);
|
|
78
|
+
Object.assign(newElement.style, inEndStyles);
|
|
79
|
+
// Wait for both transitions to complete
|
|
80
|
+
await new Promise(resolve => setTimeout(resolve, Math.max(outDuration, inDuration)));
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
// Sequential: transition out old, then transition in new
|
|
84
|
+
Object.assign(oldElement.style, outStyles);
|
|
85
|
+
await new Promise(resolve => setTimeout(resolve, outDuration));
|
|
86
|
+
Object.assign(newElement.style, inEndStyles);
|
|
87
|
+
await new Promise(resolve => setTimeout(resolve, inDuration));
|
|
88
|
+
}
|
|
89
|
+
// Cleanup
|
|
90
|
+
oldElement.remove();
|
|
91
|
+
if (isSlottedTransition) {
|
|
92
|
+
// Cleanup for slotted elements
|
|
93
|
+
newElement.style.position = '';
|
|
94
|
+
newElement.style.width = '';
|
|
95
|
+
newElement.style.height = '';
|
|
96
|
+
newElement.style.transition = '';
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
// Cleanup for non-slotted elements
|
|
100
|
+
newElement.style.position = '';
|
|
101
|
+
newElement.style.top = '';
|
|
102
|
+
newElement.style.left = '';
|
|
103
|
+
newElement.style.width = '';
|
|
104
|
+
newElement.style.transition = '';
|
|
105
|
+
}
|
|
106
|
+
// Reset any transition styles
|
|
107
|
+
Object.keys({ ...inStartStyles, ...inEndStyles }).forEach(prop => {
|
|
108
|
+
newElement.style[prop] = '';
|
|
109
|
+
});
|
|
110
|
+
if (!isLayoutElement) {
|
|
111
|
+
containerStyle.position = originalPosition;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Predefined transitions
|
|
116
|
+
*/
|
|
117
|
+
// Fade transition
|
|
118
|
+
const fadeTransition = {
|
|
119
|
+
name: 'fade',
|
|
120
|
+
outDuration: 200,
|
|
121
|
+
inDuration: 200,
|
|
122
|
+
out: 'opacity: 0',
|
|
123
|
+
in: 'opacity: 1',
|
|
124
|
+
mode: 'simultaneous'
|
|
125
|
+
};
|
|
126
|
+
// Slide transition (from left)
|
|
127
|
+
const slideTransition = {
|
|
128
|
+
name: 'slide',
|
|
129
|
+
outDuration: 300,
|
|
130
|
+
inDuration: 300,
|
|
131
|
+
out: 'transform: translateX(-100%)',
|
|
132
|
+
in: 'transform: translateX(0)',
|
|
133
|
+
mode: 'sequential'
|
|
134
|
+
};
|
|
135
|
+
// Slide from right
|
|
136
|
+
const slideRightTransition = {
|
|
137
|
+
name: 'slide-right',
|
|
138
|
+
outDuration: 300,
|
|
139
|
+
inDuration: 300,
|
|
140
|
+
out: 'transform: translateX(100%)',
|
|
141
|
+
in: 'transform: translateX(0)',
|
|
142
|
+
mode: 'sequential'
|
|
143
|
+
};
|
|
144
|
+
// Slide from top
|
|
145
|
+
const slideUpTransition = {
|
|
146
|
+
name: 'slide-up',
|
|
147
|
+
outDuration: 300,
|
|
148
|
+
inDuration: 300,
|
|
149
|
+
out: 'transform: translateY(-100%)',
|
|
150
|
+
in: 'transform: translateY(0)',
|
|
151
|
+
mode: 'sequential'
|
|
152
|
+
};
|
|
153
|
+
// Slide from bottom
|
|
154
|
+
const slideDownTransition = {
|
|
155
|
+
name: 'slide-down',
|
|
156
|
+
outDuration: 300,
|
|
157
|
+
inDuration: 300,
|
|
158
|
+
out: 'transform: translateY(100%)',
|
|
159
|
+
in: 'transform: translateY(0)',
|
|
160
|
+
mode: 'sequential'
|
|
161
|
+
};
|
|
162
|
+
// Scale transition
|
|
163
|
+
const scaleTransition = {
|
|
164
|
+
name: 'scale',
|
|
165
|
+
outDuration: 250,
|
|
166
|
+
inDuration: 250,
|
|
167
|
+
out: 'transform: scale(0.9); opacity: 0',
|
|
168
|
+
in: 'transform: scale(1); opacity: 1',
|
|
169
|
+
mode: 'simultaneous'
|
|
170
|
+
};
|
|
171
|
+
// Rotate transition
|
|
172
|
+
const rotateTransition = {
|
|
173
|
+
name: 'rotate',
|
|
174
|
+
outDuration: 400,
|
|
175
|
+
inDuration: 400,
|
|
176
|
+
out: 'transform: rotate(180deg) scale(0.5); opacity: 0',
|
|
177
|
+
in: 'transform: rotate(0) scale(1); opacity: 1',
|
|
178
|
+
mode: 'simultaneous'
|
|
179
|
+
};
|
|
180
|
+
// Flip transition
|
|
181
|
+
const flipTransition = {
|
|
182
|
+
name: 'flip',
|
|
183
|
+
outDuration: 400,
|
|
184
|
+
inDuration: 400,
|
|
185
|
+
out: 'transform: rotateY(180deg); opacity: 0',
|
|
186
|
+
in: 'transform: rotateY(0); opacity: 1',
|
|
187
|
+
mode: 'sequential'
|
|
188
|
+
};
|
|
189
|
+
// Zoom transition
|
|
190
|
+
const zoomTransition = {
|
|
191
|
+
name: 'zoom',
|
|
192
|
+
outDuration: 300,
|
|
193
|
+
inDuration: 300,
|
|
194
|
+
out: 'transform: scale(2); opacity: 0',
|
|
195
|
+
in: 'transform: scale(1); opacity: 1',
|
|
196
|
+
mode: 'simultaneous'
|
|
197
|
+
};
|
|
198
|
+
// None transition (instant swap)
|
|
199
|
+
const noneTransition = {
|
|
200
|
+
name: 'none',
|
|
201
|
+
outDuration: 0,
|
|
202
|
+
inDuration: 0,
|
|
203
|
+
out: '',
|
|
204
|
+
in: '',
|
|
205
|
+
mode: 'simultaneous'
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
exports.fadeTransition = fadeTransition;
|
|
209
|
+
exports.flipTransition = flipTransition;
|
|
210
|
+
exports.noneTransition = noneTransition;
|
|
211
|
+
exports.performTransition = performTransition;
|
|
212
|
+
exports.rotateTransition = rotateTransition;
|
|
213
|
+
exports.scaleTransition = scaleTransition;
|
|
214
|
+
exports.slideDownTransition = slideDownTransition;
|
|
215
|
+
exports.slideRightTransition = slideRightTransition;
|
|
216
|
+
exports.slideTransition = slideTransition;
|
|
217
|
+
exports.slideUpTransition = slideUpTransition;
|
|
218
|
+
exports.zoomTransition = zoomTransition;
|
|
219
|
+
//# sourceMappingURL=transitions.cjs.map
|
package/dist/transitions.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* snice
|
|
3
|
-
* Imperative TypeScript framework for building vanilla web components with decorators, routing, and controllers. No virtual DOM, no build complexity.
|
|
2
|
+
* snice v3.0.0
|
|
3
|
+
* Imperative TypeScript framework for building vanilla web components with decorators, differential rendering, routing, and controllers. No virtual DOM, no build complexity.
|
|
4
4
|
* (c) 2024
|
|
5
5
|
* Released under the MIT License.
|
|
6
6
|
*/
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { AppContext } from './app-context';
|
|
2
|
+
import { NavContext } from './nav-context';
|
|
3
|
+
import { Placard } from './placard';
|
|
4
|
+
import { RouteParams } from './route-params';
|
|
5
|
+
import { REGISTERED_ELEMENTS, IS_UPDATING, CONTEXT_REGISTER, CONTEXT_UNREGISTER, CONTEXT_NOTIFY_ELEMENT } from '../symbols';
|
|
6
|
+
declare const REGISTERED_ELEMENTS_SET: unique symbol;
|
|
7
|
+
/**
|
|
8
|
+
* Represents the bundled router state that can notify registered elements of changes
|
|
9
|
+
*/
|
|
10
|
+
export declare class Context {
|
|
11
|
+
[REGISTERED_ELEMENTS]: WeakMap<HTMLElement, string>;
|
|
12
|
+
[IS_UPDATING]: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Register an element to receive context updates
|
|
15
|
+
* @internal Used by @context decorator
|
|
16
|
+
*/
|
|
17
|
+
[CONTEXT_REGISTER]: (element: HTMLElement, methodName: string) => void;
|
|
18
|
+
/**
|
|
19
|
+
* Unregister an element from receiving context updates
|
|
20
|
+
* @internal Used by @context decorator cleanup
|
|
21
|
+
*/
|
|
22
|
+
[CONTEXT_UNREGISTER]: (element: HTMLElement) => void;
|
|
23
|
+
/**
|
|
24
|
+
* Notify a specific element of the current context state
|
|
25
|
+
* @internal Used by @context decorator
|
|
26
|
+
*/
|
|
27
|
+
[CONTEXT_NOTIFY_ELEMENT]: (element: HTMLElement) => void;
|
|
28
|
+
private [REGISTERED_ELEMENTS_SET];
|
|
29
|
+
/**
|
|
30
|
+
* Unique immutable identifier for this context instance
|
|
31
|
+
*/
|
|
32
|
+
readonly id: number;
|
|
33
|
+
/**
|
|
34
|
+
* Application context (theme, auth, config, etc.)
|
|
35
|
+
*/
|
|
36
|
+
application: AppContext;
|
|
37
|
+
/**
|
|
38
|
+
* Navigation state
|
|
39
|
+
*/
|
|
40
|
+
navigation: NavContext;
|
|
41
|
+
constructor(context?: AppContext, placards?: Placard[], currentRoute?: string, routeParams?: RouteParams);
|
|
42
|
+
/**
|
|
43
|
+
* Update the context and notify all registered elements
|
|
44
|
+
* Prevents infinite loops by tracking update state
|
|
45
|
+
*/
|
|
46
|
+
update(context: AppContext, placards: Placard[], currentRoute: string, routeParams: RouteParams): void;
|
|
47
|
+
}
|
|
48
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options for configuring custom elements via the @element decorator
|
|
3
|
+
*/
|
|
4
|
+
export interface ElementOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Whether this element is form-associated.
|
|
7
|
+
* Form-associated elements can participate in form submission and validation.
|
|
8
|
+
* When true, the element will have access to ElementInternals for form integration.
|
|
9
|
+
*
|
|
10
|
+
* @default false
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* @element('my-input', { formAssociated: true })
|
|
15
|
+
* class MyInput extends HTMLElement {
|
|
16
|
+
* private internals!: ElementInternals;
|
|
17
|
+
*
|
|
18
|
+
* constructor() {
|
|
19
|
+
* super();
|
|
20
|
+
* this.internals = this.attachInternals();
|
|
21
|
+
* }
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
formAssociated?: boolean;
|
|
26
|
+
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,9 +1,25 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export * from './
|
|
1
|
+
export * from './query-options';
|
|
2
|
+
export * from './property-options';
|
|
3
|
+
export * from './property-converter';
|
|
4
|
+
export * from './snice-element';
|
|
5
|
+
export * from './part-options';
|
|
6
|
+
export * from './moved-options';
|
|
7
|
+
export * from './adopted-options';
|
|
8
|
+
export * from './element-options';
|
|
9
|
+
export * from './simple-array';
|
|
10
|
+
export * from './router-options';
|
|
11
|
+
export * from './page-options';
|
|
12
|
+
export * from './router-instance';
|
|
13
|
+
export * from './on-options';
|
|
14
|
+
export * from './dispatch-options';
|
|
15
|
+
export * from './i-controller';
|
|
16
|
+
export * from './transition';
|
|
17
|
+
export * from './observe-options';
|
|
18
|
+
export * from './request-options';
|
|
19
|
+
export * from './respond-options';
|
|
20
|
+
export * from './snice-global';
|
|
21
|
+
export * from './placard';
|
|
22
|
+
export * from './guard';
|
|
23
|
+
export * from './route-params';
|
|
24
|
+
export * from './app-context';
|
|
25
|
+
export * from './context';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Placard } from './placard';
|
|
2
|
+
import { RouteParams } from './route-params';
|
|
3
|
+
/**
|
|
4
|
+
* Navigation context containing route state
|
|
5
|
+
*/
|
|
6
|
+
export interface NavContext {
|
|
7
|
+
/**
|
|
8
|
+
* All registered placards from pages
|
|
9
|
+
*/
|
|
10
|
+
placards: Placard[];
|
|
11
|
+
/**
|
|
12
|
+
* Current route path
|
|
13
|
+
*/
|
|
14
|
+
route: string;
|
|
15
|
+
/**
|
|
16
|
+
* Route parameters extracted from current route
|
|
17
|
+
*/
|
|
18
|
+
params: RouteParams;
|
|
19
|
+
}
|
|
@@ -77,7 +77,6 @@ export interface Placard<T = any> {
|
|
|
77
77
|
show?: boolean;
|
|
78
78
|
/**
|
|
79
79
|
* Guard functions that determine if the page should appear in navigation.
|
|
80
|
-
* Reuses the same guard system as route protection.
|
|
81
80
|
* @example [isAuthenticated, hasAdminRole]
|
|
82
81
|
*/
|
|
83
82
|
visibleOn?: Guard<T> | Guard<T>[];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# AI-Optimized Documentation
|
|
2
|
+
|
|
3
|
+
Token-efficient reference docs for AI assistants. Same content as human docs, minimal verbosity.
|
|
4
|
+
|
|
5
|
+
**Format:**
|
|
6
|
+
- Type signatures over prose
|
|
7
|
+
- Bullet points over paragraphs
|
|
8
|
+
- Code over explanations
|
|
9
|
+
- No tutorials, pure reference
|
|
10
|
+
|
|
11
|
+
**Files:**
|
|
12
|
+
- `api.md` - Complete API reference
|
|
13
|
+
- `patterns.md` - Common usage patterns
|
|
14
|
+
- `architecture.md` - System design
|
|
15
|
+
- `components/*.md` - Component reference, if asked to build using a component
|
|
16
|
+
|
|
17
|
+
Read these instead of `/docs/*.md` for faster context loading.
|