` wrapper around the children components.
56 | All additional props are passed through to the to the `
` component.
57 |
58 | ### Example
59 |
60 | ```js
61 | import Split from 'react-split'
62 |
63 |
74 |
75 |
76 |
77 | ```
78 |
79 | ### Props
80 |
81 | #### `sizes`
82 |
83 | `sizes?: [number]` - [Docs](https://github.com/nathancahill/split/tree/master/packages/splitjs#sizes)
84 |
85 | #### `minSize`
86 |
87 | `minSize?: number | [number]` - [Docs](https://github.com/nathancahill/split/tree/master/packages/splitjs#minsize-default-100)
88 |
89 | #### `expandToMin`
90 |
91 | `expandToMin?: boolean` - [Docs](https://github.com/nathancahill/split/tree/master/packages/splitjs#expandtomin-default-false)
92 |
93 | #### `gutterSize`
94 |
95 | `gutterSize?: number` - [Docs](https://github.com/nathancahill/split/tree/master/packages/splitjs#guttersize-default-10)
96 |
97 | #### `gutterAlign`
98 |
99 | `gutterAlign?: 'center' | 'start' | 'end'` - [Docs](https://github.com/nathancahill/split/tree/master/packages/splitjs#gutteralign-default-center)
100 |
101 | #### `snapOffset`
102 |
103 | `snapOffset?: number` - [Docs](https://github.com/nathancahill/split/tree/master/packages/splitjs#snapoffset-default-30)
104 |
105 | #### `dragInterval`
106 |
107 | `dragInterval?: number` - [Docs](https://github.com/nathancahill/split/tree/master/packages/splitjs#draginterval-default-1)
108 |
109 | #### `direction`
110 |
111 | `direction?: 'horizontal' | 'vertical'` - [Docs](https://github.com/nathancahill/split/tree/master/packages/splitjs#direction-default-horizontal)
112 |
113 | #### `cursor`
114 |
115 | `cursor?: string` - [Docs](https://github.com/nathancahill/split/tree/master/packages/splitjs#cursor-default-col-resize)
116 |
117 | #### `gutter`
118 |
119 | `gutter?: (index, direction, pairElement) => HTMLElement` - [Docs](https://github.com/nathancahill/split/tree/master/packages/splitjs#gutter)
120 |
121 | #### `elementStyle`
122 |
123 | `elementStyle?: (dimension, elementSize, gutterSize, index) => Object` - [Docs](https://github.com/nathancahill/split/tree/master/packages/splitjs#elementstyle)
124 |
125 | #### `gutterStyle`
126 |
127 | `gutterStyle?: (dimension, gutterSize, index) => Object` - [Docs](https://github.com/nathancahill/split/tree/master/packages/splitjs#gutterstyle)
128 |
129 | #### `onDrag`
130 |
131 | `onDrag?: sizes => void` - [Docs](https://github.com/nathancahill/split/tree/master/packages/splitjs#ondrag-ondragstart-ondragend)
132 |
133 | #### `onDragStart`
134 |
135 | `onDragStart?: sizes => void` - [Docs](https://github.com/nathancahill/split/tree/master/packages/splitjs#ondrag-ondragstart-ondragend)
136 |
137 | #### `onDragEnd`
138 |
139 | `onDragEnd?: sizes => void` - [Docs](https://github.com/nathancahill/split/tree/master/packages/splitjs#ondrag-ondragstart-ondragend)
140 |
141 | ## Migrating from Split.js
142 |
143 | Refer to [Split.js documentation](https://github.com/nathancahill/split/tree/master/packages/splitjs#documentation) for the options the component accepts as props. The differences are noted below:
144 |
145 | A few props are exempt from updating. These props are functions, these props will not trigger a `componentDidUpdate`.
146 | Following React best practices, and do not create functions in the render method. Instead, create them once and pass them as props.
147 |
148 | - `gutter`
149 | - `elementStyle`
150 | - `gutterStyle`
151 | - `onDrag`
152 | - `onDragStart`
153 | - `onDragEnd`
154 |
155 | #### API
156 |
157 | - `.setSizes(sizes)` becomes the prop `sizes={sizes}`
158 | - `.getSizes()` is unavailable, but sizes are passed to `onDragStart` and `onDragEnd`
159 | - `.collapse(index)` becomes the prop: `collapsed={index}`
160 | - `.destroy()` is triggered automatically on `componentWillUnmount`
161 |
162 | ## License
163 |
164 | Copyright (c) 2019 Nathan Cahill
165 |
166 | Permission is hereby granted, free of charge, to any person obtaining a copy
167 | of this software and associated documentation files (the "Software"), to deal
168 | in the Software without restriction, including without limitation the rights
169 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
170 | copies of the Software, and to permit persons to whom the Software is
171 | furnished to do so, subject to the following conditions:
172 |
173 | The above copyright notice and this permission notice shall be included in
174 | all copies or substantial portions of the Software.
175 |
176 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
177 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
178 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
179 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
180 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
181 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
182 | THE SOFTWARE.
183 |
--------------------------------------------------------------------------------
/packages/react-split/index.d.ts:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { Options } from 'split.js'
3 |
4 | export interface SplitProps extends Omit
, 'onDrag'|'onDragStart'|'onDragEnd'> {
5 | sizes?: Options["sizes"]
6 | minSize?: Options["minSize"]
7 | maxSize?: Options["maxSize"]
8 | expandToMin?: Options["expandToMin"]
9 | gutterSize?: Options["gutterSize"]
10 | gutterAlign?: Options["gutterAlign"]
11 | snapOffset?: Options["snapOffset"]
12 | dragInterval?: Options["dragInterval"]
13 | direction?: Options["direction"]
14 | cursor?: Options["cursor"]
15 | gutter?: Options["gutter"]
16 | elementStyle?: Options["elementStyle"]
17 | gutterStyle?: Options["gutterStyle"]
18 | onDrag?: Options["onDrag"]
19 | onDragStart?: Options["onDragStart"]
20 | onDragEnd?: Options["onDragEnd"]
21 | collapsed?: Number
22 | }
23 |
24 | declare class Split extends React.Component {}
25 |
26 | export default Split
27 |
--------------------------------------------------------------------------------
/packages/react-split/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-split",
3 | "version": "2.0.14",
4 | "description": "React component for Split.js",
5 | "main": "dist/react-split.js",
6 | "minified:main": "dist/react-split.min.js",
7 | "module": "dist/react-split.es.js",
8 | "types": "index.d.ts",
9 | "scripts": {
10 | "prepublish": "rollup -c",
11 | "build": "rollup -c && npm run size",
12 | "watch": "rollup -cw",
13 | "test": "jest",
14 | "size": "echo \"gzip size: $(gzip-size --raw $npm_package_minified_main) bytes\""
15 | },
16 | "repository": "https://github.com/nathancahill/split",
17 | "author": "Nathan Cahill ",
18 | "homepage": "https://split.js.org/",
19 | "files": [
20 | "dist",
21 | "index.d.ts"
22 | ],
23 | "license": "MIT",
24 | "dependencies": {
25 | "prop-types": "^15.5.7",
26 | "split.js": "^1.6.0"
27 | },
28 | "peerDependencies": {
29 | "react": "*"
30 | },
31 | "collective": {
32 | "type": "opencollective",
33 | "url": "https://opencollective.com/splitjs"
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/packages/react-split/rollup.config.js:
--------------------------------------------------------------------------------
1 | import buble from '@rollup/plugin-buble'
2 | import { terser } from 'rollup-plugin-terser'
3 |
4 | const pkg = require('./package.json')
5 |
6 | export default [
7 | {
8 | input: './src/index.js',
9 | output: [
10 | {
11 | name: 'ReactSplit',
12 | file: pkg.main,
13 | format: 'umd',
14 | sourcemap: false,
15 | banner: `/*! ${pkg.name} - v${pkg.version} */\n`,
16 | globals: {
17 | react: 'React',
18 | 'prop-types': 'PropTypes',
19 | 'split.js': 'Split',
20 | },
21 | },
22 | {
23 | file: pkg.module,
24 | format: 'esm',
25 | sourcemap: false,
26 | },
27 | ],
28 | external: ['split.js', 'react', 'prop-types'],
29 | plugins: [
30 | buble({
31 | exclude: 'node_modules/**',
32 | objectAssign: 'Object.assign',
33 | transforms: {
34 | forOf: false,
35 | },
36 | }),
37 | ],
38 | },
39 | {
40 | input: './src/index.js',
41 | output: {
42 | name: 'ReactSplit',
43 | file: pkg['minified:main'],
44 | format: 'umd',
45 | sourcemap: true,
46 | banner: `/*! ${pkg.name} - v${pkg.version} */\n`,
47 | globals: {
48 | react: 'React',
49 | 'prop-types': 'PropTypes',
50 | 'split.js': 'Split',
51 | },
52 | },
53 | external: ['split.js', 'react', 'prop-types'],
54 | plugins: [
55 | buble({
56 | exclude: 'node_modules/**',
57 | objectAssign: 'Object.assign',
58 | transforms: {
59 | forOf: false,
60 | },
61 | }),
62 | terser(),
63 | ],
64 | },
65 | ]
66 |
--------------------------------------------------------------------------------
/packages/react-split/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import PropTypes from 'prop-types'
3 | import Split from 'split.js'
4 |
5 | class SplitWrapper extends React.Component {
6 | componentDidMount() {
7 | const { children, gutter, ...options } = this.props
8 |
9 | options.gutter = (index, direction) => {
10 | let gutterElement
11 |
12 | if (gutter) {
13 | gutterElement = gutter(index, direction)
14 | } else {
15 | gutterElement = document.createElement('div')
16 | gutterElement.className = `gutter gutter-${direction}`
17 | }
18 |
19 | // eslint-disable-next-line no-underscore-dangle
20 | gutterElement.__isSplitGutter = true
21 | return gutterElement
22 | }
23 |
24 | this.split = Split(this.parent.children, options)
25 | }
26 |
27 | componentDidUpdate(prevProps) {
28 | const { children, minSize, sizes, collapsed, ...options } = this.props
29 | const {
30 | minSize: prevMinSize,
31 | sizes: prevSizes,
32 | collapsed: prevCollapsed,
33 | } = prevProps
34 |
35 | const otherProps = [
36 | 'maxSize',
37 | 'expandToMin',
38 | 'gutterSize',
39 | 'gutterAlign',
40 | 'snapOffset',
41 | 'dragInterval',
42 | 'direction',
43 | 'cursor',
44 | ]
45 |
46 | let needsRecreate = otherProps
47 | // eslint-disable-next-line react/destructuring-assignment
48 | .map(prop => this.props[prop] !== prevProps[prop])
49 | .reduce((accum, same) => accum || same, false)
50 |
51 | // Compare minSize when both are arrays, when one is an array and when neither is an array
52 | if (Array.isArray(minSize) && Array.isArray(prevMinSize)) {
53 | let minSizeChanged = false
54 |
55 | minSize.forEach((minSizeI, i) => {
56 | minSizeChanged = minSizeChanged || minSizeI !== prevMinSize[i]
57 | })
58 |
59 | needsRecreate = needsRecreate || minSizeChanged
60 | } else if (Array.isArray(minSize) || Array.isArray(prevMinSize)) {
61 | needsRecreate = true
62 | } else {
63 | needsRecreate = needsRecreate || minSize !== prevMinSize
64 | }
65 |
66 | // Destroy and re-create split if options changed
67 | if (needsRecreate) {
68 | options.minSize = minSize
69 | options.sizes = sizes || this.split.getSizes()
70 | this.split.destroy(true, true)
71 | options.gutter = (index, direction, pairB) => pairB.previousSibling
72 | this.split = Split(
73 | Array.from(this.parent.children).filter(
74 | // eslint-disable-next-line no-underscore-dangle
75 | element => !element.__isSplitGutter,
76 | ),
77 | options,
78 | )
79 | } else if (sizes) {
80 | // If only the size has changed, set the size. No need to do this if re-created.
81 | let sizeChanged = false
82 |
83 | sizes.forEach((sizeI, i) => {
84 | sizeChanged = sizeChanged || sizeI !== prevSizes[i]
85 | })
86 |
87 | if (sizeChanged) {
88 | // eslint-disable-next-line react/destructuring-assignment
89 | this.split.setSizes(this.props.sizes)
90 | }
91 | }
92 |
93 | // Collapse after re-created or when collapsed changed.
94 | if (
95 | Number.isInteger(collapsed) &&
96 | (collapsed !== prevCollapsed || needsRecreate)
97 | ) {
98 | this.split.collapse(collapsed)
99 | }
100 | }
101 |
102 | componentWillUnmount() {
103 | this.split.destroy()
104 | delete this.split
105 | }
106 |
107 | render() {
108 | const {
109 | sizes,
110 | minSize,
111 | maxSize,
112 | expandToMin,
113 | gutterSize,
114 | gutterAlign,
115 | snapOffset,
116 | dragInterval,
117 | direction,
118 | cursor,
119 | gutter,
120 | elementStyle,
121 | gutterStyle,
122 | onDrag,
123 | onDragStart,
124 | onDragEnd,
125 | collapsed,
126 | children,
127 | ...rest
128 | } = this.props
129 |
130 | return (
131 | {
133 | this.parent = parent
134 | }}
135 | {...rest}
136 | >
137 | {children}
138 |
139 | )
140 | }
141 | }
142 |
143 | SplitWrapper.propTypes = {
144 | sizes: PropTypes.arrayOf(PropTypes.number),
145 | minSize: PropTypes.oneOfType([
146 | PropTypes.number,
147 | PropTypes.arrayOf(PropTypes.number),
148 | ]),
149 | maxSize: PropTypes.oneOfType([
150 | PropTypes.number,
151 | PropTypes.arrayOf(PropTypes.number),
152 | ]),
153 | expandToMin: PropTypes.bool,
154 | gutterSize: PropTypes.number,
155 | gutterAlign: PropTypes.string,
156 | snapOffset: PropTypes.oneOfType([
157 | PropTypes.number,
158 | PropTypes.arrayOf(PropTypes.number),
159 | ]),
160 | dragInterval: PropTypes.number,
161 | direction: PropTypes.string,
162 | cursor: PropTypes.string,
163 | gutter: PropTypes.func,
164 | elementStyle: PropTypes.func,
165 | gutterStyle: PropTypes.func,
166 | onDrag: PropTypes.func,
167 | onDragStart: PropTypes.func,
168 | onDragEnd: PropTypes.func,
169 | collapsed: PropTypes.number,
170 | children: PropTypes.arrayOf(PropTypes.element),
171 | }
172 |
173 | SplitWrapper.defaultProps = {
174 | sizes: undefined,
175 | minSize: undefined,
176 | maxSize: undefined,
177 | expandToMin: undefined,
178 | gutterSize: undefined,
179 | gutterAlign: undefined,
180 | snapOffset: undefined,
181 | dragInterval: undefined,
182 | direction: undefined,
183 | cursor: undefined,
184 | gutter: undefined,
185 | elementStyle: undefined,
186 | gutterStyle: undefined,
187 | onDrag: undefined,
188 | onDragStart: undefined,
189 | onDragEnd: undefined,
190 | collapsed: undefined,
191 | children: undefined,
192 | }
193 |
194 | export default SplitWrapper
195 |
--------------------------------------------------------------------------------
/packages/react-split/src/index.test.js:
--------------------------------------------------------------------------------
1 | /* eslint-env jest */
2 |
3 | test('', () => {})
4 |
--------------------------------------------------------------------------------
/packages/split-generator/.dependabot/config.yml:
--------------------------------------------------------------------------------
1 | version: 1
2 |
3 | update_configs:
4 | - package_manager: "javascript"
5 | directory: "/"
6 | update_schedule: "live"
7 | automerged_updates:
8 | - match:
9 | update_type: "all"
10 | target_branch: master
11 |
--------------------------------------------------------------------------------
/packages/split-generator/.eslintignore:
--------------------------------------------------------------------------------
1 | /node_modules/*
2 | /dist/*
3 | /public/*
--------------------------------------------------------------------------------
/packages/split-generator/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "env": {
3 | "browser": true,
4 | "jest": true
5 | },
6 | "extends": ["airbnb-base", "prettier"],
7 | "rules": {
8 | "import/no-extraneous-dependencies": [
9 | "error",
10 | { "devDependencies": true }
11 | ],
12 | "no-new": 0
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/packages/split-generator/.github/workflows/ci.yml:
--------------------------------------------------------------------------------
1 | name: CI
2 |
3 | on: [push, pull_request]
4 |
5 | jobs:
6 | build:
7 | runs-on: ubuntu-latest
8 |
9 | steps:
10 | - uses: actions/checkout@v2
11 | - uses: actions/setup-node@v2
12 | with:
13 | node-version: '14'
14 | - run: yarn install
15 | - run: yarn run test
16 | env:
17 | CI: true
18 |
--------------------------------------------------------------------------------
/packages/split-generator/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | lerna-debug.log*
8 |
9 | # Diagnostic reports (https://nodejs.org/api/report.html)
10 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
11 |
12 | # Runtime data
13 | pids
14 | *.pid
15 | *.seed
16 | *.pid.lock
17 |
18 | # Directory for instrumented libs generated by jscoverage/JSCover
19 | lib-cov
20 |
21 | # Coverage directory used by tools like istanbul
22 | coverage
23 | *.lcov
24 |
25 | # nyc test coverage
26 | .nyc_output
27 |
28 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
29 | .grunt
30 |
31 | # Bower dependency directory (https://bower.io/)
32 | bower_components
33 |
34 | # node-waf configuration
35 | .lock-wscript
36 |
37 | # Compiled binary addons (https://nodejs.org/api/addons.html)
38 | build/Release
39 |
40 | # Dependency directories
41 | node_modules/
42 | jspm_packages/
43 |
44 | # TypeScript v1 declaration files
45 | typings/
46 |
47 | # TypeScript cache
48 | *.tsbuildinfo
49 |
50 | # Optional npm cache directory
51 | .npm
52 |
53 | # Optional eslint cache
54 | .eslintcache
55 |
56 | # Microbundle cache
57 | .rpt2_cache/
58 | .rts2_cache_cjs/
59 | .rts2_cache_es/
60 | .rts2_cache_umd/
61 |
62 | # Optional REPL history
63 | .node_repl_history
64 |
65 | # Output of 'npm pack'
66 | *.tgz
67 |
68 | # Yarn Integrity file
69 | .yarn-integrity
70 |
71 | # dotenv environment variables file
72 | .env
73 | .env.test
74 |
75 | # parcel-bundler cache (https://parceljs.org/)
76 | .cache
77 |
78 | # Next.js build output
79 | .next
80 |
81 | # Nuxt.js build / generate output
82 | .nuxt
83 | dist
84 |
85 | # Gatsby files
86 | .cache/
87 | # Comment in the public line in if your project uses Gatsby and *not* Next.js
88 | # https://nextjs.org/blog/next-9-1#public-directory-support
89 | public/*.js*
90 | public/*.css*
91 |
92 | # vuepress build output
93 | .vuepress/dist
94 |
95 | # Serverless directories
96 | .serverless/
97 |
98 | # FuseBox cache
99 | .fusebox/
100 |
101 | # DynamoDB Local files
102 | .dynamodb/
103 |
104 | # TernJS port file
105 | .tern-port
106 |
--------------------------------------------------------------------------------
/packages/split-generator/.prettierignore:
--------------------------------------------------------------------------------
1 | public/
--------------------------------------------------------------------------------
/packages/split-generator/README.md:
--------------------------------------------------------------------------------
1 | # mapgrid-svelte-tailwind
2 |
--------------------------------------------------------------------------------
/packages/split-generator/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "split-generator",
3 | "private": true,
4 | "version": "1.0.0",
5 | "repository": "git@github.com:nathancahill/split.git",
6 | "author": "Nathan Cahill ",
7 | "license": "MIT",
8 | "devDependencies": {
9 | "@fullhuman/postcss-purgecss": "^4.0.3",
10 | "@rollup/plugin-commonjs": "^18.0.0",
11 | "@rollup/plugin-node-resolve": "^11.2.1",
12 | "autoprefixer": "^10.2.5",
13 | "eslint": "^7.23.0",
14 | "eslint-config-airbnb-base": "^14.2.1",
15 | "eslint-config-prettier": "^8.1.0",
16 | "eslint-plugin-import": "^2.22.1",
17 | "jest": "^26.6.3",
18 | "postcss": "^8.2.8",
19 | "postcss-load-config": "^3.0.1",
20 | "prettier": "^2.2.1",
21 | "rollup": "^2.43.0",
22 | "rollup-plugin-css-only": "^3.1.0",
23 | "rollup-plugin-livereload": "^2.0.0",
24 | "rollup-plugin-svelte": "^7.1.0",
25 | "rollup-plugin-terser": "^7.0.2",
26 | "sirv-cli": "^1.0.11",
27 | "svelte": "^3.35.0",
28 | "svelte-preprocess": "^4.7.0",
29 | "tailwindcss": "^2.0.4"
30 | },
31 | "scripts": {
32 | "build": "NODE_ENV=production rollup -c",
33 | "watch": "rollup -cw",
34 | "format": "prettier --write \"**/*.js\" \"**/*.json\"",
35 | "lint": "eslint .",
36 | "test": "jest && yarn run lint",
37 | "serve": "sirv public --single --dev"
38 | },
39 | "dependencies": {
40 | "@tailwindcss/forms": "^0.3.2",
41 | "less": "^4.1.1",
42 | "qs": "^6.10.1",
43 | "split-grid": "^1.0.9",
44 | "split.js": "^1.6.2",
45 | "svelte-prismjs": "^1.0.1",
46 | "svelte-spa-router": "^3.1.0"
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/packages/split-generator/postcss.config.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable global-require */
2 | const purgecss = require('@fullhuman/postcss-purgecss')({
3 | content: ['./src/**/*.html', './src/**/*.svelte'],
4 |
5 | safelist: [/svelte-/],
6 |
7 | defaultExtractor: content =>
8 | content
9 | .match(/[A-Za-z0-9-_:./]+/g)
10 | .map(c => (c.startsWith('class:') ? c.substring(6) : c)) || [],
11 | })
12 |
13 | const plugins = [require('tailwindcss'), require('autoprefixer')]
14 |
15 | if (process.env.NODE_ENV === 'production') {
16 | plugins.push(purgecss)
17 | }
18 |
19 | module.exports = {
20 | plugins,
21 | }
22 |
--------------------------------------------------------------------------------
/packages/split-generator/prettier.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | printWidth: 80,
3 | trailingComma: 'all',
4 | tabWidth: 4,
5 | semi: false,
6 | singleQuote: true,
7 | arrowParens: 'avoid',
8 | }
9 |
--------------------------------------------------------------------------------
/packages/split-generator/public/horizontal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nathancahill/split/48759432a50510e2ed762109d5a8d12a3aac9e63/packages/split-generator/public/horizontal.png
--------------------------------------------------------------------------------
/packages/split-generator/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/packages/split-generator/public/vertical.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nathancahill/split/48759432a50510e2ed762109d5a8d12a3aac9e63/packages/split-generator/public/vertical.png
--------------------------------------------------------------------------------
/packages/split-generator/rollup.config.js:
--------------------------------------------------------------------------------
1 | import commonjs from '@rollup/plugin-commonjs'
2 | import resolve from '@rollup/plugin-node-resolve'
3 | import svelte from 'rollup-plugin-svelte'
4 | import livereload from 'rollup-plugin-livereload'
5 | import { terser } from 'rollup-plugin-terser'
6 | import sveltePreprocess from 'svelte-preprocess'
7 | import css from 'rollup-plugin-css-only'
8 |
9 | const prod = process.env.NODE_ENV === 'production'
10 | const watch = process.env.ROLLUP_WATCH
11 |
12 | export default {
13 | input: 'src/index.js',
14 | output: {
15 | file: 'public/bundle.js',
16 | format: 'iife',
17 | },
18 | plugins: [
19 | svelte({
20 | preprocess: sveltePreprocess({
21 | postcss: true,
22 | }),
23 | compilerOptions: {
24 | dev: !prod,
25 | },
26 | }),
27 | css({
28 | output: 'bundle.css',
29 | }),
30 | resolve({
31 | dedupe: ['svelte', 'svelte/internal'],
32 | browser: true,
33 | }),
34 | commonjs(),
35 | !!watch && livereload(),
36 | !!prod && terser(),
37 | ],
38 | }
39 |
--------------------------------------------------------------------------------
/packages/split-generator/src/App.svelte:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
21 |
--------------------------------------------------------------------------------
/packages/split-generator/src/Dashboard.svelte:
--------------------------------------------------------------------------------
1 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 | Split.js
26 |
27 |
28 |
29 |
30 |
66 |
67 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
110 |
111 |
--------------------------------------------------------------------------------
/packages/split-generator/src/components/Logo.svelte:
--------------------------------------------------------------------------------
1 |
19 |
20 |
39 |
--------------------------------------------------------------------------------
/packages/split-generator/src/components/LogoSvg.svelte:
--------------------------------------------------------------------------------
1 |
12 |
--------------------------------------------------------------------------------
/packages/split-generator/src/components/Stepper.svelte:
--------------------------------------------------------------------------------
1 |
27 |
28 |
29 |
33 |
47 |
48 |
49 |
55 |
56 |
60 |
74 |
75 |
76 |
--------------------------------------------------------------------------------
/packages/split-generator/src/components/Toggle.svelte:
--------------------------------------------------------------------------------
1 |
11 |
12 | {#each options as option, i}
13 |
48 | {/each}
49 |
50 |
--------------------------------------------------------------------------------
/packages/split-generator/src/icons/Copied.svelte:
--------------------------------------------------------------------------------
1 |
15 |
--------------------------------------------------------------------------------
/packages/split-generator/src/icons/Copy.svelte:
--------------------------------------------------------------------------------
1 |
15 |
--------------------------------------------------------------------------------
/packages/split-generator/src/index.js:
--------------------------------------------------------------------------------
1 | import App from './App.svelte'
2 |
3 | new App({
4 | target: document.body,
5 | })
6 |
--------------------------------------------------------------------------------
/packages/split-generator/src/less/carbon.less:
--------------------------------------------------------------------------------
1 | #carbonads * {
2 | margin: initial;
3 | padding: initial;
4 | }
5 | #carbonads {
6 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
7 | Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', Helvetica, Arial,
8 | sans-serif;
9 | }
10 | #carbonads {
11 | display: flex;
12 | z-index: 100;
13 | }
14 | #carbonads a {
15 | color: inherit;
16 | text-decoration: none;
17 | }
18 | #carbonads a:hover {
19 | color: inherit;
20 | }
21 | #carbonads span {
22 | position: relative;
23 | display: block;
24 | overflow: hidden;
25 | }
26 | #carbonads .carbon-wrap {
27 | display: flex;
28 | }
29 | #carbonads .carbon-img {
30 | display: block;
31 | margin: 0;
32 | line-height: 1;
33 | }
34 | #carbonads .carbon-img img {
35 | display: block;
36 | }
37 | #carbonads .carbon-text {
38 | font-size: 13px;
39 | padding: 10px;
40 | margin-bottom: 16px;
41 | line-height: 1.5;
42 | text-align: left;
43 | }
44 | #carbonads .carbon-poweredby {
45 | display: block;
46 | padding: 6px 8px;
47 | background: #f1f1f2;
48 | text-align: center;
49 | text-transform: uppercase;
50 | letter-spacing: 0.5px;
51 | font-weight: 600;
52 | font-size: 8px;
53 | line-height: 1;
54 | border-top-left-radius: 3px;
55 | position: absolute;
56 | bottom: 0;
57 | right: 0;
58 | }
59 |
--------------------------------------------------------------------------------
/packages/split-generator/src/less/markdown.less:
--------------------------------------------------------------------------------
1 | :root {
2 | --color-code-green: #b5f4a5;
3 | --color-code-yellow: #ffe484;
4 | --color-code-purple: #d9a9ff;
5 | --color-code-red: #ff8383;
6 | --color-code-blue: #93ddfd;
7 | --color-code-white: #fff;
8 | }
9 |
10 | @import 'src/less/prism-atom-dark';
11 |
12 | .markdown {
13 | > p code,
14 | > ul li *:not(pre) code,
15 | > ul li > code,
16 | > ol li *:not(pre) code,
17 | > ol li > code,
18 | p& code& {
19 | @apply inline-block;
20 | @apply bg-gray-100;
21 | @apply rounded-sm;
22 | @apply text-sm;
23 | @apply px-1;
24 | @apply leading-none;
25 | @apply whitespace-nowrap;
26 | @apply text-gray-800;
27 | @apply font-mono;
28 | @apply align-baseline;
29 | font-weight: 400;
30 | }
31 |
32 | > pre,
33 | pre& {
34 | @apply font-mono;
35 | @apply text-sm;
36 | @apply rounded-lg;
37 | font-weight: 400;
38 | scrollbar-width: none;
39 | &::-webkit-scrollbar {
40 | display: none;
41 | }
42 |
43 | overflow: auto;
44 | }
45 |
46 | > pre,
47 | pre&,
48 | > ul li pre,
49 | > ol li pre {
50 | @apply flex p-0 bg-gray-800;
51 | @apply text-sm leading-normal;
52 | }
53 |
54 | > pre code,
55 | pre code&,
56 | > ul li pre code,
57 | > ol li pre code {
58 | @apply p-4;
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/packages/split-generator/src/less/prism-atom-dark.less:
--------------------------------------------------------------------------------
1 | /**
2 | * atom-dark theme for `prism.js`
3 | * Based on Atom's `atom-dark` theme: https://github.com/atom/atom-dark-syntax
4 | * @author Joe Gibson (@gibsjose)
5 | */
6 |
7 | code[class*='language-'],
8 | pre[class*='language-'] {
9 | @apply font-mono text-gray-200;
10 | // color: #c5c8c6;
11 | // text-shadow: 0 1px rgba(0, 0, 0, 0.3);
12 | // font-family: Inconsolata, Monaco, Consolas, 'Courier New', Courier, monospace;
13 | direction: ltr;
14 | text-align: left;
15 | white-space: pre;
16 | word-spacing: normal;
17 | word-break: normal;
18 | line-height: 1.5;
19 |
20 | -moz-tab-size: 4;
21 | -o-tab-size: 4;
22 | tab-size: 4;
23 |
24 | -webkit-hyphens: none;
25 | -moz-hyphens: none;
26 | -ms-hyphens: none;
27 | hyphens: none;
28 | }
29 |
30 | /* Code blocks */
31 | pre[class*='language-'] {
32 | @apply p-4;
33 | // padding: 1em;
34 | // margin: .5em 0;
35 | overflow: auto;
36 | border-radius: 0.3em;
37 | }
38 |
39 | :not(pre) > code[class*='language-'],
40 | pre[class*='language-'] {
41 | background: #1d1f21;
42 | }
43 |
44 | /* Inline code */
45 | :not(pre) > code[class*='language-'] {
46 | padding: 0.1em;
47 | border-radius: 0.3em;
48 | }
49 |
50 | .token.comment,
51 | .token.prolog,
52 | .token.doctype,
53 | .token.cdata {
54 | @apply text-gray-500;
55 | // color: #7C7C7C;
56 | }
57 |
58 | .token.punctuation {
59 | color: #c5c8c6;
60 | }
61 |
62 | .namespace {
63 | opacity: 0.7;
64 | }
65 |
66 | .token.property,
67 | .token.keyword,
68 | .token.tag {
69 | color: #96cbfe;
70 | }
71 |
72 | .token.class-name {
73 | color: #ffffb6;
74 | text-decoration: underline;
75 | }
76 |
77 | .token.boolean,
78 | .token.constant {
79 | color: #99cc99;
80 | }
81 |
82 | .token.symbol,
83 | .token.deleted {
84 | color: #f92672;
85 | }
86 |
87 | .token.number {
88 | color: #ff73fd;
89 | }
90 |
91 | .token.selector,
92 | .token.attr-name,
93 | .token.string,
94 | .token.char,
95 | .token.builtin,
96 | .token.inserted {
97 | color: #a8ff60;
98 | }
99 |
100 | .token.variable {
101 | color: #c6c5fe;
102 | }
103 |
104 | .token.operator {
105 | color: #ededed;
106 | }
107 |
108 | .token.entity {
109 | color: #ffffb6;
110 | /* text-decoration: underline; */
111 | }
112 |
113 | .token.url {
114 | color: #96cbfe;
115 | }
116 |
117 | .language-css .token.string,
118 | .style .token.string {
119 | color: #87c38a;
120 | }
121 |
122 | .token.atrule,
123 | .token.attr-value {
124 | color: #f9ee98;
125 | }
126 |
127 | .token.function {
128 | color: #dad085;
129 | }
130 |
131 | .token.regex {
132 | color: #e9c062;
133 | }
134 |
135 | .token.important {
136 | color: #fd971f;
137 | }
138 |
139 | .token.important,
140 | .token.bold {
141 | font-weight: bold;
142 | }
143 | .token.italic {
144 | font-style: italic;
145 | }
146 |
147 | .token.entity {
148 | cursor: help;
149 | }
150 |
151 | :not(pre) > code[class*='language-'],
152 | pre[class*='language-'] {
153 | background: transparent;
154 | @apply text-sm;
155 | }
156 |
157 | // Custom overrides
158 | /* .token.atrule, .token.atrule .token.number {
159 | color: #fff;
160 | }
161 | .token.atrule .token.rule {
162 | color: #f9ee98;
163 | }
164 | .token.function {
165 | color: #f9ee98;
166 | }
167 | .language-css .token.string, .style .token.string {
168 | color: #a8ff60;
169 | } */
170 |
171 | // New overrides
172 | code[class*='language-'],
173 | pre[class*='language-'] {
174 | @apply subpixel-antialiased !important;
175 | @apply text-code-white !important;
176 | }
177 | .token.comment {
178 | @apply text-gray-500 !important;
179 | }
180 | .token.atrule {
181 | @apply text-code-yellow !important;
182 | }
183 | .token.atrule > .token.property {
184 | @apply text-code-white !important;
185 | }
186 | .token.atrule > .token.property + .token.punctuation {
187 | @apply text-code-white !important;
188 | }
189 | .token.atrule
190 | > .token.property
191 | + .token.punctuation
192 | + .token.number
193 | + .token.unit {
194 | @apply text-code-white !important;
195 | }
196 | .token.atrule > .token.number {
197 | @apply text-code-white !important;
198 | }
199 | .token.atrule > .token.unit {
200 | @apply text-code-white !important;
201 | }
202 | .token.function {
203 | @apply text-code-blue !important;
204 | }
205 | .token.number {
206 | @apply text-code-red !important;
207 | }
208 | .token.unit {
209 | @apply text-code-red !important;
210 | }
211 | .token.punctuation {
212 | @apply text-code-blue !important;
213 | }
214 | .token.hexcode {
215 | @apply text-code-blue !important;
216 | }
217 | .token.tag {
218 | @apply text-code-red !important;
219 | }
220 | .token.attr-name {
221 | @apply text-code-yellow !important;
222 | }
223 | .token.attr-value {
224 | @apply text-code-green !important;
225 | }
226 | .token.string {
227 | @apply text-code-green !important;
228 | }
229 | .token.url {
230 | @apply text-code-green !important;
231 | }
232 | .token.selector {
233 | @apply text-code-yellow !important;
234 | }
235 | .token.property {
236 | @apply text-code-yellow !important;
237 | }
238 | .token.rule {
239 | @apply text-code-purple !important;
240 | }
241 | .token.important {
242 | font-weight: inherit !important;
243 | @apply text-code-purple !important;
244 | }
245 |
246 | code.language-js,
247 | pre.language-js {
248 | .token.operator {
249 | @apply text-code-blue !important;
250 | }
251 | .token.punctuation {
252 | @apply text-code-white !important;
253 | }
254 | .token.boolean {
255 | @apply text-code-red !important;
256 | }
257 | .token.regex {
258 | @apply text-code-yellow !important;
259 | }
260 | }
261 |
262 | code.language-bash,
263 | pre.language-bash {
264 | .token.function {
265 | @apply text-code-white !important;
266 | }
267 | }
268 |
269 | code.language-diff,
270 | pre.language-diff {
271 | @apply text-gray-400 !important;
272 | .token.deleted {
273 | @apply text-code-red !important;
274 | }
275 | .token.inserted {
276 | @apply text-code-green !important;
277 | }
278 | }
279 |
--------------------------------------------------------------------------------
/packages/split-generator/tailwind.config.js:
--------------------------------------------------------------------------------
1 | const forms = require('@tailwindcss/forms')
2 |
3 | module.exports = {
4 | purge: false,
5 | theme: {
6 | extend: {
7 | colors: {
8 | code: {
9 | green: 'var(--color-code-green)',
10 | yellow: 'var(--color-code-yellow)',
11 | purple: 'var(--color-code-purple)',
12 | red: 'var(--color-code-red)',
13 | blue: 'var(--color-code-blue)',
14 | white: 'var(--color-code-white)',
15 | },
16 | },
17 | },
18 | },
19 | variants: {},
20 | plugins: [forms],
21 | }
22 |
--------------------------------------------------------------------------------
/packages/split-generator/tests/test.js:
--------------------------------------------------------------------------------
1 | test('', () => {})
2 |
--------------------------------------------------------------------------------
/packages/split-grid/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": ["@babel/preset-env"]
3 | }
--------------------------------------------------------------------------------
/packages/split-grid/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) 2020 Nathan Cahill
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 |
--------------------------------------------------------------------------------
/packages/split-grid/README.md:
--------------------------------------------------------------------------------
1 |
2 | # Split Grid [](https://circleci.com/gh/nathancahill/split)  [](https://unpkg.com/split-grid/dist/split-grid.min.js)
3 |
4 | The spiritual successor of [Split.js](https://github.com/nathancahill/split/tree/master/packages/splitjs), built for CSS Grid.
5 |
6 | - __Zero Deps__
7 | - __Tiny:__ Weights 2kb gzipped.
8 | - __Fast:__ No overhead or attached window event listeners, uses pure CSS for resizing.
9 | - __Unopinionated:__ Only modifies `grid-template-*` rules, the rest of the layout is up to you.
10 |
11 | ## Table of Contents
12 |
13 | - [Installation](#installation)
14 | - [Example](#example)
15 | - [Reference](#reference)
16 | - [API](#api)
17 | - [Migrating from Split.js](#migrating-from-splitjs)
18 | - [License](#license)
19 |
20 | ## Installation
21 |
22 | Yarn:
23 |
24 | ```
25 | $ yarn add split-grid
26 | ```
27 |
28 | npm:
29 |
30 | ```
31 | $ npm install --save split-grid
32 | ```
33 |
34 | Include with a module bundler like [rollup](http://rollupjs.org/) or [webpack](https://webpack.github.io/):
35 |
36 | ```js
37 | // using ES6 modules
38 | import Split from 'split-grid'
39 |
40 | // using CommonJS modules
41 | var Split = require('split-grid')
42 | ```
43 |
44 | The [UMD](https://github.com/umdjs/umd) build is also available on [unpkg](http://unpkg.com/):
45 |
46 | ```html
47 |
48 | ```
49 |
50 | You can find the library on `window.Split`.
51 |
52 | ## Example
53 |
54 | ```js
55 | import Split from 'split-grid'
56 |
57 | Split({
58 | columnGutters: [{
59 | track: 1,
60 | element: document.querySelector('.column-1'),
61 | }, {
62 | track: 3,
63 | element: document.querySelector('.column-3'),
64 | }],
65 | rowGutters: [{
66 | track: 1,
67 | element: document.querySelector('.row-1'),
68 | }]
69 | })
70 | ```
71 |
72 | ## Reference
73 |
74 | ```js
75 | Split(options: Options)
76 | ```
77 |
78 | ### Supported CSS values
79 |
80 | Current CSS values that are supported in `grid-template, grid-template-columns, grid-template-rows`:
81 |
82 | - [x] `fr`
83 | - [x] `px`
84 | - [x] `%`
85 | - [x] `repeat`
86 |
87 | Not supported (yet):
88 |
89 | - [ ] `auto`
90 | - [ ] other CSS values (`em, vmin, cm, etc`)
91 |
92 | ### Options
93 |
94 | Most of the options can be specified as `option`, `columnOption` and `rowOption`.
95 | This allows default option values to be set for both, or specified individually for each axis.
96 |
97 | ##### `columnGutters: [{ element: HTMLElement, track: number }]`
98 |
99 | An array of objects, with `element` and `track` keys. `element` is the element
100 | in the grid to enable as a draggable gutter. `track` is the grid track the gutter element
101 | is positioned on. These must match.
102 |
103 | ##### `rowGutters: [{ element: HTMLElement, track: number }]`
104 |
105 | An array of objects, with `element` and `track` keys. `element` is the element
106 | in the grid to enable as a draggable gutter. `track` is the grid track the gutter element
107 | is positioned on. These must match.
108 |
109 | ##### `minSize: number`
110 |
111 | The minimum size in pixels for all tracks. Default: `0`
112 |
113 | ##### `maxSize: number`
114 |
115 | The maximum size in pixels for all tracks. Default: `Infinity`
116 |
117 | ##### `columnMinSize: number`
118 |
119 | The minimum size in pixels for all tracks. Default: `options.minSize`
120 |
121 | ##### `rowMinSize: number`
122 |
123 | The minimum size in pixels for all tracks. Default: `options.minSize`
124 |
125 | ##### `columnMaxSize: number`
126 |
127 | The maximum size in pixels for all tracks. Default: `options.maxSize`
128 |
129 | ##### `rowMaxSize: number`
130 |
131 | The maximum size in pixels for all tracks. Default: `options.maxSize`
132 |
133 | ##### `columnMinSizes: { [track: number]: number }`
134 |
135 | An object keyed by `track` index, with values set to the minimum size in pixels for the
136 | track at that index. Allows individual minSizes to be specified by track.
137 | Note this option is plural with an `s`, while the two fallback options are singular.
138 | Default: `options.columnMinSize`
139 |
140 | ##### `rowMinSizes: { [track: number]: number }`
141 |
142 | An object keyed by `track` index, with values set to the minimum size in pixels for the
143 | track at that index. Allows individual minSizes to be specified by track.
144 | Note this option is plural with an `s`, while the two fallback options are singular.
145 | Default: `options.rowMinSize`
146 |
147 | ##### `columnMaxSizes: { [track: number]: number }`
148 |
149 | An object keyed by `track` index, with values set to the maximum size in pixels for the
150 | track at that index. Allows individual maxSizes to be specified by track.
151 | Note this option is plural with an `s`, while the two fallback options are singular.
152 | Default: `options.columnMaxSize`
153 |
154 | ##### `rowMaxSizes: { [track: number]: number }`
155 |
156 | An object keyed by `track` index, with values set to the maximum size in pixels for the
157 | track at that index. Allows individual maxSizes to be specified by track.
158 | Note this option is plural with an `s`, while the two fallback options are singular.
159 | Default: `options.rowMaxSize`
160 |
161 | ##### `snapOffset: number`
162 |
163 | Snap to minimum size at this offset in pixels. Set to `0` to disable snap. Default: `30`
164 |
165 | ##### `columnSnapOffset: number`
166 |
167 | Snap to minimum size at this offset in pixels. Set to `0` to disable snap. Default: `options.snapOffset`
168 |
169 | ##### `rowSnapOffset: number`
170 |
171 | Snap to minimum size at this offset in pixels. Set to `0` to disable snap. Default: `options.snapOffset`
172 |
173 | ##### `dragInterval: number`
174 |
175 | Drag this number of pixels at a time. Defaults to `1` for smooth dragging,
176 | but can be set to a pixel value to give more control over the resulting sizes. Default: `1`
177 |
178 | ##### `columnDragInterval: number`
179 |
180 | Drag this number of pixels at a time. Defaults to `1` for smooth dragging,
181 | but can be set to a pixel value to give more control over the resulting sizes. Default: `options.dragInterval`
182 |
183 | ##### `rowDragInterval: number`
184 |
185 | Drag this number of pixels at a time. Defaults to `1` for smooth dragging,
186 | but can be set to a pixel value to give more control over the resulting sizes. Default: `options.dragInterval`
187 |
188 | ##### `cursor: string`
189 |
190 | Cursor to show while dragging. Defaults to `'col-resize'` for column gutters and
191 | `'row-resize'` for row gutters.
192 |
193 | ##### `columnCursor: string`
194 |
195 | Cursor to show while dragging. Default: `'col-resize'`
196 |
197 | ##### `rowCursor: string`
198 |
199 | Cursor to show while dragging. Default: `'row-resize'`
200 |
201 | ##### `onDrag: (direction: 'row' | 'column', track: number, gridTemplateStyle: string) => void`
202 |
203 | Called continously on drag. For process intensive code, add a debounce function to rate limit this callback.
204 | `gridTemplateStyle` is the computed CSS value for `grid-template-column` or `grid-template-row`, depending on `direction`.
205 |
206 | ##### `onDragStart: (direction: 'row' | 'column', track: number) => void`
207 |
208 | Called on drag start.
209 |
210 | ##### `onDragEnd: (direction: 'row' | 'column', track: number) => void`
211 |
212 | Called on drag end.
213 |
214 | ##### `writeStyle: (grid: HTMLElement, gridTemplateProp: 'grid-template-column' | 'grid-template-row', gridTemplateStyle: string) => void`
215 |
216 | Called to update the CSS properties of the grid element. Must eventually apply the
217 | CSS value to the CSS prop, or the grid will not change. `gridTemplateStyle` is the computed CSS value of CSS rule `gridTemplateProp`.
218 |
219 | Default:
220 |
221 | ```js
222 | writeStyle: (grid, gridTemplateProp, gridTemplateStyle) => {
223 | grid.style[gridTemplateProp] = gridTemplateStyle
224 | }
225 | ```
226 |
227 | ##### `gridTemplateColumns` `gridTemplateRows`
228 |
229 | Helper options for determining initial CSS values for `grid-template-columns` and `grid-template-rows`.
230 | Most of the time this option is not needed, as Split Grid reads the CSS rules applied to the grid element,
231 | but security settings may prevent that, for example, when the CSS is served from a 3rd-party domain.
232 | This is ONLY NEEDED if the default method of reading the CSS values errors.
233 | This option does not immediately apply CSS rules, it's only used on drag.
234 |
235 | ## API
236 |
237 | ```js
238 | const split = Split(options: Options)
239 | ```
240 |
241 | Split Grid returns an instance with a couple of functions. The instance is returned on creation.
242 |
243 | ##### `split.addColumnGutter(element: HTMLElement, track: number)`
244 |
245 | Adds a draggable row gutter. The element must be a direct descendant
246 | of the element with grid layout, and positioned in the specified track.
247 |
248 | ```js
249 | const grid = document.querySelector('.grid')
250 | const gutter = document.createElement('div')
251 |
252 | grid.appendChild(gutter) // append to DOM
253 | split.addColumnGutter(gutter, 1) // add to Split Grid
254 | ```
255 |
256 | ##### `split.addRowGutter(element: HTMLElement, track: number)`
257 |
258 | Adds a draggable row gutter. The element must be a direct descendant
259 | of the element with grid layout, and positioned in the specified track.
260 |
261 | ```js
262 | const grid = document.querySelector('.grid')
263 | const gutter = document.createElement('div')
264 |
265 | grid.appendChild(gutter) // append to DOM
266 | split.addRowGutter(gutter, 1) // add to Split Grid
267 | ```
268 |
269 | ##### `split.removeColumnGutter(track: number, immediate?: true)`
270 |
271 | Removes event listeners from a column gutter by track number. If `immediate = false` is passed,
272 | event handlers are removed after dragging ends. If a gutter isn't currently being dragged,
273 | it's event handlers are removed immediately.
274 |
275 | ##### `split.removeRowGutter(track: number, immediate?: true)`
276 |
277 | Removes event listeners from a row gutter by track number. If `immediate = false` is passed,
278 | event handlers are removed after dragging ends. If a gutter isn't currently being dragged,
279 | it's event handlers are removed immediately.
280 |
281 | ##### `split.destroy(immediate?: true)`
282 |
283 | Destroy the instance by removing the attached event listeners. If `immediate = false` is passed,
284 | the instance is destroyed after dragging ends. If a gutter isn't currently being dragged,
285 | it's destroyed immediately.
286 |
287 | ## Migrating from Split.js
288 |
289 | #### Bring your own gutters
290 |
291 | In Split.js, gutter elements were created by Split.js and inserted in to the DOM.
292 | This is not the case in Split Grid. Create the gutter elements in the HTML as children
293 | of the grid element, and lay them out in the tracks like any other element.
294 | Pass the gutter elements in the options with their track index.
295 |
296 | __Split.js__
297 |
298 | ```js
299 | Split(options) // gutters created implicitly
300 | ```
301 |
302 | __Split Grid__
303 |
304 | Gutters are part of the grid layout:
305 |
306 | ```html
307 |
308 |
Column One
309 |
310 |
Column Two
311 |
312 |
Column Three
313 |
Row One
314 |
315 |
Row Two
316 |
317 | ```
318 |
319 | ```js
320 | Split({ // gutters specified in options
321 | columnGutters: [{
322 | track: 1,
323 | element: document.querySelector('.gutter-column-1'),
324 | }, {
325 | track: 3,
326 | element: document.querySelector('.gutter-column-3'),
327 | }],
328 | rowGutters: [{
329 | track: 1,
330 | element: document.querySelector('.gutter-row-1'),
331 | }]
332 | })
333 | ```
334 |
335 | #### CSS values replace `sizes` option
336 |
337 | CSS grid layout offers more flexibility than Split.js's percentage values,
338 | so Split Grid uses the `grid-template` values directly. Instead of setting
339 | the initial sizes as an option in Javascript, set the initial sizes in CSS.
340 |
341 | __Split.js__
342 |
343 | ```js
344 | Split({
345 | sizes: [50, 50]
346 | })
347 | ```
348 |
349 | __Split Grid__
350 |
351 | ```html
352 |
353 | ```
354 |
355 | _or_
356 |
357 | ```js
358 | > document.querySelector('.grid').style['grid-template-columns'] = '1fr 10px 1fr'
359 | ```
360 |
361 | #### `split.getSizes()` is replaced by CSS values
362 |
363 | Likewise, the `.getSizes()` function is replaced by reading the CSS values directly.
364 |
365 | __Split.js__
366 |
367 | ```js
368 | > split.getSizes()
369 | [50, 50]
370 | ```
371 |
372 | __Split Grid__
373 |
374 | ```js
375 | > document.querySelector('.grid').style['grid-template-columns']
376 | "1fr 10px 1fr"
377 | ```
378 |
379 | #### `split.setSizes()` is replaced by CSS values
380 |
381 | In the same way, the `.getSizes()` function is replaced by setting the CSS values directly.
382 |
383 | __Split.js__
384 |
385 | ```js
386 | > split.setSizes([50, 50])
387 | ```
388 |
389 | __Split Grid__
390 |
391 | ```js
392 | > document.querySelector('.grid').style['grid-template-columns'] = '1fr 10px 1fr'
393 | ```
394 |
395 | #### `split.destroy()` has different parameters in Split Grid
396 |
397 | Since there's no styles or gutters added by Split Grid, there's no need for Split.js'
398 | `preserveStyles` and `preserveGutters` parameters. Instead, `.destroy()` takes
399 | one parameter, `immediate: boolean`, whether to wait until the gutter has stopped dragging
400 | before removing event listeners.
401 |
402 | ## License
403 |
404 | Copyright (c) 2019 Nathan Cahill
405 |
406 | Permission is hereby granted, free of charge, to any person obtaining a copy
407 | of this software and associated documentation files (the "Software"), to deal
408 | in the Software without restriction, including without limitation the rights
409 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
410 | copies of the Software, and to permit persons to whom the Software is
411 | furnished to do so, subject to the following conditions:
412 |
413 | The above copyright notice and this permission notice shall be included in
414 | all copies or substantial portions of the Software.
415 |
416 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
417 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
418 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
419 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
420 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
421 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
422 | THE SOFTWARE.
423 |
--------------------------------------------------------------------------------
/packages/split-grid/index.d.ts:
--------------------------------------------------------------------------------
1 | declare module 'split-grid' {
2 | // Options passed when creating a new Split instance.
3 | export interface SplitOptions {
4 | // An array of objects, with `element` and `track` keys. `element` is the element in the grid to enable as a draggable gutter. `track` is the grid track the gutter element is positioned on. These must match.
5 | columnGutters?: Gutter[];
6 | // An array of objects, with `element` and `track` keys. `element` is the element in the grid to enable as a draggable gutter. `track` is the grid track the gutter element is positioned on. These must match.
7 | rowGutters?: Gutter[];
8 | // The minimum size in pixels for all tracks. Default: `0`
9 | minSize?: number;
10 | // The maximum size in pixels for all tracks. Default: `Infinity`
11 | maxSize?: number;
12 |
13 | // The minimum size in pixels for all tracks. Default: `options.minSize`
14 | columnMinSize?: number;
15 | // The minimum size in pixels for all tracks. Default: `options.minSize`
16 | rowMinSize?: number;
17 |
18 | // The maximum size in pixels for all tracks. Default: `options.maxSize`
19 | columnMaxSize?: number;
20 | // The maximum size in pixels for all tracks. Default: `options.maxSize`
21 | rowMaxSize?: number;
22 |
23 | // An object keyed by `track` index, with values set to the minimum size in pixels for the track at that index. Allows individual minSizes to be specified by track. Note this option is plural with an `s`, while the two fallback options are singular. Default: `options.columnMinSize`
24 | columnMinSizes?: Sizes;
25 | // An object keyed by `track` index, with values set to the minimum size in pixels for the track at that index. Allows individual minSizes to be specified by track. Note this option is plural with an `s`, while the two fallback options are singular. Default: `options.rowMinSize`
26 | rowMinSizes?: Sizes;
27 |
28 | // An object keyed by `track` index, with values set to the maximum size in pixels for the track at that index. Allows individual maxSizes to be specified by track. Note this option is plural with an `s`, while the two fallback options are singular. Default: `options.columnMaxSize`
29 | columnMaxSizes?: Sizes;
30 | // An object keyed by `track` index, with values set to the maximum size in pixels for the track at that index. Allows individual maxSizes to be specified by track. Note this option is plural with an `s`, while the two fallback options are singular. Default: `options.rowMaxSize`
31 | rowMaxSizes?: Sizes;
32 |
33 | // Snap to minimum size at this offset in pixels. Set to `0` to disable snap. Default: `30`
34 | snapOffset?: number;
35 | // Snap to minimum size at this offset in pixels. Set to `0` to disable snap. Default: `options.snapOffset`
36 | columnSnapOffset?: number;
37 | // Snap to minimum size at this offset in pixels. Set to `0` to disable snap. Default: `options.snapOffset`
38 | rowSnapOffset?: number;
39 | // Drag this number of pixels at a time. Defaults to `1` for smooth dragging, but can be set to a pixel value to give more control over the resulting sizes. Default: `1`
40 | dragInterval?: number;
41 | // Drag this number of pixels at a time. Defaults to `1` for smooth dragging, but can be set to a pixel value to give more control over the resulting sizes. Default: `options.dragInterval`
42 | columnDragInterval?: number;
43 | // Drag this number of pixels at a time. Defaults to `1` for smooth dragging, but can be set to a pixel value to give more control over the resulting sizes. Default: `options.dragInterval`
44 | rowDragInterval?: number;
45 | // Cursor to show while dragging. Defaults to `'col-resize'` for column gutters and `'row-resize'` for row gutters.
46 | cursor?: string;
47 | // Cursor to show while dragging. Default: `'col-resize'`
48 | columnCursor?: string;
49 | // Cursor to show while dragging. Default: `'row-resize'`
50 | rowCursor?: string;
51 | // Called continuously on drag. For process intensive code, add a debounce function to rate limit this callback. `gridTemplateStyle` is the computed CSS value for `grid-template-column` or `grid-template-row`, depending on `direction`.
52 | onDrag?: (direction: Direction, track: number, gridTemplateStyle: string) => void;
53 | // Called on drag start.
54 | onDragStart?: (direction: Direction, track: number) => void;
55 | // Called on drag end.
56 | onDragEnd?: (direction: Direction, track: number) => void;
57 | // Called to update the CSS properties of the grid element. Must eventually apply the CSS value to the CSS prop, or the grid will not change. `gridTemplateStyle` is the computed CSS value of CSS rule `gridTemplateProp`.
58 | writeStyle?: (grid: HTMLElement, gridTemplateProp: GridTemplateProperty, gridTemplateStyle: string) => void;
59 | gridTemplateColumns?: string;
60 | gridTemplateRows?: string;
61 | }
62 |
63 | // Returns from creating a new Split instance.
64 | export interface SplitInstance {
65 | // Adds a draggable row gutter. The element must be a direct descendant of the element with grid layout, and positioned in the specified track.
66 | addColumnGutter: (element: HTMLElement, track: number) => void;
67 | // Adds a draggable row gutter. The element must be a direct descendant of the element with grid layout, and positioned in the specified track.
68 | addRowGutter: (element: HTMLElement, track: number) => void;
69 | // Removes event listeners from a column gutter by track number. If `immediate = false` is passed, event handlers are removed after dragging ends. If a gutter isn't currently being dragged, it's event handlers are removed immediately.
70 | removeColumnGutter: (track: number, immediate?: boolean) => void;
71 | // Removes event listeners from a row gutter by track number. If `immediate = false` is passed, event handlers are removed after dragging ends. If a gutter isn't currently being dragged, it's event handlers are removed immediately.
72 | removeRowGutter: (track: number, immediate?: boolean) => void;
73 | // Destroy the instance by removing the attached event listeners. If `immediate = false` is passed, the instance is destroyed after dragging ends. If a gutter isn't currently being dragged, it's destroyed immediately.
74 | destroy: (immediate?: boolean) => void;
75 | }
76 |
77 | export type Gutter = {
78 | element: HTMLElement;
79 | track: number;
80 | };
81 |
82 | export type Sizes = { [track: number]: number };
83 |
84 | export type Direction = 'row' | 'column';
85 |
86 | export type GridTemplateProperty = 'grid-template-columns' | 'grid-template-rows';
87 |
88 | export default function Split(options: SplitOptions): SplitInstance;
89 | }
90 |
--------------------------------------------------------------------------------
/packages/split-grid/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "split-grid",
3 | "version": "1.0.11",
4 | "description": "The spiritual successor of Split.js, built for CSS Grid",
5 | "main": "dist/split-grid.js",
6 | "minified:main": "dist/split-grid.min.js",
7 | "module": "dist/split-grid.mjs",
8 | "types": "index.d.ts",
9 | "scripts": {
10 | "prepublish": "rollup -c",
11 | "build": "rollup -c && npm run size",
12 | "watch": "rollup -cw",
13 | "test": "jest",
14 | "size": "echo \"gzip size: $(gzip-size --raw $npm_package_minified_main) bytes\""
15 | },
16 | "repository": "https://github.com/nathancahill/split",
17 | "author": "Nathan Cahill ",
18 | "homepage": "https://split.js.org/",
19 | "files": [
20 | "index.d.ts",
21 | "dist"
22 | ],
23 | "license": "MIT",
24 | "collective": {
25 | "type": "opencollective",
26 | "url": "https://opencollective.com/splitjs"
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/packages/split-grid/rollup.config.js:
--------------------------------------------------------------------------------
1 | import resolve from '@rollup/plugin-node-resolve'
2 | import buble from '@rollup/plugin-buble'
3 | import { terser } from 'rollup-plugin-terser'
4 |
5 | const pkg = require('./package.json')
6 |
7 | export default [
8 | {
9 | input: './src/index.js',
10 | output: [
11 | {
12 | name: 'Split',
13 | file: pkg.main,
14 | format: 'umd',
15 | sourcemap: false,
16 | banner: `/*! ${pkg.name} - v${pkg.version} */\n`,
17 | },
18 | {
19 | file: pkg.module,
20 | format: 'esm',
21 | sourcemap: false,
22 | },
23 | ],
24 | plugins: [
25 | resolve(),
26 | buble({
27 | exclude: 'node_modules/**',
28 | objectAssign: 'Object.assign',
29 | transforms: {
30 | forOf: false,
31 | },
32 | }),
33 | ],
34 | },
35 | {
36 | input: './src/index.js',
37 | output: {
38 | name: 'Split',
39 | file: pkg['minified:main'],
40 | format: 'umd',
41 | sourcemap: true,
42 | banner: `/*! ${pkg.name} - v${pkg.version} */\n`,
43 | },
44 | plugins: [
45 | resolve(),
46 | buble({
47 | exclude: 'node_modules/**',
48 | objectAssign: 'Object.assign',
49 | transforms: {
50 | forOf: false,
51 | },
52 | }),
53 | terser(),
54 | ],
55 | },
56 | ]
57 |
--------------------------------------------------------------------------------
/packages/split-grid/src/Gutter.js:
--------------------------------------------------------------------------------
1 | import { parse, getSizeAtTrack } from 'grid-template-utils'
2 | import {
3 | getStyles,
4 | getGapValue,
5 | firstNonZero,
6 | NOOP,
7 | defaultWriteStyle,
8 | getOption,
9 | } from './util'
10 | import getMatchedCSSRules from './getMatchedCSSRules'
11 |
12 | const gridTemplatePropColumns = 'grid-template-columns'
13 | const gridTemplatePropRows = 'grid-template-rows'
14 |
15 | class Gutter {
16 | constructor(direction, options, parentOptions) {
17 | this.direction = direction
18 | this.element = options.element
19 | this.track = options.track
20 |
21 | if (direction === 'column') {
22 | this.gridTemplateProp = gridTemplatePropColumns
23 | this.gridGapProp = 'grid-column-gap'
24 | this.cursor = getOption(
25 | parentOptions,
26 | 'columnCursor',
27 | getOption(parentOptions, 'cursor', 'col-resize'),
28 | )
29 | this.snapOffset = getOption(
30 | parentOptions,
31 | 'columnSnapOffset',
32 | getOption(parentOptions, 'snapOffset', 30),
33 | )
34 | this.dragInterval = getOption(
35 | parentOptions,
36 | 'columnDragInterval',
37 | getOption(parentOptions, 'dragInterval', 1),
38 | )
39 | this.clientAxis = 'clientX'
40 | this.optionStyle = getOption(parentOptions, 'gridTemplateColumns')
41 | } else if (direction === 'row') {
42 | this.gridTemplateProp = gridTemplatePropRows
43 | this.gridGapProp = 'grid-row-gap'
44 | this.cursor = getOption(
45 | parentOptions,
46 | 'rowCursor',
47 | getOption(parentOptions, 'cursor', 'row-resize'),
48 | )
49 | this.snapOffset = getOption(
50 | parentOptions,
51 | 'rowSnapOffset',
52 | getOption(parentOptions, 'snapOffset', 30),
53 | )
54 | this.dragInterval = getOption(
55 | parentOptions,
56 | 'rowDragInterval',
57 | getOption(parentOptions, 'dragInterval', 1),
58 | )
59 | this.clientAxis = 'clientY'
60 | this.optionStyle = getOption(parentOptions, 'gridTemplateRows')
61 | }
62 |
63 | this.onDragStart = getOption(parentOptions, 'onDragStart', NOOP)
64 | this.onDragEnd = getOption(parentOptions, 'onDragEnd', NOOP)
65 | this.onDrag = getOption(parentOptions, 'onDrag', NOOP)
66 | this.writeStyle = getOption(
67 | parentOptions,
68 | 'writeStyle',
69 | defaultWriteStyle,
70 | )
71 |
72 | this.startDragging = this.startDragging.bind(this)
73 | this.stopDragging = this.stopDragging.bind(this)
74 | this.drag = this.drag.bind(this)
75 |
76 | this.minSizeStart = options.minSizeStart
77 | this.minSizeEnd = options.minSizeEnd
78 | this.maxSizeStart = options.maxSizeStart
79 | this.maxSizeEnd = options.maxSizeEnd
80 |
81 | if (options.element) {
82 | this.element.addEventListener('mousedown', this.startDragging)
83 | this.element.addEventListener('touchstart', this.startDragging)
84 | }
85 | }
86 |
87 | getDimensions() {
88 | const {
89 | width,
90 | height,
91 | top,
92 | bottom,
93 | left,
94 | right,
95 | } = this.grid.getBoundingClientRect()
96 |
97 | if (this.direction === 'column') {
98 | this.start = top
99 | this.end = bottom
100 | this.size = height
101 | } else if (this.direction === 'row') {
102 | this.start = left
103 | this.end = right
104 | this.size = width
105 | }
106 | }
107 |
108 | getSizeAtTrack(track, end) {
109 | return getSizeAtTrack(
110 | track,
111 | this.computedPixels,
112 | this.computedGapPixels,
113 | end,
114 | )
115 | }
116 |
117 | getSizeOfTrack(track) {
118 | return this.computedPixels[track].numeric
119 | }
120 |
121 | getRawTracks() {
122 | const tracks = getStyles(
123 | this.gridTemplateProp,
124 | [this.grid],
125 | getMatchedCSSRules(this.grid),
126 | )
127 | if (!tracks.length) {
128 | if (this.optionStyle) return this.optionStyle
129 |
130 | throw Error('Unable to determine grid template tracks from styles.')
131 | }
132 | return tracks[0]
133 | }
134 |
135 | getGap() {
136 | const gap = getStyles(
137 | this.gridGapProp,
138 | [this.grid],
139 | getMatchedCSSRules(this.grid),
140 | )
141 | if (!gap.length) {
142 | return null
143 | }
144 | return gap[0]
145 | }
146 |
147 | getRawComputedTracks() {
148 | return window.getComputedStyle(this.grid)[this.gridTemplateProp]
149 | }
150 |
151 | getRawComputedGap() {
152 | return window.getComputedStyle(this.grid)[this.gridGapProp]
153 | }
154 |
155 | setTracks(raw) {
156 | this.tracks = raw.split(' ')
157 | this.trackValues = parse(raw)
158 | }
159 |
160 | setComputedTracks(raw) {
161 | this.computedTracks = raw.split(' ')
162 | this.computedPixels = parse(raw)
163 | }
164 |
165 | setGap(raw) {
166 | this.gap = raw
167 | }
168 |
169 | setComputedGap(raw) {
170 | this.computedGap = raw
171 | this.computedGapPixels = getGapValue('px', this.computedGap) || 0
172 | }
173 |
174 | getMousePosition(e) {
175 | if ('touches' in e) return e.touches[0][this.clientAxis]
176 | return e[this.clientAxis]
177 | }
178 |
179 | startDragging(e) {
180 | if ('button' in e && e.button !== 0) {
181 | return
182 | }
183 |
184 | // Don't actually drag the element. We emulate that in the drag function.
185 | e.preventDefault()
186 |
187 | if (this.element) {
188 | this.grid = this.element.parentNode
189 | } else {
190 | this.grid = e.target.parentNode
191 | }
192 |
193 | this.getDimensions()
194 | this.setTracks(this.getRawTracks())
195 | this.setComputedTracks(this.getRawComputedTracks())
196 | this.setGap(this.getGap())
197 | this.setComputedGap(this.getRawComputedGap())
198 |
199 | const trackPercentage = this.trackValues.filter(
200 | track => track.type === '%',
201 | )
202 | const trackFr = this.trackValues.filter(track => track.type === 'fr')
203 |
204 | this.totalFrs = trackFr.length
205 |
206 | if (this.totalFrs) {
207 | const track = firstNonZero(trackFr)
208 |
209 | if (track !== null) {
210 | this.frToPixels =
211 | this.computedPixels[track].numeric / trackFr[track].numeric
212 | }
213 | }
214 |
215 | if (trackPercentage.length) {
216 | const track = firstNonZero(trackPercentage)
217 |
218 | if (track !== null) {
219 | this.percentageToPixels =
220 | this.computedPixels[track].numeric /
221 | trackPercentage[track].numeric
222 | }
223 | }
224 |
225 | // get start of gutter track
226 | const gutterStart = this.getSizeAtTrack(this.track, false) + this.start
227 | this.dragStartOffset = this.getMousePosition(e) - gutterStart
228 |
229 | this.aTrack = this.track - 1
230 |
231 | if (this.track < this.tracks.length - 1) {
232 | this.bTrack = this.track + 1
233 | } else {
234 | throw Error(
235 | `Invalid track index: ${this.track}. Track must be between two other tracks and only ${this.tracks.length} tracks were found.`,
236 | )
237 | }
238 |
239 | this.aTrackStart = this.getSizeAtTrack(this.aTrack, false) + this.start
240 | this.bTrackEnd = this.getSizeAtTrack(this.bTrack, true) + this.start
241 |
242 | // Set the dragging property of the pair object.
243 | this.dragging = true
244 |
245 | // All the binding. `window` gets the stop events in case we drag out of the elements.
246 | window.addEventListener('mouseup', this.stopDragging)
247 | window.addEventListener('touchend', this.stopDragging)
248 | window.addEventListener('touchcancel', this.stopDragging)
249 | window.addEventListener('mousemove', this.drag)
250 | window.addEventListener('touchmove', this.drag)
251 |
252 | // Disable selection. Disable!
253 | this.grid.addEventListener('selectstart', NOOP)
254 | this.grid.addEventListener('dragstart', NOOP)
255 |
256 | this.grid.style.userSelect = 'none'
257 | this.grid.style.webkitUserSelect = 'none'
258 | this.grid.style.MozUserSelect = 'none'
259 | this.grid.style.pointerEvents = 'none'
260 |
261 | // Set the cursor at multiple levels
262 | this.grid.style.cursor = this.cursor
263 | window.document.body.style.cursor = this.cursor
264 |
265 | this.onDragStart(this.direction, this.track)
266 | }
267 |
268 | stopDragging() {
269 | this.dragging = false
270 |
271 | // Remove the stored event listeners. This is why we store them.
272 | this.cleanup()
273 |
274 | this.onDragEnd(this.direction, this.track)
275 |
276 | if (this.needsDestroy) {
277 | if (this.element) {
278 | this.element.removeEventListener(
279 | 'mousedown',
280 | this.startDragging,
281 | )
282 | this.element.removeEventListener(
283 | 'touchstart',
284 | this.startDragging,
285 | )
286 | }
287 | this.destroyCb()
288 | this.needsDestroy = false
289 | this.destroyCb = null
290 | }
291 | }
292 |
293 | drag(e) {
294 | let mousePosition = this.getMousePosition(e)
295 |
296 | const gutterSize = this.getSizeOfTrack(this.track)
297 | const minMousePosition = Math.max(
298 | this.aTrackStart +
299 | this.minSizeStart +
300 | this.dragStartOffset +
301 | this.computedGapPixels,
302 | this.bTrackEnd -
303 | this.maxSizeEnd -
304 | this.computedGapPixels -
305 | (gutterSize - this.dragStartOffset),
306 | )
307 | const maxMousePosition = Math.min(
308 | this.bTrackEnd -
309 | this.minSizeEnd -
310 | this.computedGapPixels -
311 | (gutterSize - this.dragStartOffset),
312 | this.aTrackStart +
313 | this.maxSizeStart +
314 | this.dragStartOffset +
315 | this.computedGapPixels,
316 | )
317 | const minMousePositionOffset = minMousePosition + this.snapOffset
318 | const maxMousePositionOffset = maxMousePosition - this.snapOffset
319 |
320 | if (mousePosition < minMousePositionOffset) {
321 | mousePosition = minMousePosition
322 | }
323 |
324 | if (mousePosition > maxMousePositionOffset) {
325 | mousePosition = maxMousePosition
326 | }
327 |
328 | if (mousePosition < minMousePosition) {
329 | mousePosition = minMousePosition
330 | } else if (mousePosition > maxMousePosition) {
331 | mousePosition = maxMousePosition
332 | }
333 |
334 | let aTrackSize =
335 | mousePosition -
336 | this.aTrackStart -
337 | this.dragStartOffset -
338 | this.computedGapPixels
339 | let bTrackSize =
340 | this.bTrackEnd -
341 | mousePosition +
342 | this.dragStartOffset -
343 | gutterSize -
344 | this.computedGapPixels
345 |
346 | if (this.dragInterval > 1) {
347 | const aTrackSizeIntervaled =
348 | Math.round(aTrackSize / this.dragInterval) * this.dragInterval
349 | bTrackSize -= aTrackSizeIntervaled - aTrackSize
350 | aTrackSize = aTrackSizeIntervaled
351 | }
352 |
353 | if (aTrackSize < this.minSizeStart) {
354 | aTrackSize = this.minSizeStart
355 | }
356 |
357 | if (bTrackSize < this.minSizeEnd) {
358 | bTrackSize = this.minSizeEnd
359 | }
360 |
361 | if (this.trackValues[this.aTrack].type === 'px') {
362 | this.tracks[this.aTrack] = `${aTrackSize}px`
363 | } else if (this.trackValues[this.aTrack].type === 'fr') {
364 | if (this.totalFrs === 1) {
365 | this.tracks[this.aTrack] = '1fr'
366 | } else {
367 | const targetFr = aTrackSize / this.frToPixels
368 | this.tracks[this.aTrack] = `${targetFr}fr`
369 | }
370 | } else if (this.trackValues[this.aTrack].type === '%') {
371 | const targetPercentage = aTrackSize / this.percentageToPixels
372 | this.tracks[this.aTrack] = `${targetPercentage}%`
373 | }
374 |
375 | if (this.trackValues[this.bTrack].type === 'px') {
376 | this.tracks[this.bTrack] = `${bTrackSize}px`
377 | } else if (this.trackValues[this.bTrack].type === 'fr') {
378 | if (this.totalFrs === 1) {
379 | this.tracks[this.bTrack] = '1fr'
380 | } else {
381 | const targetFr = bTrackSize / this.frToPixels
382 | this.tracks[this.bTrack] = `${targetFr}fr`
383 | }
384 | } else if (this.trackValues[this.bTrack].type === '%') {
385 | const targetPercentage = bTrackSize / this.percentageToPixels
386 | this.tracks[this.bTrack] = `${targetPercentage}%`
387 | }
388 |
389 | const style = this.tracks.join(' ')
390 | this.writeStyle(this.grid, this.gridTemplateProp, style)
391 | this.onDrag(this.direction, this.track, style)
392 | }
393 |
394 | cleanup() {
395 | window.removeEventListener('mouseup', this.stopDragging)
396 | window.removeEventListener('touchend', this.stopDragging)
397 | window.removeEventListener('touchcancel', this.stopDragging)
398 | window.removeEventListener('mousemove', this.drag)
399 | window.removeEventListener('touchmove', this.drag)
400 |
401 | if (this.grid) {
402 | this.grid.removeEventListener('selectstart', NOOP)
403 | this.grid.removeEventListener('dragstart', NOOP)
404 |
405 | this.grid.style.userSelect = ''
406 | this.grid.style.webkitUserSelect = ''
407 | this.grid.style.MozUserSelect = ''
408 | this.grid.style.pointerEvents = ''
409 |
410 | this.grid.style.cursor = ''
411 | }
412 |
413 | window.document.body.style.cursor = ''
414 | }
415 |
416 | destroy(immediate = true, cb) {
417 | if (immediate || this.dragging === false) {
418 | this.cleanup()
419 | if (this.element) {
420 | this.element.removeEventListener(
421 | 'mousedown',
422 | this.startDragging,
423 | )
424 | this.element.removeEventListener(
425 | 'touchstart',
426 | this.startDragging,
427 | )
428 | }
429 |
430 | if (cb) {
431 | cb()
432 | }
433 | } else {
434 | this.needsDestroy = true
435 | if (cb) {
436 | this.destroyCb = cb
437 | }
438 | }
439 | }
440 | }
441 |
442 | export default Gutter
443 |
--------------------------------------------------------------------------------
/packages/split-grid/src/getMatchedCSSRules.js:
--------------------------------------------------------------------------------
1 | export default el =>
2 | []
3 | .concat(
4 | ...Array.from(el.ownerDocument.styleSheets).map(s => {
5 | let rules = []
6 |
7 | try {
8 | rules = Array.from(s.cssRules || [])
9 | } catch (e) {
10 | // Ignore results on security error
11 | }
12 |
13 | return rules
14 | }),
15 | )
16 | .filter(r => {
17 | let matches = false
18 | try {
19 | matches = el.matches(r.selectorText)
20 | } catch (e) {
21 | // Ignore matching erros
22 | }
23 |
24 | return matches
25 | })
26 |
--------------------------------------------------------------------------------
/packages/split-grid/src/index.js:
--------------------------------------------------------------------------------
1 | import Gutter from './Gutter'
2 | import { getOption } from './util'
3 |
4 | const getTrackOption = (options, track, defaultValue) => {
5 | if (track in options) {
6 | return options[track]
7 | }
8 |
9 | return defaultValue
10 | }
11 |
12 | const createGutter = (direction, options) => gutterOptions => {
13 | if (gutterOptions.track < 1) {
14 | throw Error(
15 | `Invalid track index: ${gutterOptions.track}. Track must be between two other tracks.`,
16 | )
17 | }
18 |
19 | const trackMinSizes =
20 | direction === 'column'
21 | ? options.columnMinSizes || {}
22 | : options.rowMinSizes || {}
23 | const trackMaxSizes =
24 | direction === 'column'
25 | ? options.columnMaxSizes || {}
26 | : options.rowMaxSizes || {}
27 | const trackMinSize = direction === 'column' ? 'columnMinSize' : 'rowMinSize'
28 | const trackMaxSize = direction === 'column' ? 'columnMaxSize' : 'rowMaxSize'
29 |
30 | return new Gutter(
31 | direction,
32 | {
33 | minSizeStart: getTrackOption(
34 | trackMinSizes,
35 | gutterOptions.track - 1,
36 | getOption(
37 | options,
38 | trackMinSize,
39 | getOption(options, 'minSize', 0),
40 | ),
41 | ),
42 | minSizeEnd: getTrackOption(
43 | trackMinSizes,
44 | gutterOptions.track + 1,
45 | getOption(
46 | options,
47 | trackMinSize,
48 | getOption(options, 'minSize', 0),
49 | ),
50 | ),
51 | maxSizeStart: getTrackOption(
52 | trackMaxSizes,
53 | gutterOptions.track - 1,
54 | getOption(
55 | options,
56 | trackMaxSize,
57 | getOption(options, 'maxSize', Infinity),
58 | ),
59 | ),
60 | maxSizeEnd: getTrackOption(
61 | trackMaxSizes,
62 | gutterOptions.track + 1,
63 | getOption(
64 | options,
65 | trackMaxSize,
66 | getOption(options, 'maxSize', Infinity),
67 | ),
68 | ),
69 | ...gutterOptions,
70 | },
71 | options,
72 | )
73 | }
74 |
75 | class Grid {
76 | constructor(options) {
77 | this.columnGutters = {}
78 | this.rowGutters = {}
79 |
80 | this.options = {
81 | columnGutters: options.columnGutters || [],
82 | rowGutters: options.rowGutters || [],
83 | columnMinSizes: options.columnMinSizes || {},
84 | rowMinSizes: options.rowMinSizes || {},
85 | columnMaxSizes: options.columnMaxSizes || {},
86 | rowMaxSizes: options.rowMaxSizes || {},
87 | ...options,
88 | }
89 |
90 | this.options.columnGutters.forEach(gutterOptions => {
91 | this.columnGutters[gutterOptions.track] = createGutter(
92 | 'column',
93 | this.options,
94 | )(gutterOptions)
95 | })
96 |
97 | this.options.rowGutters.forEach(gutterOptions => {
98 | this.rowGutters[gutterOptions.track] = createGutter(
99 | 'row',
100 | this.options,
101 | )(gutterOptions)
102 | })
103 | }
104 |
105 | addColumnGutter(element, track) {
106 | if (this.columnGutters[track]) {
107 | this.columnGutters[track].destroy()
108 | }
109 |
110 | this.columnGutters[track] = createGutter(
111 | 'column',
112 | this.options,
113 | )({
114 | element,
115 | track,
116 | })
117 | }
118 |
119 | addRowGutter(element, track) {
120 | if (this.rowGutters[track]) {
121 | this.rowGutters[track].destroy()
122 | }
123 |
124 | this.rowGutters[track] = createGutter(
125 | 'row',
126 | this.options,
127 | )({
128 | element,
129 | track,
130 | })
131 | }
132 |
133 | removeColumnGutter(track, immediate = true) {
134 | if (this.columnGutters[track]) {
135 | this.columnGutters[track].destroy(immediate, () => {
136 | delete this.columnGutters[track]
137 | })
138 | }
139 | }
140 |
141 | removeRowGutter(track, immediate = true) {
142 | if (this.rowGutters[track]) {
143 | this.rowGutters[track].destroy(immediate, () => {
144 | delete this.rowGutters[track]
145 | })
146 | }
147 | }
148 |
149 | handleDragStart(e, direction, track) {
150 | if (direction === 'column') {
151 | if (this.columnGutters[track]) {
152 | this.columnGutters[track].destroy()
153 | }
154 |
155 | this.columnGutters[track] = createGutter(
156 | 'column',
157 | this.options,
158 | )({
159 | track,
160 | })
161 | this.columnGutters[track].startDragging(e)
162 | } else if (direction === 'row') {
163 | if (this.rowGutters[track]) {
164 | this.rowGutters[track].destroy()
165 | }
166 |
167 | this.rowGutters[track] = createGutter(
168 | 'row',
169 | this.options,
170 | )({
171 | track,
172 | })
173 | this.rowGutters[track].startDragging(e)
174 | }
175 | }
176 |
177 | destroy(immediate = true) {
178 | Object.keys(this.columnGutters).forEach(track =>
179 | this.columnGutters[track].destroy(immediate, () => {
180 | delete this.columnGutters[track]
181 | }),
182 | )
183 | Object.keys(this.rowGutters).forEach(track =>
184 | this.rowGutters[track].destroy(immediate, () => {
185 | delete this.rowGutters[track]
186 | }),
187 | )
188 | }
189 | }
190 |
191 | export default options => new Grid(options)
192 |
--------------------------------------------------------------------------------
/packages/split-grid/src/util.js:
--------------------------------------------------------------------------------
1 | export const getStyles = (rule, ownRules, matchedRules) =>
2 | [...ownRules, ...matchedRules]
3 | .map(r => r.style[rule])
4 | .filter(style => style !== undefined && style !== '')
5 |
6 | export const getGapValue = (unit, size) => {
7 | if (size.endsWith(unit)) {
8 | return Number(size.slice(0, -1 * unit.length))
9 | }
10 | return null
11 | }
12 |
13 | export const firstNonZero = tracks => {
14 | // eslint-disable-next-line no-plusplus
15 | for (let i = 0; i < tracks.length; i++) {
16 | if (tracks[i].numeric > 0) {
17 | return i
18 | }
19 | }
20 | return null
21 | }
22 |
23 | export const NOOP = () => false
24 |
25 | export const defaultWriteStyle = (element, gridTemplateProp, style) => {
26 | // eslint-disable-next-line no-param-reassign
27 | element.style[gridTemplateProp] = style
28 | }
29 |
30 | export const getOption = (options, propName, def) => {
31 | const value = options[propName]
32 | if (value !== undefined) {
33 | return value
34 | }
35 | return def
36 | }
37 |
--------------------------------------------------------------------------------
/packages/split-grid/src/util.test.js:
--------------------------------------------------------------------------------
1 | /* eslint-env jest */
2 |
3 | import { getStyles, getGapValue, firstNonZero } from './util'
4 |
5 | const ownStyle = { 'grid-template-columns': '2px 2px 2px' }
6 |
7 | const columns = { 'grid-template-columns': '1px 1px 1px' }
8 | const emptyColumns = { 'grid-template-columns': '' }
9 | const noColumns = {}
10 |
11 | test('getStyles columns', () => {
12 | const res = getStyles(
13 | 'grid-template-columns',
14 | [{ style: {} }],
15 | [{ style: columns }],
16 | )
17 | expect(res).toEqual(['1px 1px 1px'])
18 | })
19 |
20 | test('getStyles emptyColumns', () => {
21 | const res = getStyles(
22 | 'grid-template-columns',
23 | [{ style: {} }],
24 | [{ style: emptyColumns }],
25 | )
26 | expect(res).toEqual([])
27 | })
28 |
29 | test('getStyles noColumns', () => {
30 | const res = getStyles(
31 | 'grid-template-columns',
32 | [{ style: {} }],
33 | [{ style: noColumns }],
34 | )
35 | expect(res).toEqual([])
36 | })
37 |
38 | test('getStyles ownStyle', () => {
39 | const res = getStyles(
40 | 'grid-template-columns',
41 | [{ style: ownStyle }],
42 | [{ style: noColumns }],
43 | )
44 | expect(res).toEqual(['2px 2px 2px'])
45 | })
46 |
47 | test('getStyles ownStyle no match', () => {
48 | const res = getStyles(
49 | 'grid-template-columns',
50 | [{ style: { other: '1' } }],
51 | [{ style: columns }],
52 | )
53 | expect(res).toEqual(['1px 1px 1px'])
54 | })
55 |
56 | const rows = { 'grid-template-rows': '1px 1px 1px' }
57 | const emptyRows = { 'grid-template-rows': '' }
58 | const noRows = {}
59 |
60 | test('getStyles rows', () => {
61 | const res = getStyles(
62 | 'grid-template-rows',
63 | [{ style: {} }],
64 | [{ style: rows }],
65 | )
66 | expect(res).toEqual(['1px 1px 1px'])
67 | })
68 |
69 | test('getStyles emptyRows', () => {
70 | const res = getStyles(
71 | 'grid-template-rows',
72 | [{ style: {} }],
73 | [{ style: emptyRows }],
74 | )
75 | expect(res).toEqual([])
76 | })
77 |
78 | test('getStyles noRows', () => {
79 | const res = getStyles(
80 | 'grid-template-rows',
81 | [{ style: {} }],
82 | [{ style: noRows }],
83 | )
84 | expect(res).toEqual([])
85 | })
86 |
87 | test('getGapValue', () => {
88 | expect(getGapValue('px', '10px')).toEqual(10)
89 | })
90 |
91 | test('firstNonZero first', () => {
92 | expect(firstNonZero([{ numeric: 1 }, { numeric: 0 }])).toEqual(0)
93 | })
94 |
95 | test('firstNonZero second', () => {
96 | expect(firstNonZero([{ numeric: 0 }, { numeric: 1 }])).toEqual(1)
97 | })
98 |
--------------------------------------------------------------------------------
/packages/splitjs/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) 2020 Nathan Cahill
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 |
--------------------------------------------------------------------------------
/packages/splitjs/grips/horizontal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nathancahill/split/48759432a50510e2ed762109d5a8d12a3aac9e63/packages/splitjs/grips/horizontal.png
--------------------------------------------------------------------------------
/packages/splitjs/grips/vertical.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nathancahill/split/48759432a50510e2ed762109d5a8d12a3aac9e63/packages/splitjs/grips/vertical.png
--------------------------------------------------------------------------------
/packages/splitjs/index.d.ts:
--------------------------------------------------------------------------------
1 | // Type definitions for Split.js
2 | // Project: https://github.com/nathancahill/split/tree/master/packages/splitjs
3 | // Definitions by: Ilia Choly
4 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
5 | // TypeScript Version: 2.1
6 |
7 | // Global variable outside module loader
8 | export as namespace Split
9 |
10 | // Module loader
11 | export = Split
12 |
13 | declare function Split(
14 | elements: Array,
15 | options?: Split.Options,
16 | ): Split.Instance
17 |
18 | declare namespace Split {
19 | type Partial = { [P in keyof T]?: T[P] }
20 | type CSSStyleDeclarationPartial = Partial
21 |
22 | interface Options {
23 | // Initial sizes of each element in percents or CSS values.
24 | sizes?: number[]
25 |
26 | // Minimum size of each element.
27 | minSize?: number | number[]
28 |
29 | // Maximum size of each element.
30 | maxSize?: number | number[]
31 |
32 | expandToMin?: boolean
33 |
34 | // Gutter size in pixels.
35 | gutterSize?: number
36 |
37 | gutterAlign?: string
38 |
39 | // Snap to minimum size offset in pixels.
40 | snapOffset?: number | number[]
41 |
42 | dragInterval?: number
43 |
44 | // Direction to split: horizontal or vertical.
45 | direction?: 'horizontal' | 'vertical'
46 |
47 | // Cursor to display while dragging.
48 | cursor?: string
49 |
50 | // Callback on drag.
51 | onDrag?(sizes: number[]): void
52 |
53 | // Callback on drag start.
54 | onDragStart?(sizes: number[]): void
55 |
56 | // Callback on drag end.
57 | onDragEnd?(sizes: number[]): void
58 |
59 | // Called to create each gutter element
60 | gutter?(
61 | index: number,
62 | direction: 'horizontal' | 'vertical',
63 | ): HTMLElement
64 |
65 | // Called to set the style of each element.
66 | elementStyle?(
67 | dimension: 'width' | 'height',
68 | elementSize: number,
69 | gutterSize: number,
70 | index: number,
71 | ): CSSStyleDeclarationPartial
72 |
73 | // Called to set the style of the gutter.
74 | gutterStyle?(
75 | dimension: 'width' | 'height',
76 | gutterSize: number,
77 | index: number,
78 | ): CSSStyleDeclarationPartial
79 | }
80 |
81 | interface Instance {
82 | // setSizes behaves the same as the sizes configuration option, passing an array of percents or CSS values.
83 | // It updates the sizes of the elements in the split.
84 | setSizes(sizes: number[]): void
85 |
86 | // getSizes returns an array of percents, suitable for using with setSizes or creation.
87 | getSizes(): number[]
88 |
89 | // collapse changes the size of element at index to 0.
90 | // Every element except the last is collapsed towards the front (left or top).
91 | // The last is collapsed towards the back.
92 | collapse(index: number): void
93 |
94 | // Destroy the instance. It removes the gutter elements, and the size CSS styles Split.js set.
95 | destroy(preserveStyles?: boolean, preserveGutters?: boolean): void
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/packages/splitjs/karma.conf.js:
--------------------------------------------------------------------------------
1 | module.exports = config => {
2 | config.set({
3 | customLaunchers: {
4 | // latest firefox, chrome, safari
5 | sl_firefox_latest: {
6 | base: 'SauceLabs',
7 | browserName: 'firefox',
8 | platform: 'Windows 10',
9 | version: 'latest',
10 | },
11 | sl_chrome_latest: {
12 | base: 'SauceLabs',
13 | browserName: 'chrome',
14 | platform: 'Windows 10',
15 | version: 'latest',
16 | },
17 | sl_safari: {
18 | base: 'SauceLabs',
19 | browserName: 'safari',
20 | platform: 'macOS 10.15',
21 | version: 'latest',
22 | },
23 |
24 | // latest edge
25 | sl_edge: {
26 | base: 'SauceLabs',
27 | browserName: 'MicrosoftEdge',
28 | platform: 'Windows 10',
29 | version: 'latest',
30 | },
31 | // ie 11
32 | sl_ie_11: {
33 | base: 'SauceLabs',
34 | browserName: 'internet explorer',
35 | platform: 'Windows 10',
36 | version: 'latest',
37 | },
38 | // ie 10
39 | sl_ie_10: {
40 | base: 'SauceLabs',
41 | browserName: 'internet explorer',
42 | platform: 'Windows 7',
43 | version: '10.0',
44 | },
45 | },
46 | frameworks: ['jasmine'],
47 | browsers: ['FirefoxHeadless', 'ChromeHeadless'],
48 | singleRun: true,
49 | files: ['dist/split.js', 'test/split.spec.js'],
50 | })
51 | }
52 |
--------------------------------------------------------------------------------
/packages/splitjs/logo.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/packages/splitjs/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "split.js",
3 | "version": "1.6.5",
4 | "description": "2kb unopinionated utility for resizeable split views",
5 | "main": "dist/split.js",
6 | "minified:main": "dist/split.min.js",
7 | "module": "dist/split.es.js",
8 | "types": "index.d.ts",
9 | "repository": "https://github.com/nathancahill/split",
10 | "keywords": [
11 | "css",
12 | "split",
13 | "flexbox",
14 | "tiny",
15 | "split-layout"
16 | ],
17 | "author": "Nathan Cahill ",
18 | "license": "MIT",
19 | "homepage": "https://split.js.org/",
20 | "scripts": {
21 | "test": "karma start",
22 | "prepublish": "rollup -c",
23 | "build": "rollup -c && npm run size",
24 | "watch": "rollup -cw",
25 | "size": "echo \"gzip size: $(gzip-size --raw $npm_package_minified_main) bytes\"",
26 | "saucelabs": "yarn run test --browsers sl_firefox_latest,sl_chrome_latest,sl_safari,sl_edge,sl_ie_11,sl_ie_10"
27 | },
28 | "files": [
29 | "index.d.ts",
30 | "dist"
31 | ],
32 | "browserslist": [
33 | "Chrome >= 22",
34 | "Firefox >= 6",
35 | "Opera >= 15",
36 | "Safari >= 6.2",
37 | "IE >= 9"
38 | ],
39 | "collective": {
40 | "type": "opencollective",
41 | "url": "https://opencollective.com/splitjs"
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/packages/splitjs/rollup.config.js:
--------------------------------------------------------------------------------
1 | import buble from '@rollup/plugin-buble'
2 | import { terser } from 'rollup-plugin-terser'
3 |
4 | const pkg = require('./package.json')
5 |
6 | const output = {
7 | format: 'umd',
8 | file: pkg.main,
9 | name: 'Split',
10 | sourcemap: false,
11 | banner: `/*! Split.js - v${pkg.version} */\n`,
12 | }
13 |
14 | export default [
15 | {
16 | input: 'src/split.js',
17 | output: [
18 | output,
19 | {
20 | file: pkg.module,
21 | format: 'esm',
22 | sourcemap: false,
23 | },
24 | ],
25 | plugins: [buble()],
26 | },
27 | {
28 | input: 'src/split.js',
29 | output: {
30 | ...output,
31 | sourcemap: true,
32 | file: pkg['minified:main'],
33 | },
34 | plugins: [buble(), terser()],
35 | },
36 | ]
37 |
--------------------------------------------------------------------------------
/packages/splitjs/test/SpecRunner.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Jasmine Spec Runner v3.5.0
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/packages/splitjs/test/lib/jasmine-3.5.0/boot.js:
--------------------------------------------------------------------------------
1 | /**
2 | Starting with version 2.0, this file "boots" Jasmine, performing all of the necessary initialization before executing the loaded environment and all of a project's specs. This file should be loaded after `jasmine.js` and `jasmine_html.js`, but before any project source files or spec files are loaded. Thus this file can also be used to customize Jasmine for a project.
3 |
4 | If a project is using Jasmine via the standalone distribution, this file can be customized directly. If a project is using Jasmine via the [Ruby gem][jasmine-gem], this file can be copied into the support directory via `jasmine copy_boot_js`. Other environments (e.g., Python) will have different mechanisms.
5 |
6 | The location of `boot.js` can be specified and/or overridden in `jasmine.yml`.
7 |
8 | [jasmine-gem]: http://github.com/pivotal/jasmine-gem
9 | */
10 |
11 | (function() {
12 |
13 | /**
14 | * ## Require & Instantiate
15 | *
16 | * Require Jasmine's core files. Specifically, this requires and attaches all of Jasmine's code to the `jasmine` reference.
17 | */
18 | window.jasmine = jasmineRequire.core(jasmineRequire);
19 |
20 | /**
21 | * Since this is being run in a browser and the results should populate to an HTML page, require the HTML-specific Jasmine code, injecting the same reference.
22 | */
23 | jasmineRequire.html(jasmine);
24 |
25 | /**
26 | * Create the Jasmine environment. This is used to run all specs in a project.
27 | */
28 | var env = jasmine.getEnv();
29 |
30 | /**
31 | * ## The Global Interface
32 | *
33 | * Build up the functions that will be exposed as the Jasmine public interface. A project can customize, rename or alias any of these functions as desired, provided the implementation remains unchanged.
34 | */
35 | var jasmineInterface = jasmineRequire.interface(jasmine, env);
36 |
37 | /**
38 | * Add all of the Jasmine global/public interface to the global scope, so a project can use the public interface directly. For example, calling `describe` in specs instead of `jasmine.getEnv().describe`.
39 | */
40 | extend(window, jasmineInterface);
41 |
42 | /**
43 | * ## Runner Parameters
44 | *
45 | * More browser specific code - wrap the query string in an object and to allow for getting/setting parameters from the runner user interface.
46 | */
47 |
48 | var queryString = new jasmine.QueryString({
49 | getWindowLocation: function() { return window.location; }
50 | });
51 |
52 | var filterSpecs = !!queryString.getParam("spec");
53 |
54 | var config = {
55 | failFast: queryString.getParam("failFast"),
56 | oneFailurePerSpec: queryString.getParam("oneFailurePerSpec"),
57 | hideDisabled: queryString.getParam("hideDisabled")
58 | };
59 |
60 | var random = queryString.getParam("random");
61 |
62 | if (random !== undefined && random !== "") {
63 | config.random = random;
64 | }
65 |
66 | var seed = queryString.getParam("seed");
67 | if (seed) {
68 | config.seed = seed;
69 | }
70 |
71 | /**
72 | * ## Reporters
73 | * The `HtmlReporter` builds all of the HTML UI for the runner page. This reporter paints the dots, stars, and x's for specs, as well as all spec names and all failures (if any).
74 | */
75 | var htmlReporter = new jasmine.HtmlReporter({
76 | env: env,
77 | navigateWithNewParam: function(key, value) { return queryString.navigateWithNewParam(key, value); },
78 | addToExistingQueryString: function(key, value) { return queryString.fullStringWithNewParam(key, value); },
79 | getContainer: function() { return document.body; },
80 | createElement: function() { return document.createElement.apply(document, arguments); },
81 | createTextNode: function() { return document.createTextNode.apply(document, arguments); },
82 | timer: new jasmine.Timer(),
83 | filterSpecs: filterSpecs
84 | });
85 |
86 | /**
87 | * The `jsApiReporter` also receives spec results, and is used by any environment that needs to extract the results from JavaScript.
88 | */
89 | env.addReporter(jasmineInterface.jsApiReporter);
90 | env.addReporter(htmlReporter);
91 |
92 | /**
93 | * Filter which specs will be run by matching the start of the full name against the `spec` query param.
94 | */
95 | var specFilter = new jasmine.HtmlSpecFilter({
96 | filterString: function() { return queryString.getParam("spec"); }
97 | });
98 |
99 | config.specFilter = function(spec) {
100 | return specFilter.matches(spec.getFullName());
101 | };
102 |
103 | env.configure(config);
104 |
105 | /**
106 | * Setting up timing functions to be able to be overridden. Certain browsers (Safari, IE 8, phantomjs) require this hack.
107 | */
108 | window.setTimeout = window.setTimeout;
109 | window.setInterval = window.setInterval;
110 | window.clearTimeout = window.clearTimeout;
111 | window.clearInterval = window.clearInterval;
112 |
113 | /**
114 | * ## Execution
115 | *
116 | * Replace the browser window's `onload`, ensure it's called, and then run all of the loaded specs. This includes initializing the `HtmlReporter` instance and then executing the loaded Jasmine environment. All of this will happen after all of the specs are loaded.
117 | */
118 | var currentWindowOnload = window.onload;
119 |
120 | window.onload = function() {
121 | if (currentWindowOnload) {
122 | currentWindowOnload();
123 | }
124 | htmlReporter.initialize();
125 | env.execute();
126 | };
127 |
128 | /**
129 | * Helper function for readability above.
130 | */
131 | function extend(destination, source) {
132 | for (var property in source) destination[property] = source[property];
133 | return destination;
134 | }
135 |
136 | }());
137 |
--------------------------------------------------------------------------------
/packages/splitjs/test/lib/jasmine-3.5.0/jasmine.css:
--------------------------------------------------------------------------------
1 | @charset "UTF-8";
2 | body { overflow-y: scroll; }
3 |
4 | .jasmine_html-reporter { width: 100%; background-color: #eee; padding: 5px; margin: -8px; font-size: 11px; font-family: Monaco, "Lucida Console", monospace; line-height: 14px; color: #333; }
5 |
6 | .jasmine_html-reporter a { text-decoration: none; }
7 |
8 | .jasmine_html-reporter a:hover { text-decoration: underline; }
9 |
10 | .jasmine_html-reporter p, .jasmine_html-reporter h1, .jasmine_html-reporter h2, .jasmine_html-reporter h3, .jasmine_html-reporter h4, .jasmine_html-reporter h5, .jasmine_html-reporter h6 { margin: 0; line-height: 14px; }
11 |
12 | .jasmine_html-reporter .jasmine-banner, .jasmine_html-reporter .jasmine-symbol-summary, .jasmine_html-reporter .jasmine-summary, .jasmine_html-reporter .jasmine-result-message, .jasmine_html-reporter .jasmine-spec .jasmine-description, .jasmine_html-reporter .jasmine-spec-detail .jasmine-description, .jasmine_html-reporter .jasmine-alert .jasmine-bar, .jasmine_html-reporter .jasmine-stack-trace { padding-left: 9px; padding-right: 9px; }
13 |
14 | .jasmine_html-reporter .jasmine-banner { position: relative; }
15 |
16 | .jasmine_html-reporter .jasmine-banner .jasmine-title { background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFoAAAAZCAMAAACGusnyAAACdlBMVEX/////AP+AgICqVaqAQICZM5mAVYCSSZKAQICOOY6ATYCLRouAQICJO4mSSYCIRIiPQICHPIeOR4CGQ4aMQICGPYaLRoCFQ4WKQICPPYWJRYCOQoSJQICNPoSIRICMQoSHQICHRICKQoOHQICKPoOJO4OJQYOMQICMQ4CIQYKLQICIPoK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4zMiwxMDc1LjEgNjM3LjkzLDkyNS41NjYgNjA3LjQ2NSw5MDMuNDQ1IgogICAgICAgICAgICAgaW5rc2NhcGU6Y29ubmVjdG9yLWN1cnZhdHVyZT0iMCIKICAgICAgICAgICAgIGlkPSJwYXRoNTIiCiAgICAgICAgICAgICBzdHlsZT0iZmlsbDojOGE0MTgyO2ZpbGwtb3BhY2l0eToxO2ZpbGwtcnVsZTpub256ZXJvO3N0cm9rZTpub25lIiAvPjxwYXRoCiAgICAgICAgICAgICBkPSJtIDM4MC42ODgsNjIyLjEyOSAtMTEuNjI2LDM1LjgwMSAxNzUuNzU4LDU3LjA5IDExLjYyMSwtMzUuODAxIC0xNzUuNzUzLC01Ny4wOSIKICAgICAgICAgICAgIGlua3NjYXBlOmNvbm5lY3Rvci1jdXJ2YXR1cmU9IjAiCiAgICAgICAgICAgICBpZD0icGF0aDU0IgogICAgICAgICAgICAgc3R5bGU9ImZpbGw6IzhhNDE4MjtmaWxsLW9wYWNpdHk6MTtmaWxsLXJ1bGU6bm9uemVybztzdHJva2U6bm9uZSIgLz48cGF0aAogICAgICAgICAgICAgZD0ibSA3MTYuMjg5LDM3Ni41OSAzNy42NDA2LDAgMCwxODQuODE2IC0zNy42NDA2LDAgMCwtMTg0LjgxNiB6IgogICAgICAgICAgICAgaW5rc2NhcGU6Y29ubmVjdG9yLWN1cnZhdHVyZT0iMCIKICAgICAgICAgICAgIGlkPSJwYXRoNTYiCiAgICAgICAgICAgICBzdHlsZT0iZmlsbDojOGE0MTgyO2ZpbGwtb3BhY2l0eToxO2ZpbGwtcnVsZTpub256ZXJvO3N0cm9rZTpub25lIiAvPjwvZz48L2c+PC9nPjwvZz48L3N2Zz4=") no-repeat, none; -moz-background-size: 100%; -o-background-size: 100%; -webkit-background-size: 100%; background-size: 100%; display: block; float: left; width: 90px; height: 25px; }
17 |
18 | .jasmine_html-reporter .jasmine-banner .jasmine-version { margin-left: 14px; position: relative; top: 6px; }
19 |
20 | .jasmine_html-reporter #jasmine_content { position: fixed; right: 100%; }
21 |
22 | .jasmine_html-reporter .jasmine-version { color: #aaa; }
23 |
24 | .jasmine_html-reporter .jasmine-banner { margin-top: 14px; }
25 |
26 | .jasmine_html-reporter .jasmine-duration { color: #fff; float: right; line-height: 28px; padding-right: 9px; }
27 |
28 | .jasmine_html-reporter .jasmine-symbol-summary { overflow: hidden; margin: 14px 0; }
29 |
30 | .jasmine_html-reporter .jasmine-symbol-summary li { display: inline-block; height: 10px; width: 14px; font-size: 16px; }
31 |
32 | .jasmine_html-reporter .jasmine-symbol-summary li.jasmine-passed { font-size: 14px; }
33 |
34 | .jasmine_html-reporter .jasmine-symbol-summary li.jasmine-passed:before { color: #007069; content: "•"; }
35 |
36 | .jasmine_html-reporter .jasmine-symbol-summary li.jasmine-failed { line-height: 9px; }
37 |
38 | .jasmine_html-reporter .jasmine-symbol-summary li.jasmine-failed:before { color: #ca3a11; content: "×"; font-weight: bold; margin-left: -1px; }
39 |
40 | .jasmine_html-reporter .jasmine-symbol-summary li.jasmine-excluded { font-size: 14px; }
41 |
42 | .jasmine_html-reporter .jasmine-symbol-summary li.jasmine-excluded:before { color: #bababa; content: "•"; }
43 |
44 | .jasmine_html-reporter .jasmine-symbol-summary li.jasmine-excluded-no-display { font-size: 14px; display: none; }
45 |
46 | .jasmine_html-reporter .jasmine-symbol-summary li.jasmine-pending { line-height: 17px; }
47 |
48 | .jasmine_html-reporter .jasmine-symbol-summary li.jasmine-pending:before { color: #ba9d37; content: "*"; }
49 |
50 | .jasmine_html-reporter .jasmine-symbol-summary li.jasmine-empty { font-size: 14px; }
51 |
52 | .jasmine_html-reporter .jasmine-symbol-summary li.jasmine-empty:before { color: #ba9d37; content: "•"; }
53 |
54 | .jasmine_html-reporter .jasmine-run-options { float: right; margin-right: 5px; border: 1px solid #8a4182; color: #8a4182; position: relative; line-height: 20px; }
55 |
56 | .jasmine_html-reporter .jasmine-run-options .jasmine-trigger { cursor: pointer; padding: 8px 16px; }
57 |
58 | .jasmine_html-reporter .jasmine-run-options .jasmine-payload { position: absolute; display: none; right: -1px; border: 1px solid #8a4182; background-color: #eee; white-space: nowrap; padding: 4px 8px; }
59 |
60 | .jasmine_html-reporter .jasmine-run-options .jasmine-payload.jasmine-open { display: block; }
61 |
62 | .jasmine_html-reporter .jasmine-bar { line-height: 28px; font-size: 14px; display: block; color: #eee; }
63 |
64 | .jasmine_html-reporter .jasmine-bar.jasmine-failed, .jasmine_html-reporter .jasmine-bar.jasmine-errored { background-color: #ca3a11; border-bottom: 1px solid #eee; }
65 |
66 | .jasmine_html-reporter .jasmine-bar.jasmine-passed { background-color: #007069; }
67 |
68 | .jasmine_html-reporter .jasmine-bar.jasmine-incomplete { background-color: #bababa; }
69 |
70 | .jasmine_html-reporter .jasmine-bar.jasmine-skipped { background-color: #bababa; }
71 |
72 | .jasmine_html-reporter .jasmine-bar.jasmine-warning { background-color: #ba9d37; color: #333; }
73 |
74 | .jasmine_html-reporter .jasmine-bar.jasmine-menu { background-color: #fff; color: #aaa; }
75 |
76 | .jasmine_html-reporter .jasmine-bar.jasmine-menu a { color: #333; }
77 |
78 | .jasmine_html-reporter .jasmine-bar a { color: white; }
79 |
80 | .jasmine_html-reporter.jasmine-spec-list .jasmine-bar.jasmine-menu.jasmine-failure-list, .jasmine_html-reporter.jasmine-spec-list .jasmine-results .jasmine-failures { display: none; }
81 |
82 | .jasmine_html-reporter.jasmine-failure-list .jasmine-bar.jasmine-menu.jasmine-spec-list, .jasmine_html-reporter.jasmine-failure-list .jasmine-summary { display: none; }
83 |
84 | .jasmine_html-reporter .jasmine-results { margin-top: 14px; }
85 |
86 | .jasmine_html-reporter .jasmine-summary { margin-top: 14px; }
87 |
88 | .jasmine_html-reporter .jasmine-summary ul { list-style-type: none; margin-left: 14px; padding-top: 0; padding-left: 0; }
89 |
90 | .jasmine_html-reporter .jasmine-summary ul.jasmine-suite { margin-top: 7px; margin-bottom: 7px; }
91 |
92 | .jasmine_html-reporter .jasmine-summary li.jasmine-passed a { color: #007069; }
93 |
94 | .jasmine_html-reporter .jasmine-summary li.jasmine-failed a { color: #ca3a11; }
95 |
96 | .jasmine_html-reporter .jasmine-summary li.jasmine-empty a { color: #ba9d37; }
97 |
98 | .jasmine_html-reporter .jasmine-summary li.jasmine-pending a { color: #ba9d37; }
99 |
100 | .jasmine_html-reporter .jasmine-summary li.jasmine-excluded a { color: #bababa; }
101 |
102 | .jasmine_html-reporter .jasmine-specs li.jasmine-passed a:before { content: "• "; }
103 |
104 | .jasmine_html-reporter .jasmine-specs li.jasmine-failed a:before { content: "× "; }
105 |
106 | .jasmine_html-reporter .jasmine-specs li.jasmine-empty a:before { content: "* "; }
107 |
108 | .jasmine_html-reporter .jasmine-specs li.jasmine-pending a:before { content: "• "; }
109 |
110 | .jasmine_html-reporter .jasmine-specs li.jasmine-excluded a:before { content: "• "; }
111 |
112 | .jasmine_html-reporter .jasmine-description + .jasmine-suite { margin-top: 0; }
113 |
114 | .jasmine_html-reporter .jasmine-suite { margin-top: 14px; }
115 |
116 | .jasmine_html-reporter .jasmine-suite a { color: #333; }
117 |
118 | .jasmine_html-reporter .jasmine-failures .jasmine-spec-detail { margin-bottom: 28px; }
119 |
120 | .jasmine_html-reporter .jasmine-failures .jasmine-spec-detail .jasmine-description { background-color: #ca3a11; color: white; }
121 |
122 | .jasmine_html-reporter .jasmine-failures .jasmine-spec-detail .jasmine-description a { color: white; }
123 |
124 | .jasmine_html-reporter .jasmine-result-message { padding-top: 14px; color: #333; white-space: pre-wrap; }
125 |
126 | .jasmine_html-reporter .jasmine-result-message span.jasmine-result { display: block; }
127 |
128 | .jasmine_html-reporter .jasmine-stack-trace { margin: 5px 0 0 0; max-height: 224px; overflow: auto; line-height: 18px; color: #666; border: 1px solid #ddd; background: white; white-space: pre; }
129 |
--------------------------------------------------------------------------------
/packages/splitjs/test/lib/jasmine-3.5.0/jasmine_favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nathancahill/split/48759432a50510e2ed762109d5a8d12a3aac9e63/packages/splitjs/test/lib/jasmine-3.5.0/jasmine_favicon.png
--------------------------------------------------------------------------------
/packages/splitjs/test/split.spec.js:
--------------------------------------------------------------------------------
1 | /* eslint-env jasmine */
2 | /* global Split */
3 | /* eslint-disable no-var, func-names, prefer-arrow-callback, object-shorthand, prefer-template */
4 |
5 | function calcParts(expr) {
6 | var re = /calc\(([\d]*\.?[\d]*?)%\s?-\s?([\d]+)px\)/
7 | var m = re.exec(expr)
8 |
9 | return {
10 | percentage: parseFloat(m[1]),
11 | pixels: parseInt(m[2], 10),
12 | }
13 | }
14 |
15 | describe('Split', function() {
16 | beforeEach(function() {
17 | document.body.style.width = '800px'
18 | document.body.style.height = '600px'
19 |
20 | this.a = document.createElement('div')
21 | this.b = document.createElement('div')
22 | this.c = document.createElement('div')
23 |
24 | this.a.id = 'a'
25 | this.b.id = 'b'
26 | this.c.id = 'c'
27 |
28 | document.body.appendChild(this.a)
29 | document.body.appendChild(this.b)
30 | document.body.appendChild(this.c)
31 | })
32 |
33 | afterEach(function() {
34 | document.body.removeChild(this.a)
35 | document.body.removeChild(this.b)
36 | document.body.removeChild(this.c)
37 | })
38 |
39 | it('splits in two when given two elements', function() {
40 | Split(['#a', '#b'])
41 |
42 | expect(this.a.style.width).toContain('calc(50% - 5px)')
43 | expect(this.b.style.width).toContain('calc(50% - 5px)')
44 | })
45 |
46 | it('splits in three when given three elements', function() {
47 | Split(['#a', '#b', '#c'])
48 |
49 | expect(calcParts(this.a.style.width).percentage).toBeCloseTo(33.33)
50 | expect(calcParts(this.b.style.width).percentage).toBeCloseTo(33.33)
51 | expect(calcParts(this.c.style.width).percentage).toBeCloseTo(33.33)
52 |
53 | expect(calcParts(this.a.style.width).pixels).toBe(5)
54 | expect(calcParts(this.b.style.width).pixels).toBe(10)
55 | expect(calcParts(this.c.style.width).pixels).toBe(5)
56 | })
57 |
58 | it('splits vertically when direction is vertical', function() {
59 | Split(['#a', '#b'], {
60 | direction: 'vertical',
61 | })
62 |
63 | expect(this.a.style.height).toContain('calc(50% - 5px)')
64 | expect(this.b.style.height).toContain('calc(50% - 5px)')
65 | })
66 |
67 | it('splits in percentages when given sizes', function() {
68 | Split(['#a', '#b'], {
69 | sizes: [25, 75],
70 | })
71 |
72 | expect(this.a.style.width).toContain('calc(25% - 5px)')
73 | expect(this.b.style.width).toContain('calc(75% - 5px)')
74 | })
75 |
76 | it('splits in percentages when given sizes', function() {
77 | Split(['#a', '#b'], {
78 | sizes: [25, 75],
79 | })
80 |
81 | expect(this.a.style.width).toContain('calc(25% - 5px)')
82 | expect(this.b.style.width).toContain('calc(75% - 5px)')
83 | })
84 |
85 | it('accounts for gutter size', function() {
86 | Split(['#a', '#b'], {
87 | gutterSize: 20,
88 | })
89 |
90 | expect(this.a.style.width).toContain('calc(50% - 10px)')
91 | expect(this.b.style.width).toContain('calc(50% - 10px)')
92 | })
93 |
94 | it('accounts for gutter size with more than two elements', function() {
95 | Split(['#a', '#b', '#c'], {
96 | gutterSize: 20,
97 | })
98 |
99 | expect(calcParts(this.a.style.width).percentage).toBeCloseTo(33.33)
100 | expect(calcParts(this.b.style.width).percentage).toBeCloseTo(33.33)
101 | expect(calcParts(this.c.style.width).percentage).toBeCloseTo(33.33)
102 |
103 | expect(calcParts(this.a.style.width).pixels).toBe(10)
104 | expect(calcParts(this.b.style.width).pixels).toBe(20)
105 | expect(calcParts(this.c.style.width).pixels).toBe(10)
106 | })
107 |
108 | it('accounts for gutter size when direction is vertical', function() {
109 | Split(['#a', '#b'], {
110 | direction: 'vertical',
111 | gutterSize: 20,
112 | })
113 |
114 | expect(this.a.style.height).toContain('calc(50% - 10px)')
115 | expect(this.b.style.height).toContain('calc(50% - 10px)')
116 | })
117 |
118 | it('accounts for gutter size with more than two elements when direction is vertical', function() {
119 | Split(['#a', '#b', '#c'], {
120 | direction: 'vertical',
121 | gutterSize: 20,
122 | })
123 |
124 | expect(calcParts(this.a.style.height).percentage).toBeCloseTo(33.33)
125 | expect(calcParts(this.b.style.height).percentage).toBeCloseTo(33.33)
126 | expect(calcParts(this.c.style.height).percentage).toBeCloseTo(33.33)
127 |
128 | expect(calcParts(this.a.style.height).pixels).toBe(10)
129 | expect(calcParts(this.b.style.height).pixels).toBe(20)
130 | expect(calcParts(this.c.style.height).pixels).toBe(10)
131 | })
132 |
133 | it('set size directly when given css values', function() {
134 | Split(['#a', '#b'], {
135 | sizes: ['150px', '640px'],
136 | })
137 |
138 | expect(this.a.style.width).toBe('150px')
139 | expect(this.b.style.width).toBe('640px')
140 | })
141 |
142 | it('adjusts sizes using setSizes', function() {
143 | var split = Split(['#a', '#b'])
144 |
145 | split.setSizes([70, 30])
146 |
147 | expect(this.a.style.width).toContain('calc(70% - 5px)')
148 | expect(this.b.style.width).toContain('calc(30% - 5px)')
149 | })
150 |
151 | it('collapse splits', function() {
152 | var split = Split(['#a', '#b'])
153 |
154 | split.collapse(0)
155 |
156 | expect(this.a.getBoundingClientRect().width).toBeCloseTo(100, 0)
157 | expect(this.b.getBoundingClientRect().width).toBeCloseTo(800 - 100 - 10, 0)
158 |
159 | split.collapse(1)
160 |
161 | expect(this.a.getBoundingClientRect().width).toBeCloseTo(800 - 100 - 10, 0)
162 | expect(this.b.getBoundingClientRect().width).toBeCloseTo(100, 0)
163 | })
164 |
165 | it('returns sizes', function() {
166 | var split = Split(['#a', '#b'])
167 | var sizes = split.getSizes()
168 |
169 | expect(sizes).toEqual([50, 50])
170 |
171 | split.setSizes([70, 30])
172 |
173 | sizes = split.getSizes()
174 |
175 | expect(sizes).toEqual([70, 30])
176 | })
177 |
178 | it('sets element styles using the elementStyle function', function() {
179 | Split(['#a', '#b'], {
180 | elementStyle: function(dimension, size) {
181 | return {
182 | width: size + '%',
183 | }
184 | },
185 | })
186 |
187 | expect(this.a.style.width).toBe('50%')
188 | expect(this.b.style.width).toBe('50%')
189 | })
190 | })
191 |
--------------------------------------------------------------------------------
/prettier.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | trailingComma: 'all',
3 | tabWidth: 4,
4 | semi: false,
5 | singleQuote: true,
6 | arrowParens: 'avoid',
7 | }
8 |
--------------------------------------------------------------------------------