@symbo.ls/uikit 3.7.3 → 3.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,36 @@
1
+ 'use strict'
2
+
3
+ export const Toggle = {
4
+ extends: 'Checkbox',
5
+
6
+ Input: {
7
+ ':checked + div': {
8
+ background: 'green2+8',
9
+ justifyContent: 'flex-end'
10
+ }
11
+ },
12
+
13
+ Flex: {
14
+ boxSize: 'A1 B1',
15
+ padding: '- W_default',
16
+ round: 'D',
17
+ align: 'center flex-start',
18
+ theme: 'field',
19
+ border: 'none',
20
+ transition: 'opacity .15s ease',
21
+ ':after': {
22
+ content: '""',
23
+ boxSize: 'A A',
24
+ round: '100%',
25
+ background: 'white',
26
+ boxShadow: 'gray.2 1px 1px Z'
27
+ },
28
+ Icon: null
29
+ }
30
+ }
31
+
32
+ export const ToggleHgroup = {
33
+ extends: 'CheckboxHgroup',
34
+ Checkbox: null,
35
+ Toggle: {}
36
+ }
package/Link.js ADDED
@@ -0,0 +1,97 @@
1
+ 'use strict'
2
+
3
+ import { router as defaultRouter } from '@domql/router'
4
+ import { resolvePropValue } from 'attrs-in-props'
5
+
6
+ export const Link = {
7
+ extends: 'Focusable',
8
+ tag: 'a',
9
+
10
+ aria: {},
11
+ fontWeight: 'bold',
12
+ textDecoration: 'none',
13
+ color: 'currentColor',
14
+ draggable: false,
15
+
16
+ attr: {
17
+ href: (el) => {
18
+ const props = el.props
19
+ return resolvePropValue(el, props.href) ||
20
+ resolvePropValue(el, el.call('exec', props, el).href)
21
+ },
22
+ 'aria-label': ({ props }) => (props.aria ? props.aria.label : props.text)
23
+ }
24
+ }
25
+
26
+ export const A = {
27
+ extends: 'Link'
28
+ }
29
+
30
+ export const RouterLink = {
31
+ onClick: (event, el, s) => {
32
+ const { props, context: ctx } = el
33
+ const { href: h, scrollToTop, stopPropagation } = props
34
+ let href = el.call('exec', h, el)
35
+
36
+ if (el.call('isString', href) && href.includes('{{')) {
37
+ href = el.call('replaceLiteralsWithObjectFields', href)
38
+ }
39
+
40
+ if (stopPropagation) event.stopPropagation()
41
+ if (!href) return
42
+ const { utils, snippets, functions, routerOptions } = ctx
43
+ const root = el.__ref.root
44
+ const linkIsExternal =
45
+ href.startsWith('http://') ||
46
+ href.startsWith('https://') ||
47
+ href.startsWith('mailto:') ||
48
+ href.startsWith('tel:') ||
49
+ href.startsWith('sketch:') ||
50
+ href.startsWith('whatsapp:') ||
51
+ href.startsWith('sms:') ||
52
+ href.startsWith('skype:') ||
53
+ href.startsWith('viber:') ||
54
+ href.startsWith('callto:') ||
55
+ href.startsWith('facetime:') ||
56
+ href.startsWith('facetime-audio:') ||
57
+ href.startsWith('geo:') ||
58
+ href.startsWith('maps:')
59
+ if (href && !linkIsExternal) {
60
+ event.preventDefault()
61
+ try {
62
+ let targetEl = root
63
+ if (routerOptions && routerOptions.customRouterElement) {
64
+ const parts = Array.isArray(routerOptions.customRouterElement)
65
+ ? routerOptions.customRouterElement
66
+ : routerOptions.customRouterElement.split('.')
67
+ let resolved = root
68
+ for (const part of parts) {
69
+ if (!resolved || !resolved[part]) { resolved = null; break }
70
+ resolved = resolved[part]
71
+ }
72
+ if (resolved) {
73
+ targetEl = resolved
74
+ if (root.routes) targetEl.routes = root.routes
75
+ }
76
+ }
77
+ ;(functions.router || snippets.router || utils.router || defaultRouter)(
78
+ href,
79
+ targetEl,
80
+ {},
81
+ {
82
+ scrollToOptions: { behaviour: 'instant' },
83
+ scrollToTop: el.call('isDefined', scrollToTop) ? scrollToTop : true,
84
+ ...routerOptions,
85
+ ...props.routerOptions
86
+ }
87
+ )
88
+ } catch (e) {
89
+ console.warn(e)
90
+ }
91
+ }
92
+ }
93
+ }
94
+
95
+ export const RouteLink = {
96
+ extends: [Link, RouterLink]
97
+ }
@@ -0,0 +1,43 @@
1
+ 'use strict'
2
+
3
+ export const Notification = {
4
+ display: 'flex',
5
+ theme: 'alert',
6
+ padding: 'Z1 B Z A',
7
+ round: 'A A A Y2',
8
+ gap: 'X2',
9
+ cursor: 'pointer',
10
+ align: 'flex-start center',
11
+
12
+ IconText: {
13
+ Icon: {
14
+ name: 'info outline'
15
+ },
16
+ Text: {
17
+ ':empty': { hide: true }
18
+ }
19
+ },
20
+
21
+ Hgroup: {
22
+ extends: ['Flex', 'Hgroup'],
23
+ flow: 'y',
24
+ align: 'flex-start',
25
+ gap: 'X2',
26
+
27
+ H: {
28
+ tag: 'h6',
29
+ margin: '0',
30
+ fontWeight: '600',
31
+ lineHeight: '1em',
32
+ text: 'Notification',
33
+ ':empty': { hide: true }
34
+ },
35
+
36
+ P: {
37
+ fontSize: 'Z',
38
+ margin: '0',
39
+ text: 'is not always a distraction',
40
+ ':empty': { hide: true }
41
+ }
42
+ }
43
+ }
package/Range.js ADDED
@@ -0,0 +1,108 @@
1
+ 'use strict'
2
+
3
+ import { opacify } from '@symbo.ls/scratch'
4
+
5
+ export const Range = {
6
+ tag: 'input',
7
+
8
+ appearance: 'none',
9
+ width: '100%',
10
+ height: '2px',
11
+ outline: 'none',
12
+ flex: 1,
13
+
14
+ onInput: (ev, el, s) => {
15
+ const props = el.props
16
+ if (el.call('isFunction', props.onInput)) {
17
+ props.onInput(ev, el, s)
18
+ } else {
19
+ s.update({ value: parseFloat(el.node.value) })
20
+ }
21
+ },
22
+ onChange: (ev, el, s) => {
23
+ const props = el.props
24
+ if (el.call('isFunction', props.onChange)) {
25
+ props.onChange(ev, el, s)
26
+ } else {
27
+ s.update({ value: parseFloat(el.node.value) })
28
+ }
29
+ },
30
+
31
+ '::-webkit-slider-thumb': {
32
+ boxSizing: 'content-box',
33
+ width: '8px',
34
+ height: '8px',
35
+ borderWidth: '2px',
36
+ borderStyle: 'solid',
37
+ borderRadius: '100%',
38
+ opacity: '.8',
39
+ appearance: 'none'
40
+ },
41
+
42
+ '::-webkit-slider-runnable-track': {},
43
+
44
+ '@dark': {
45
+ background: 'white.2',
46
+
47
+ '::-webkit-slider-thumb': {
48
+ background: '#232526',
49
+ borderColor: opacify('#454646', 0.75)
50
+ },
51
+
52
+ ':hover': {
53
+ '::-webkit-slider-thumb': {
54
+ borderColor: opacify('#fff', 0.35)
55
+ }
56
+ },
57
+
58
+ ':focus': {
59
+ '::-webkit-slider-thumb': {
60
+ borderColor: '#3C6AC0'
61
+ }
62
+ }
63
+ },
64
+
65
+ '@light': {
66
+ background: 'gray9',
67
+
68
+ '::-webkit-slider-thumb': {
69
+ background: 'white',
70
+ borderColor: 'gray9'
71
+ },
72
+
73
+ ':hover': {
74
+ '::-webkit-slider-thumb': {
75
+ borderColor: 'gray7'
76
+ }
77
+ },
78
+
79
+ ':focus': {
80
+ '::-webkit-slider-thumb': {
81
+ borderColor: 'blue'
82
+ }
83
+ }
84
+ },
85
+
86
+ deps: {
87
+ returnPropertyValue: (el, property, def) => {
88
+ const val = el.props && el.call('exec', el.props[property], el)
89
+ const r = el.call('isFunction', val)
90
+ ? val(el, el.state)
91
+ : val !== undefined
92
+ ? val
93
+ : def !== undefined
94
+ ? def
95
+ : 0
96
+ return r + ''
97
+ }
98
+ },
99
+
100
+ attr: {
101
+ type: 'range',
102
+ value: (el, s) =>
103
+ el.call('exec', s.value || el.props.value || el.props.defaultValue, el),
104
+ min: (el, s) => el.deps.returnPropertyValue(el, 'min', 0),
105
+ max: (el, s) => el.deps.returnPropertyValue(el, 'max', 100),
106
+ step: (el, s) => el.deps.returnPropertyValue(el, 'step', 1)
107
+ }
108
+ }
package/Select.js ADDED
@@ -0,0 +1,33 @@
1
+ 'use strict'
2
+
3
+ export const Select = {
4
+ extends: 'Focusable',
5
+ tag: 'select',
6
+
7
+ fontSize: 'A',
8
+ border: 'none',
9
+ boxSizing: 'border-box',
10
+ theme: 'field',
11
+ cursor: 'pointer',
12
+ childProps: {
13
+ tag: 'option',
14
+ attr: {
15
+ value: ({ props }) => props.value,
16
+ selected: ({ props }) => props.selected,
17
+ disabled: ({ props }) => props.disabled
18
+ }
19
+ },
20
+
21
+ attr: {
22
+ name: ({ props }) => props.name,
23
+ disabled: ({ props }) => props.disabled,
24
+ value: el => {
25
+ if (!el.props || !el.props.value) return
26
+ const val = el.call('exec', el.props.value, el)
27
+ if (el.call('isString', val) && val.includes('{{')) {
28
+ return el.call('replaceLiteralsWithObjectFields', val)
29
+ }
30
+ return val
31
+ }
32
+ }
33
+ }
@@ -0,0 +1,128 @@
1
+ 'use strict'
2
+
3
+ import { isDefined } from '@domql/utils'
4
+
5
+ export const Tooltip = {
6
+ display: 'flex',
7
+
8
+ theme: 'dialog',
9
+ background: 'black',
10
+ flow: 'column',
11
+ shape: 'tooltip',
12
+ shapeDirection: 'left',
13
+ padding: 'Z1 A',
14
+ round: 'Y2',
15
+ width: 'fit-content',
16
+ minWidth: 'D2',
17
+ maxWidth: 'F2',
18
+ gap: 'X',
19
+ textAlign: 'center',
20
+ attr: { tooltip: true },
21
+
22
+ Title: {
23
+ if: ({ parent, props }) => isDefined(parent.props.title) || props.text,
24
+ width: 'fit-content',
25
+ fontWeight: 500,
26
+ color: 'gray12',
27
+ text: ({ parent }) => parent.props.title
28
+ },
29
+
30
+ P: {
31
+ if: (el, s) =>
32
+ el.call('isDefined', el.call('exec', el.parent.props.description, el)) ||
33
+ el.props.text,
34
+ width: 'fit-content',
35
+ fontSize: 'Z2',
36
+ margin: '0',
37
+ color: 'gray6',
38
+ fontWeight: '400',
39
+ text: (el, s) => el.call('exec', el.parent.props.description, el)
40
+ }
41
+ }
42
+
43
+ export const TooltipHidden = {
44
+ extends: 'Tooltip',
45
+
46
+ position: 'absolute',
47
+ pointerEvents: 'none',
48
+ opacity: '0',
49
+ visibility: 'hidden',
50
+ transition:
51
+ 'C defaultBezier opacity, C defaultBezier visibility, B defaultBezier transform',
52
+
53
+ props: ({ props }) => ({
54
+ ...(!props.shapeDirection || props.shapeDirection === 'top'
55
+ ? {
56
+ top: '112%',
57
+ left: '50%',
58
+ transform: 'translate3d(-50%,10%,0)',
59
+
60
+ '.isActive': {
61
+ transform: 'translate3d(-50%,0,0)',
62
+ opacity: 1,
63
+ visibility: 'visible'
64
+ }
65
+ }
66
+ : props.shapeDirection === 'right'
67
+ ? {
68
+ transform: 'translate3d(10%,-50%,0)',
69
+ left: '112%',
70
+ top: '50%',
71
+
72
+ '.isActive': {
73
+ transform: 'translate3d(0%,-50%,0)',
74
+ opacity: 1,
75
+ visibility: 'visible'
76
+ }
77
+ }
78
+ : ({ props }) =>
79
+ props.shapeDirection === 'bottom'
80
+ ? {
81
+ transform: 'translate3d(-50%,-10%,0)',
82
+ bottom: '112%',
83
+ left: '50%',
84
+
85
+ '.isActive': {
86
+ transform: 'translate3d(-50%,0,0)',
87
+ opacity: 1,
88
+ visibility: 'visible'
89
+ }
90
+ }
91
+ : props.shapeDirection === 'left'
92
+ ? {
93
+ transform: 'translate3d(10%,-50%,0)',
94
+ right: '112%',
95
+ top: '50%',
96
+
97
+ '.isActive': {
98
+ transform: 'translate3d(0%,-50%,0)',
99
+ opacity: 1,
100
+ visibility: 'visible'
101
+ }
102
+ }
103
+ : {})
104
+ })
105
+ }
106
+
107
+ export const TooltipParent = {
108
+ position: 'relative',
109
+ zIndex: 999,
110
+
111
+ props: el => {
112
+ const { Tooltip, TooltipHidden } = el
113
+ const TooltipElem = Tooltip || TooltipHidden
114
+ if (!TooltipElem) return
115
+ const TooltipActive =
116
+ TooltipElem && TooltipElem.props && TooltipElem.props['.isActive']
117
+ return {
118
+ ':hover, &:focus-visible': {
119
+ zIndex: 1000,
120
+ '& [tooltip]': TooltipActive || {
121
+ transform: 'translate3d(-50%, 0, 0)',
122
+ opacity: 1,
123
+ visibility: 'visible'
124
+ }
125
+ }
126
+ }
127
+ }
128
+ }
@@ -0,0 +1,12 @@
1
+ 'use strict'
2
+
3
+ export default {
4
+ textAlign: 'center',
5
+ padding: '1.2em',
6
+ caption: {
7
+ whiteSpace: 'nowrap'
8
+ },
9
+ span: {
10
+ opacity: '.5'
11
+ }
12
+ }
package/index.js CHANGED
@@ -1,14 +1,35 @@
1
1
  'use strict'
