@sticky-aside/vue 0.0.0-stage → 1.0.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 maprox
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,62 @@
1
- # Temporary Holding Version
1
+ # @sticky-aside/vue
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Vue 3 adapter for [@sticky-aside/core](https://github.com/maprox/sticky-aside#readme).
4
+
5
+ ```bash
6
+ npm install @sticky-aside/vue
7
+ ```
8
+
9
+ The offset is a CSS length. Two ways to set it.
10
+
11
+ ### Your own class
12
+
13
+ `top-class` replaces `sticky-aside-top`. `bottom-class` replaces `sticky-aside-bottom`. The library measures the gap between those two rules, so both have to exist. This variant leaves out `offsets.css`.
14
+
15
+ The classes land on an inner element and on a measure node created in script. A scoped selector has to use `:deep` to reach them.
16
+
17
+ ```vue
18
+ <script setup lang="ts">
19
+ import { StickyAside } from '@sticky-aside/vue'
20
+ </script>
21
+
22
+ <template>
23
+ <StickyAside as="aside" top-class="top-10" bottom-class="bottom-0">
24
+ <nav>...</nav>
25
+ </StickyAside>
26
+ </template>
27
+
28
+ <style scoped>
29
+ :deep(.top-10) {
30
+ top: 40px;
31
+ }
32
+
33
+ :deep(.bottom-0) {
34
+ bottom: 0;
35
+ }
36
+ </style>
37
+ ```
38
+
39
+ ### `offsets.css`
40
+
41
+ Import the stylesheet once. It defines `sticky-aside-top` and `sticky-aside-bottom`. Set `--sticky-aside-top` on an ancestor. The default is `0px`.
42
+
43
+ ```vue
44
+ <script setup lang="ts">
45
+ import { StickyAside } from '@sticky-aside/vue'
46
+ import '@sticky-aside/core/offsets.css'
47
+ </script>
48
+
49
+ <template>
50
+ <div class="layout">
51
+ <StickyAside as="aside">
52
+ <nav>...</nav>
53
+ </StickyAside>
54
+ </div>
55
+ </template>
56
+
57
+ <style scoped>
58
+ .layout {
59
+ --sticky-aside-top: 40px;
60
+ }
61
+ </style>
62
+ ```
@@ -0,0 +1,42 @@
1
+ import { StickyAsideState } from "@sticky-aside/core";
2
+ //#region src/StickyAside.vue.d.ts
3
+ interface Props {
4
+ as?: 'div' | 'aside' | 'nav' | 'section';
5
+ topClass?: string;
6
+ bottomClass?: string;
7
+ contentClass?: string;
8
+ disabled?: boolean;
9
+ locked?: boolean;
10
+ allowLockedOverflowTop?: boolean;
11
+ allowLockedOverflowBottom?: boolean;
12
+ }
13
+ declare var __VLS_7: {};
14
+ type __VLS_Slots = {} & {
15
+ default?: (props: typeof __VLS_7) => any;
16
+ };
17
+ declare const __VLS_base: import("vue").DefineComponent<Props, {
18
+ element: import("vue").Ref<HTMLElement | undefined, HTMLElement | undefined>;
19
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
20
+ "state-change": (state: StickyAsideState) => any;
21
+ }, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
22
+ "onState-change"?: ((state: StickyAsideState) => any) | undefined;
23
+ }>, {
24
+ as: "div" | "aside" | "nav" | "section";
25
+ topClass: string;
26
+ bottomClass: string;
27
+ contentClass: string;
28
+ disabled: boolean;
29
+ locked: boolean;
30
+ allowLockedOverflowTop: boolean;
31
+ allowLockedOverflowBottom: boolean;
32
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
33
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
34
+ declare const _default: typeof __VLS_export;
35
+ type __VLS_WithSlots<T, S> = T & {
36
+ new (): {
37
+ $slots: S;
38
+ };
39
+ };
40
+ //#endregion
41
+ export { _default as StickyAside };
42
+ //# sourceMappingURL=index.d.ts.map
package/dist/index.js ADDED
@@ -0,0 +1,80 @@
1
+ import { createBlock, createElementVNode, defineComponent, onBeforeUnmount, onMounted, openBlock, ref, renderSlot, resolveDynamicComponent, watch, withCtx } from "vue";
2
+ import { OFFSET_CLASS, createStickyAside } from "@sticky-aside/core";
3
+
4
+ //#region src/StickyAside.vue
5
+ const _sfc_main = /*@__PURE__*/ defineComponent({
6
+ __name: "StickyAside",
7
+ props: {
8
+ as: { default: "div" },
9
+ topClass: { default: OFFSET_CLASS.top },
10
+ bottomClass: { default: OFFSET_CLASS.bottom },
11
+ contentClass: { default: "" },
12
+ disabled: {
13
+ type: Boolean,
14
+ default: false
15
+ },
16
+ locked: {
17
+ type: Boolean,
18
+ default: false
19
+ },
20
+ allowLockedOverflowTop: {
21
+ type: Boolean,
22
+ default: false
23
+ },
24
+ allowLockedOverflowBottom: {
25
+ type: Boolean,
26
+ default: false
27
+ }
28
+ },
29
+ emits: ["state-change"],
30
+ setup(__props, { expose: __expose, emit: __emit }) {
31
+ const props = __props;
32
+ const emit = __emit;
33
+ const element = ref();
34
+ const content = ref();
35
+ let aside;
36
+ __expose({ element });
37
+ onMounted(() => {
38
+ aside = createStickyAside({
39
+ wrapper: element.value,
40
+ content: content.value,
41
+ topClass: props.topClass,
42
+ bottomClass: props.bottomClass,
43
+ contentClass: props.contentClass,
44
+ disabled: props.disabled,
45
+ locked: props.locked,
46
+ allowLockedOverflowTop: props.allowLockedOverflowTop,
47
+ allowLockedOverflowBottom: props.allowLockedOverflowBottom,
48
+ onStateChange(state) {
49
+ emit("state-change", state);
50
+ }
51
+ });
52
+ });
53
+ onBeforeUnmount(() => {
54
+ aside?.destroy();
55
+ });
56
+ watch(() => props.locked, (locked) => aside?.setLocked(locked));
57
+ watch(() => props.disabled, (disabled) => aside?.setDisabled(disabled));
58
+ watch(() => props.topClass, (topClass) => aside?.setClasses({ topClass }));
59
+ watch(() => props.bottomClass, (bottomClass) => aside?.setClasses({ bottomClass }));
60
+ watch(() => props.contentClass, (contentClass) => aside?.setClasses({ contentClass }));
61
+ watch(() => [props.allowLockedOverflowTop, props.allowLockedOverflowBottom], ([allowTop, allowBottom]) => aside?.setAllowLockedOverflow(allowTop, allowBottom));
62
+ return (_ctx, _cache) => {
63
+ return openBlock(), createBlock(resolveDynamicComponent(__props.as), {
64
+ ref_key: "element",
65
+ ref: element,
66
+ class: "sticky-aside-root"
67
+ }, {
68
+ default: withCtx(() => [createElementVNode("div", {
69
+ ref_key: "content",
70
+ ref: content
71
+ }, [renderSlot(_ctx.$slots, "default")], 512)]),
72
+ _: 3
73
+ }, 512);
74
+ };
75
+ }
76
+ });
77
+
78
+ //#endregion
79
+ export { _sfc_main as StickyAside };
80
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["_openBlock","_createBlock","_resolveDynamicComponent","_withCtx","_createElementVNode","_renderSlot"],"sources":["../src/StickyAside.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { onBeforeUnmount, onMounted, ref, watch } from 'vue'\nimport { createStickyAside, OFFSET_CLASS } from '@sticky-aside/core'\nimport type { StickyAsideController, StickyAsideState } from '@sticky-aside/core'\n\ninterface Props {\n as?: 'div' | 'aside' | 'nav' | 'section'\n topClass?: string\n bottomClass?: string\n contentClass?: string\n disabled?: boolean\n locked?: boolean\n allowLockedOverflowTop?: boolean\n allowLockedOverflowBottom?: boolean\n}\n\nconst props = withDefaults(defineProps<Props>(), {\n as: 'div',\n topClass: OFFSET_CLASS.top,\n bottomClass: OFFSET_CLASS.bottom,\n contentClass: '',\n disabled: false,\n locked: false,\n allowLockedOverflowTop: false,\n allowLockedOverflowBottom: false,\n})\n\nconst emit = defineEmits<{ 'state-change': [state: StickyAsideState] }>()\n\nconst element = ref<HTMLElement>()\nconst content = ref<HTMLElement>()\nlet aside: StickyAsideController | undefined\n\ndefineExpose({ element })\n\nonMounted(() => {\n aside = createStickyAside({\n wrapper: element.value!,\n content: content.value!,\n topClass: props.topClass,\n bottomClass: props.bottomClass,\n contentClass: props.contentClass,\n disabled: props.disabled,\n locked: props.locked,\n allowLockedOverflowTop: props.allowLockedOverflowTop,\n allowLockedOverflowBottom: props.allowLockedOverflowBottom,\n onStateChange(state) {\n emit('state-change', state)\n },\n })\n})\n\nonBeforeUnmount(() => {\n aside?.destroy()\n})\n\nwatch(() => props.locked, (locked) => aside?.setLocked(locked))\nwatch(() => props.disabled, (disabled) => aside?.setDisabled(disabled))\nwatch(() => props.topClass, (topClass) => aside?.setClasses({ topClass }))\nwatch(() => props.bottomClass, (bottomClass) => aside?.setClasses({ bottomClass }))\nwatch(() => props.contentClass, (contentClass) => aside?.setClasses({ contentClass }))\nwatch(\n () => [props.allowLockedOverflowTop, props.allowLockedOverflowBottom] as const,\n ([allowTop, allowBottom]) => aside?.setAllowLockedOverflow(allowTop, allowBottom),\n)\n</script>\n\n<template>\n <component :is=\"as\" ref=\"element\" class=\"sticky-aside-root\">\n <div ref=\"content\">\n <slot />\n </div>\n </component>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBA,MAAM,QAAQ;EAWd,MAAM,OAAO;EAEb,MAAM,UAAU,IAAiB;EACjC,MAAM,UAAU,IAAiB;EACjC,IAAI;EAEJ,SAAa,EAAE,QAAQ,CAAC;EAExB,gBAAgB;GACd,QAAQ,kBAAkB;IACxB,SAAS,QAAQ;IACjB,SAAS,QAAQ;IACjB,UAAU,MAAM;IAChB,aAAa,MAAM;IACnB,cAAc,MAAM;IACpB,UAAU,MAAM;IAChB,QAAQ,MAAM;IACd,wBAAwB,MAAM;IAC9B,2BAA2B,MAAM;IACjC,cAAc,OAAO;KACnB,KAAK,gBAAgB,KAAK;IAC5B;GACF,CAAC;EACH,CAAC;EAED,sBAAsB;GACpB,OAAO,QAAQ;EACjB,CAAC;EAED,YAAY,MAAM,SAAS,WAAW,OAAO,UAAU,MAAM,CAAC;EAC9D,YAAY,MAAM,WAAW,aAAa,OAAO,YAAY,QAAQ,CAAC;EACtE,YAAY,MAAM,WAAW,aAAa,OAAO,WAAW,EAAE,SAAS,CAAC,CAAC;EACzE,YAAY,MAAM,cAAc,gBAAgB,OAAO,WAAW,EAAE,YAAY,CAAC,CAAC;EAClF,YAAY,MAAM,eAAe,iBAAiB,OAAO,WAAW,EAAE,aAAa,CAAC,CAAC;EACrF,YACQ,CAAC,MAAM,wBAAwB,MAAM,yBAAyB,IACnE,CAAC,UAAU,iBAAiB,OAAO,uBAAuB,UAAU,WAAW,CAClF;;GAIE,OAAAA,UAAA,GAAAC,YAIYC,wBAJI,QAAA,EAAE,GAAA;IAAM,SAAA;IAAJ,KAAI;IAAU,OAAM;;IACtC,SAAAC,cAEM,CAFNC,mBAEM,OAAA;KAFG,SAAA;KAAJ,KAAI;OACP,CAAAC,WAAQ,KAAA,QAAA,SAAA,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,44 @@
1
1
  {
2
2
  "name": "@sticky-aside/vue",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "1.0.1",
4
+ "description": "Vue adapter for @sticky-aside/core.",
5
+ "keywords": [
6
+ "sticky",
7
+ "sidebar",
8
+ "aside",
9
+ "scroll",
10
+ "vue"
11
+ ],
12
+ "license": "MIT",
13
+ "author": "maprox",
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/maprox/sticky-aside.git",
17
+ "directory": "packages/vue"
18
+ },
19
+ "homepage": "https://github.com/maprox/sticky-aside#readme",
20
+ "bugs": "https://github.com/maprox/sticky-aside/issues",
21
+ "type": "module",
22
+ "sideEffects": false,
23
+ "imports": {
24
+ "#vue/*": "./src/*"
25
+ },
26
+ "exports": {
27
+ ".": {
28
+ "types": "./dist/index.d.ts",
29
+ "import": "./dist/index.js"
30
+ }
31
+ },
32
+ "files": [
33
+ "dist"
34
+ ],
35
+ "dependencies": {
36
+ "@sticky-aside/core": "^1.0.1"
37
+ },
38
+ "peerDependencies": {
39
+ "vue": "^3.5.0"
40
+ },
41
+ "scripts": {
42
+ "build": "pnpm --dir ../.. exec tsdown --config packages/vue/tsdown.config.mjs"
43
+ }
6
44
  }