sliced-areas 1.0.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.
@@ -0,0 +1,182 @@
1
+ sliced-areas {
2
+ display: block;
3
+ height: 100%;
4
+ width: 100%;
5
+ }
6
+
7
+ .sliced-areas-root {
8
+ position: relative;
9
+ height: 100%;
10
+ width: 100%;
11
+ grid-row: 1 / -1;
12
+ grid-column: 1 / -1;
13
+ overflow: hidden;
14
+ background: #2f2f2f;
15
+ background-image: linear-gradient(180deg, #353535 0%, #2b2b2b 100%);
16
+ }
17
+
18
+ .sliced-areas-stash {
19
+ display: none;
20
+ }
21
+
22
+ .sliced-areas-area {
23
+ position: absolute;
24
+ display: flex;
25
+ min-height: 0;
26
+ min-width: 0;
27
+ border: 1px solid rgba(255, 255, 255, 0.06);
28
+ background: linear-gradient(180deg, #3a3a3a 0%, #2f2f2f 100%);
29
+ border-radius: 10px;
30
+ overflow: hidden;
31
+ box-shadow:
32
+ inset 0 1px 0 rgba(255, 255, 255, 0.08),
33
+ inset 0 -1px 0 rgba(0, 0, 0, 0.35),
34
+ 0 0 0 1px rgba(0, 0, 0, 0.35);
35
+ box-sizing: border-box;
36
+ }
37
+
38
+ .sliced-areas-area:hover {
39
+ border-color: rgba(200, 200, 200, 0.22);
40
+ box-shadow:
41
+ inset 0 1px 0 rgba(255, 255, 255, 0.08),
42
+ inset 0 -1px 0 rgba(0, 0, 0, 0.35),
43
+ 0 0 0 1px rgba(0, 0, 0, 0.35),
44
+ 0 0 0 1px rgba(200, 200, 200, 0.16);
45
+ }
46
+
47
+ .sliced-areas-auto-content {
48
+ display: flex;
49
+ align-items: center;
50
+ justify-content: center;
51
+ color: #e2e8f0;
52
+ font-size: 14px;
53
+ letter-spacing: 0.08em;
54
+ text-transform: uppercase;
55
+ height: 100%;
56
+ width: 100%;
57
+ }
58
+
59
+ .sliced-areas-handle {
60
+ position: absolute;
61
+ background: transparent;
62
+ z-index: 5;
63
+ border-radius: 999px;
64
+ box-shadow: none;
65
+ opacity: 0;
66
+ }
67
+
68
+ .sliced-areas-handle:hover {
69
+ background: transparent;
70
+ }
71
+
72
+ .sliced-areas-handle.is-vertical {
73
+ cursor: col-resize;
74
+ }
75
+
76
+ .sliced-areas-handle.is-horizontal {
77
+ cursor: row-resize;
78
+ }
79
+
80
+ .sliced-areas-overlay {
81
+ position: absolute;
82
+ inset: 0;
83
+ pointer-events: none;
84
+ z-index: 6;
85
+ }
86
+
87
+ .sliced-areas-corner {
88
+ position: absolute;
89
+ width: 14px;
90
+ height: 14px;
91
+ border-radius: 3px;
92
+ background: transparent;
93
+ border: 0;
94
+ box-shadow: none;
95
+ opacity: 0;
96
+ pointer-events: auto;
97
+ }
98
+
99
+ .sliced-areas-corner.is-top-left {
100
+ top: 0;
101
+ left: 0;
102
+ }
103
+
104
+ .sliced-areas-corner.is-top-right {
105
+ top: 0;
106
+ right: 0;
107
+ }
108
+
109
+ .sliced-areas-corner.is-bottom-left {
110
+ bottom: 0;
111
+ left: 0;
112
+ }
113
+
114
+ .sliced-areas-corner.is-bottom-right {
115
+ bottom: 0;
116
+ right: 0;
117
+ }
118
+
119
+ .sliced-areas-drop {
120
+ position: absolute;
121
+ pointer-events: none;
122
+ background: rgba(120, 120, 120, 0.18);
123
+ border: 1px solid rgba(190, 190, 190, 0.5);
124
+ z-index: 7;
125
+ }
126
+
127
+ .sliced-areas-drop[data-split-mode='true'] {
128
+ background: transparent;
129
+ border-color: transparent;
130
+ }
131
+
132
+ .sliced-areas-drop-piece {
133
+ position: absolute;
134
+ background: rgba(160, 160, 160, 0.18);
135
+ border: 1px solid rgba(200, 200, 200, 0.45);
136
+ }
137
+
138
+ .sliced-areas-drop-dim {
139
+ position: absolute;
140
+ inset: 0;
141
+ pointer-events: none;
142
+ z-index: 6;
143
+ }
144
+
145
+ .sliced-areas-drop-dim-piece {
146
+ position: absolute;
147
+ background: rgba(0, 0, 0, 0.45);
148
+ border: 1px solid rgba(0, 0, 0, 0.55);
149
+ }
150
+
151
+ .sliced-areas-drop[data-zone='center'] {
152
+ background: rgba(180, 180, 180, 0.2);
153
+ border-color: rgba(220, 220, 220, 0.55);
154
+ }
155
+
156
+ .sliced-areas-drop[data-mode='swap'] {
157
+ background: rgba(150, 150, 150, 0.2);
158
+ border-color: rgba(210, 210, 210, 0.55);
159
+ }
160
+
161
+ .sliced-areas-drop[data-zone='left'],
162
+ .sliced-areas-drop[data-zone='right'],
163
+ .sliced-areas-drop[data-zone='top'],
164
+ .sliced-areas-drop[data-zone='bottom'] {
165
+ background: rgba(150, 150, 150, 0.2);
166
+ border-color: rgba(210, 210, 210, 0.55);
167
+ }
168
+
169
+ .sliced-areas-drag-label {
170
+ position: fixed;
171
+ transform: translate(12px, 12px);
172
+ background: rgba(28, 28, 28, 0.92);
173
+ color: #e6e6e6;
174
+ border: 1px solid rgba(140, 140, 140, 0.5);
175
+ border-radius: 999px;
176
+ padding: 4px 10px;
177
+ font-size: 11px;
178
+ letter-spacing: 0.08em;
179
+ text-transform: uppercase;
180
+ pointer-events: none;
181
+ z-index: 10;
182
+ }
package/dist/vue.d.ts ADDED
@@ -0,0 +1,35 @@
1
+ import { type App, type PropType } from 'vue';
2
+ import './sliced-areas';
3
+ import type { AreaResolver, AreasLayout } from './sliced-areas';
4
+ export type { AreaId, AreaRect, AreaTag, AreasGraph, AreasLayout, AreaResolver, CornerClickDetail, GraphArea, GraphEdge, GraphVert, SlicedAreasElement, } from './sliced-areas';
5
+ declare const SlicedAreas: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
6
+ layout: {
7
+ type: PropType<AreasLayout | null>;
8
+ default: null;
9
+ };
10
+ resolver: {
11
+ type: PropType<AreaResolver | null>;
12
+ default: null;
13
+ };
14
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
15
+ [key: string]: any;
16
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("layoutchange" | "cornerclick")[], "layoutchange" | "cornerclick", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
17
+ layout: {
18
+ type: PropType<AreasLayout | null>;
19
+ default: null;
20
+ };
21
+ resolver: {
22
+ type: PropType<AreaResolver | null>;
23
+ default: null;
24
+ };
25
+ }>> & Readonly<{
26
+ onLayoutchange?: ((...args: any[]) => any) | undefined;
27
+ onCornerclick?: ((...args: any[]) => any) | undefined;
28
+ }>, {
29
+ layout: AreasLayout | null;
30
+ resolver: AreaResolver | null;
31
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
32
+ export declare const SlicedAreasPlugin: {
33
+ install(app: App): void;
34
+ };
35
+ export default SlicedAreas;
package/dist/vue.js ADDED
@@ -0,0 +1,46 @@
1
+ import { defineComponent, h, onBeforeUnmount, onMounted, ref, useAttrs, watch } from "vue";
2
+ var SlicedAreas = defineComponent({
3
+ name: "SlicedAreas",
4
+ inheritAttrs: !1,
5
+ props: {
6
+ layout: {
7
+ type: Object,
8
+ default: null
9
+ },
10
+ resolver: {
11
+ type: Function,
12
+ default: null
13
+ }
14
+ },
15
+ emits: ["layoutchange", "cornerclick"],
16
+ setup(e, { emit: s, slots: c }) {
17
+ let l = useAttrs(), u = ref(null), d = (e) => {
18
+ s("layoutchange", e.detail);
19
+ }, f = (e) => {
20
+ s("cornerclick", e.detail);
21
+ };
22
+ return onMounted(() => {
23
+ let e = u.value;
24
+ e.addEventListener("sliced-areas:layoutchange", d), e.addEventListener("sliced-areas:cornerclick", f);
25
+ }), onBeforeUnmount(() => {
26
+ let e = u.value;
27
+ e.removeEventListener("sliced-areas:layoutchange", d), e.removeEventListener("sliced-areas:cornerclick", f);
28
+ }), watch([
29
+ () => u.value,
30
+ () => e.resolver,
31
+ () => e.layout
32
+ ], ([e, a, o]) => {
33
+ e && (e.setResolver(a), e.layout = o);
34
+ }, { immediate: !0 }), () => h("sliced-areas", {
35
+ ...l,
36
+ ref: u
37
+ }, c.default?.());
38
+ }
39
+ });
40
+ const SlicedAreasPlugin = { install(e) {
41
+ e.component("SlicedAreas", SlicedAreas);
42
+ } };
43
+ var vue_default = SlicedAreas;
44
+ export { SlicedAreasPlugin, vue_default as default };
45
+
46
+ //# sourceMappingURL=vue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vue.js","names":[],"sources":["../src/plugin/vue.ts"],"sourcesContent":["import {\n defineComponent,\n h,\n onBeforeUnmount,\n onMounted,\n ref,\n useAttrs,\n watch,\n type App,\n type PropType,\n} from 'vue'\n\nimport './sliced-areas'\nimport type { AreaResolver, AreasLayout, CornerClickDetail, SlicedAreasElement } from './sliced-areas'\n\nexport type {\n AreaId,\n AreaRect,\n AreaTag,\n AreasGraph,\n AreasLayout,\n AreaResolver,\n CornerClickDetail,\n GraphArea,\n GraphEdge,\n GraphVert,\n SlicedAreasElement,\n} from './sliced-areas'\n\nconst SlicedAreas = defineComponent({\n name: 'SlicedAreas',\n inheritAttrs: false,\n props: {\n layout: {\n type: Object as PropType<AreasLayout | null>,\n default: null,\n },\n resolver: {\n type: Function as unknown as PropType<AreaResolver | null>,\n default: null,\n },\n },\n emits: ['layoutchange', 'cornerclick'],\n setup(props, { emit, slots }) {\n const attrs = useAttrs()\n const elementRef = ref<SlicedAreasElement | null>(null)\n\n const onLayoutChange = (event: Event) => {\n const customEvent = event as CustomEvent<{ layout: AreasLayout }>\n emit('layoutchange', customEvent.detail)\n }\n\n const onCornerClick = (event: Event) => {\n const customEvent = event as CustomEvent<CornerClickDetail>\n emit('cornerclick', customEvent.detail)\n }\n\n onMounted(() => {\n const element = elementRef.value!\n element.addEventListener('sliced-areas:layoutchange', onLayoutChange)\n element.addEventListener('sliced-areas:cornerclick', onCornerClick)\n })\n\n onBeforeUnmount(() => {\n const element = elementRef.value!\n element.removeEventListener('sliced-areas:layoutchange', onLayoutChange)\n element.removeEventListener('sliced-areas:cornerclick', onCornerClick)\n })\n\n watch(\n [() => elementRef.value, () => props.resolver, () => props.layout],\n ([element, resolver, layout]) => {\n if (!element) return\n element.setResolver(resolver)\n element.layout = layout\n },\n { immediate: true },\n )\n\n return () =>\n h(\n 'sliced-areas',\n {\n ...attrs,\n ref: elementRef,\n },\n slots.default?.(),\n )\n },\n})\n\nexport const SlicedAreasPlugin = {\n install(app: App) {\n app.component('SlicedAreas', SlicedAreas)\n },\n}\n\nexport default SlicedAreas\n"],"mappings":";AA6BA,IAAM,cAAc,gBAAgB;CAClC,MAAM;CACN,cAAc;CACd,OAAO;EACL,QAAQ;GACN,MAAM;GACN,SAAS;GACV;EACD,UAAU;GACR,MAAM;GACN,SAAS;GACV;EACF;CACD,OAAO,CAAC,gBAAgB,cAAc;CACtC,MAAM,GAAO,EAAE,SAAM,YAAS;EAC5B,IAAM,IAAQ,UAAU,EAClB,IAAa,IAA+B,KAAK,EAEjD,KAAkB,MAAiB;AAEvC,KAAK,gBADe,EACa,OAAO;KAGpC,KAAiB,MAAiB;AAEtC,KAAK,eADe,EACY,OAAO;;AAyBzC,SAtBA,gBAAgB;GACd,IAAM,IAAU,EAAW;AAE3B,GADA,EAAQ,iBAAiB,6BAA6B,EAAe,EACrE,EAAQ,iBAAiB,4BAA4B,EAAc;IACnE,EAEF,sBAAsB;GACpB,IAAM,IAAU,EAAW;AAE3B,GADA,EAAQ,oBAAoB,6BAA6B,EAAe,EACxE,EAAQ,oBAAoB,4BAA4B,EAAc;IACtE,EAEF,MACE;SAAO,EAAW;SAAa,EAAM;SAAgB,EAAM;GAAO,GACjE,CAAC,GAAS,GAAU,OAAY;AAC1B,SACL,EAAQ,YAAY,EAAS,EAC7B,EAAQ,SAAS;KAEnB,EAAE,WAAW,IAAM,CACpB,QAGC,EACE,gBACA;GACE,GAAG;GACH,KAAK;GACN,EACD,EAAM,WAAW,CAClB;;CAEN,CAAC;AAEF,MAAa,oBAAoB,EAC/B,QAAQ,GAAU;AAChB,GAAI,UAAU,eAAe,YAAY;GAE5C;AAED,IAAA,cAAe"}
package/package.json ADDED
@@ -0,0 +1,101 @@
1
+ {
2
+ "name": "sliced-areas",
3
+ "description": "Blender-like \"Areas\" layout system as a Web Component with an optional Vue 3 wrapper.",
4
+ "keywords": [
5
+ "areas",
6
+ "layout",
7
+ "web-components",
8
+ "vue",
9
+ "splitter",
10
+ "dock",
11
+ "tiling",
12
+ "blender"
13
+ ],
14
+ "version": "1.0.0",
15
+ "type": "module",
16
+ "license": "MIT",
17
+ "author": "Pavel Voronin",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "https://github.com/pavel-voronin/sliced-areas.git"
21
+ },
22
+ "homepage": "https://github.com/pavel-voronin/sliced-areas#readme",
23
+ "bugs": {
24
+ "url": "https://github.com/pavel-voronin/sliced-areas/issues"
25
+ },
26
+ "main": "./dist/index.js",
27
+ "module": "./dist/index.js",
28
+ "types": "./dist/index.d.ts",
29
+ "exports": {
30
+ ".": {
31
+ "types": "./dist/index.d.ts",
32
+ "import": "./dist/index.js"
33
+ },
34
+ "./vue": {
35
+ "types": "./dist/vue.d.ts",
36
+ "import": "./dist/vue.js"
37
+ },
38
+ "./styles.css": "./dist/styles.css"
39
+ },
40
+ "files": [
41
+ "dist",
42
+ "README.md",
43
+ "LICENSE"
44
+ ],
45
+ "sideEffects": [
46
+ "./dist/styles.css"
47
+ ],
48
+ "scripts": {
49
+ "dev": "vite",
50
+ "build": "run-p type-check \"build-only {@}\" --",
51
+ "preview": "vite preview",
52
+ "build-only": "vite build",
53
+ "build:lib": "run-s build:lib:bundle build:lib:types build:lib:styles",
54
+ "build:lib:bundle": "vite build -c vite.lib.config.ts",
55
+ "build:lib:types": "tsc -p tsconfig.lib.json",
56
+ "build:lib:styles": "node scripts/copy-styles.mjs",
57
+ "prepublishOnly": "run-s type-check test build:lib",
58
+ "type-check": "vue-tsc --build",
59
+ "test": "vitest --coverage",
60
+ "lint:oxlint": "oxlint . --fix -D correctness --ignore-path .gitignore",
61
+ "lint:eslint": "eslint . --fix --cache",
62
+ "lint": "run-s lint:*",
63
+ "format": "prettier --write --experimental-cli src/"
64
+ },
65
+ "peerDependencies": {
66
+ "vue": "^3.5.25"
67
+ },
68
+ "peerDependenciesMeta": {
69
+ "vue": {
70
+ "optional": true
71
+ }
72
+ },
73
+ "dependencies": {},
74
+ "devDependencies": {
75
+ "@tailwindcss/vite": "^4.1.18",
76
+ "@prettier/plugin-oxc": "^0.0.5",
77
+ "@tsconfig/node24": "^24.0.3",
78
+ "@types/jsdom": "^27.0.0",
79
+ "@types/node": "^24.10.1",
80
+ "@vitejs/plugin-vue": "^6.0.2",
81
+ "@vitest/coverage-v8": "^4.0.16",
82
+ "@vue/eslint-config-prettier": "^10.2.0",
83
+ "@vue/eslint-config-typescript": "^14.6.0",
84
+ "@vue/tsconfig": "^0.8.1",
85
+ "eslint": "^9.39.1",
86
+ "eslint-plugin-oxlint": "~1.29.0",
87
+ "eslint-plugin-vue": "~10.5.1",
88
+ "jiti": "^2.6.1",
89
+ "jsdom": "^27.2.0",
90
+ "npm-run-all2": "^8.0.4",
91
+ "oxlint": "~1.29.0",
92
+ "prettier": "3.6.2",
93
+ "tailwindcss": "^4.1.18",
94
+ "typescript": "~5.9.0",
95
+ "vite": "npm:rolldown-vite@latest",
96
+ "vite-plugin-vue-devtools": "^8.0.5",
97
+ "vitest": "^4.0.14",
98
+ "vue": "^3.5.25",
99
+ "vue-tsc": "^3.1.5"
100
+ }
101
+ }