2
2
 
3
- export * from '@symbo.ls/atoms'
4
- export * from '@symbo.ls/icon'
5
- export * from '@symbo.ls/link'
6
- export * from '@symbo.ls/input'
7
- export * from '@symbo.ls/select'
8
- export * from '@symbo.ls/button'
9
- export * from '@symbo.ls/dialog'
10
- export * from '@symbo.ls/tooltip'
11
- export * from '@symbo.ls/avatar'
12
- export * from '@symbo.ls/range'
13
- export * from '@symbo.ls/dropdown'
14
- export * from '@symbo.ls/notification'
3
+ // Atoms
4
+ export * from './Atoms/Block.js'
5
+ export * from './Atoms/Img.js'
6
+ export * from './Atoms/Form.js'
7
+ export * from './Atoms/Iframe.js'
8
+ export * from './Atoms/InteractiveComponent.js'
9
+ export * from './Atoms/Picture.js'
10
+ export * from './Atoms/Svg.js'
11
+ export * from './Atoms/Shape.js'
12
+ export * from './Atoms/Video.js'
13
+ export * from './Atoms/Theme.js'
14
+ export * from './Atoms/Text.js'
15
+ export * from './Atoms/Box.js'
16
+ export * from './Atoms/Hgroup.js'
17
+
18
+ // Input
19
+ export * from './Input/Input.js'
20
+ export * from './Input/NumberInput.js'
21
+ export * from './Input/Checkbox.js'
22
+ export * from './Input/Radio.js'
23
+ export * from './Input/Toggle.js'
24
+ export * from './Input/Textarea.js'
25
+
26
+ export * from './Icon/index.js'
27
+ export * from './Link.js'
28
+ export * from './Select.js'
29
+ export * from './Button.js'
30
+ export * from './Dialog.js'
31
+ export * from './Tooltip/index.js'
32
+ export * from './Avatar.js'
33
+ export * from './Range.js'
34
+ export * from './Dropdown.js'
35
+ export * from './Notification.js'
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@symbo.ls/uikit",
3
3
  "description": "UI Library built on Scratch and DOMQL",
4
- "version": "3.7.3",
4
+ "version": "3.7.4",
5
5
  "author": "symbo.ls",
6
6
  "repository": "https://github.com/symbo-ls/smbls",
7
7
  "main": "index.js",
@@ -12,25 +12,22 @@
12
12
  },
13
13
  "files": [
14
14
  "*.js",
15
+ "Atoms",
16
+ "Datepicker",
17
+ "Icon",
18
+ "Input",
19
+ "TimePicker",
20
+ "Tooltip",
15
21
  "dist"
16
22
  ],
17
23
  "dependencies": {
18
- "attrs-in-props": "^3.7.3",
19
- "css-in-props": "^3.7.3",
20
- "@domql/utils": "^3.7.3",
21
- "@symbo.ls/atoms": "^3.7.3",
22
- "@symbo.ls/avatar": "^3.7.3",
23
- "@symbo.ls/button": "^3.7.3",
24
- "@symbo.ls/dialog": "^3.7.3",
25
- "@symbo.ls/dropdown": "^3.7.3",
26
- "@symbo.ls/icon": "^3.7.3",
27
- "@symbo.ls/input": "^3.7.3",
28
- "@symbo.ls/link": "^3.7.3",
29
- "@symbo.ls/notification": "^3.7.3",
30
- "@symbo.ls/range": "^3.7.3",
31
- "@symbo.ls/scratch": "^3.7.3",
32
- "@symbo.ls/select": "^3.7.3",
33
- "@symbo.ls/tooltip": "^3.7.3"
24
+ "@domql/router": "^3.7.4",
25
+ "@domql/state": "^3.7.4",
26
+ "@domql/utils": "^3.7.4",
27
+ "@symbo.ls/scratch": "^3.7.4",
28
+ "@symbo.ls/smbls-utils": "^3.7.4",
29
+ "attrs-in-props": "^3.7.4",
30
+ "css-in-props": "^3.7.4"
34
31
  },
35
32
  "scripts": {
36
33
  "prepublish": "rm -rf dist && npx esbuild index.js --target=es2017 --format=cjs --sourcemap=external --outfile=dist/index.cjs.js"
package/LICENSE DELETED
@@ -1,34 +0,0 @@
1
- Creative Commons Attribution-NonCommercial 4.0 International License
2
-
3
- Copyright (c) 2023 symbo.ls
4
-
5
- This work is licensed under the Creative Commons Attribution-NonCommercial
6
- 4.0 International License. To view a copy of this license, visit
7
- https://creativecommons.org/licenses/by-nc/4.0/ or send a letter to
8
- Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
9
-
10
- You are free to:
11
-
12
- Share — copy and redistribute the material in any medium or format
13
- Adapt — remix, transform, and build upon the material
14
-
15
- Under the following terms:
16
-
17
- Attribution — You must give appropriate credit, provide a link to the
18
- license, and indicate if changes were made. You may do so in any
19
- reasonable manner, but not in any way that suggests the licensor endorses
20
- you or your use.
21
-
22
- NonCommercial — You may not use the material for commercial purposes.
23
-
24
- No additional restrictions — You may not apply legal terms or
25
- technological measures that legally restrict others from doing anything
26
- the license permits.
27
-
28
- THE WORK IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
29
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
30
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
31
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
32
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
33
- OUT OF OR IN CONNECTION WITH THE WORK OR THE USE OR OTHER DEALINGS IN THE
34
- WORK.