@shortfuse/materialdesignweb 0.7.1-3 → 0.7.1-5

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.
@@ -38,9 +38,8 @@ export default function ShapeMixin(Base) {
38
38
  --mdw-shape__size__bottom-left-size: calc((var(--mdw-shape__ltr) * var(--mdw-shape__size__bottom-start-size)) + (var(--mdw-shape__rtl) * var(--mdw-shape__size__bottom-end-size)));
39
39
  --mdw-shape__size__bottom-right-size: calc((var(--mdw-shape__rtl) * var(--mdw-shape__size__bottom-start-size)) + (var(--mdw-shape__ltr) * var(--mdw-shape__size__bottom-end-size)));
40
40
 
41
+ /** By default, fallback to border-radius */
41
42
  --mdw-shape__rounded: 1;
42
- --mdw-shape__mask-border-source: none;
43
- --mdw-shape__mask: none;
44
43
  --mdw-shape__inline-start-deg: calc(var(--mdw-dir, 1) * -90deg);
45
44
  z-index: 0;
46
45
  }
@@ -104,15 +103,8 @@ export default function ShapeMixin(Base) {
104
103
 
105
104
  @supports(-webkit-mask-box-image: none) {
106
105
  :host {
106
+ /* Inherit all the way up to :root */
107
107
  --mdw-shape__rounded: inherit;
108
- --mdw-shape__mask-border-source: inherit;
109
-
110
- -webkit-mask-box-image: var(--mdw-shape__mask-border-source)
111
- 8 fill /
112
- var(--mdw-shape__size)
113
- stretch;
114
-
115
- -webkit-mask: var(--mdw-shape__mask);
116
108
  }
117
109
  }
118
110
  `
@@ -154,6 +146,13 @@ export default function ShapeMixin(Base) {
154
146
 
155
147
  @supports(-webkit-mask-box-image: none) {
156
148
  .shape {
149
+ -webkit-mask-box-image: var(--mdw-shape__mask-border-source)
150
+ 8 fill /
151
+ var(--mdw-shape__size)
152
+ stretch;
153
+
154
+ -webkit-mask: var(--mdw-shape__mask);
155
+
157
156
  transition-duration: 200ms, 200ms, 200ms;
158
157
  transition-property: background-color, color, -webkit-mask-box-image-width;
159
158
  will-change: background-color, color, -webkit-mask-box-image;
@@ -49,6 +49,9 @@ export default function TextFieldMixin(Base) {
49
49
  populatedState({ value, _badInput }) {
50
50
  return !!value || _badInput;
51
51
  },
52
+ _showLabelText({ label, filled, outlined }) {
53
+ return label && (filled || outlined);
54
+ },
52
55
  })
53
56
  .on({
54
57
  composed({ template, html, inline }) {
@@ -72,15 +75,17 @@ export default function TextFieldMixin(Base) {
72
75
  labelElement.setAttribute('focused', '{focusedState}');
73
76
  labelElement.setAttribute('label', '{label}');
74
77
  labelElement.setAttribute('shape-top', inline(({ shapeTop, filled }) => shapeTop || filled));
75
- labelElement.append(html`
76
- ${state}
77
- ${outline}
78
- <mdw-icon _if={icon} id=icon aria-hidden=true disabled={disabledState}>{icon}</mdw-icon>
79
- <span _if={inputPrefix} class=inline id=prefix aria-hidden=true focused={focusedState} populated={populatedState}>{inputPrefix}</span>
80
- <span _if={inputSuffix} class=inline id=suffix aria-hidden=true focused={focusedState} populated={populatedState}>{inputSuffix}</span>
81
- <mdw-icon _if={trailingIcon} id=trailing-icon ink={trailingIconInk} aria-hidden=true disabled={disabledState}>{trailingIcon}</mdw-icon>
82
- <div id=indicator _if={filled} focused={focusedState} hovered={hoveredState} errored={erroredState} disabled={disabledState} ></div>
83
- `);
78
+ labelElement.append(
79
+ state,
80
+ outline,
81
+ html`
82
+ <mdw-icon _if={icon} id=icon aria-hidden=true disabled={disabledState}>{icon}</mdw-icon>
83
+ <span _if={inputPrefix} class=inline id=prefix aria-hidden=true focused={focusedState} populated={populatedState}>{inputPrefix}</span>
84
+ <span _if={inputSuffix} class=inline id=suffix aria-hidden=true focused={focusedState} populated={populatedState}>{inputSuffix}</span>
85
+ <mdw-icon _if={trailingIcon} id=trailing-icon ink={trailingIconInk} aria-hidden=true disabled={disabledState}>{trailingIcon}</mdw-icon>
86
+ <div id=indicator _if={filled} focused={focusedState} hovered={hoveredState} errored={erroredState} disabled={disabledState} ></div>
87
+ `,
88
+ );
84
89
 
85
90
  outline.setAttribute('invalid', '{invalid}');
86
91
  outline.setAttribute('errored', '{erroredState}');
@@ -98,7 +103,7 @@ export default function TextFieldMixin(Base) {
98
103
  state.setAttribute('_if', '{!outlined}');
99
104
 
100
105
  template.append(html`
101
- <div id=label-text _if=${({ label, filled, outlined }) => label && (filled || outlined)} aria-hidden=true
106
+ <div id=label-text _if={_showLabelText} aria-hidden=true
102
107
  outlined={outlined}
103
108
  populated={populatedState}
104
109
  focused={focusedState}
@@ -240,6 +245,12 @@ export default function TextFieldMixin(Base) {
240
245
  transition: none 100ms cubic-bezier(0.4, 0.0, 1, 1);
241
246
  }
242
247
 
248
+ #label[shape-top] {
249
+ --mdw-shape__size__bottom-start-size: 0px;
250
+ --mdw-shape__size__bottom-end-size: 0px;
251
+ --mdw-shape__mask: linear-gradient(transparent 50%, black 50%);
252
+ }
253
+
243
254
  #prefix,
244
255
  #suffix,
245
256
  #control::placeholder {
@@ -1,4 +1,4 @@
1
- import Tooltip from '../components/Tooltip.js';
1
+ import '../components/Tooltip.js';
2
2
  import { canAnchorPopup } from '../utils/popup.js';
3
3
 
4
4
  /**
@@ -10,10 +10,9 @@ export default function TooltipTriggerMixin(Base) {
10
10
  this.on({
11
11
  composed({ template, html }) {
12
12
  template.append(html`
13
- <${Tooltip.elementName} role=tooltip id=tooltip
14
- ><slot id=tooltip-slot
15
- on-slotchange={onTooltipTriggerSlotChange} name=tooltip
16
- >{tooltip}</slot></${Tooltip.elementName}>
13
+ <mdw-tooltip role=tooltip id=tooltip>
14
+ <slot id=tooltip-slot on-slotchange={onTooltipTriggerSlotChange} name=tooltip>{tooltip}</slot>
15
+ </mdw-tooltip>
17
16
  `);
18
17
  },
19
18
  });
package/package.json CHANGED
@@ -1,18 +1,19 @@
1
1
  {
2
2
  "name": "@shortfuse/materialdesignweb",
3
- "version": "0.7.1-3",
3
+ "version": "0.7.1-5",
4
4
  "description": "Material Design for Web",
5
5
  "type": "module",
6
6
  "scripts": {
7
- "prebuild": "node bin/generate-css.js --custom=yellow,orange:orange,green:0f0,alias:aqua | npx esbuild --minify --loader=css > docs/theme.css",
8
- "prebuild-alt": "node bin/generate-css.js --color=a46750 --custom=yellow,orange:orange,green:0f0,alias:aqua | npx esbuild --minify --loader=css > docs/alt-theme.css",
9
- "build": "node build/esbuild.js --minify --metafile",
10
- "watch": "node build/esbuild.js --watch --metafile",
11
- "serve": "node build/esbuild.js --watch --metafile --serve --live",
7
+ "build": "node build/esbuild.js index.js --outdir=dist --minify --metafile",
8
+ "predocs": "node bin/generate-css.js --custom=yellow,orange:orange,green:0f0,alias:aqua | npx esbuild --minify --loader=css > docs/theme.css",
9
+ "predocs-alt": "node bin/generate-css.js --color=a46750 --custom=yellow,orange:orange,green:0f0,alias:aqua | npx esbuild --minify --loader=css > docs/alt-theme.css",
10
+ "docs": "node build/esbuild.js docs/demo.js --outdir=docs --minify --metafile",
11
+ "watch": "node build/esbuild.js docs/demo.js --outdir=docs --watch --metafile",
12
+ "serve": "node build/esbuild.js docs/demo.js --outdir=docs --watch --metafile --serve --live",
12
13
  "pretest": "eslint --ignore-path .gitignore",
13
14
  "test": "c8 tap --no-coverage"
14
15
  },
15
- "browser": "index.js",
16
+ "browser": "dist/index.min.js",
16
17
  "repository": {
17
18
  "type": "git",
18
19
  "url": "git+https://github.com/clshortfuse/materialdesignweb.git"
@@ -27,6 +28,7 @@
27
28
  ],
28
29
  "files": [
29
30
  "/bin",
31
+ "/dist",
30
32
  "/components",
31
33
  "/core",
32
34
  "/theming",
@@ -54,14 +56,16 @@
54
56
  },
55
57
  "homepage": "https://github.com/clshortfuse/materialdesignweb#readme",
56
58
  "devDependencies": {
59
+ "@types/html-minifier-terser": "^7.0.0",
57
60
  "@types/tap": "^15.0.7",
58
61
  "@typescript-eslint/eslint-plugin": "^5.30.7",
59
62
  "@typescript-eslint/parser": "^5.30.7",
63
+ "acorn": "^8.8.2",
64
+ "acorn-walk": "^8.2.0",
60
65
  "browserslist-to-esbuild": "^1.1.1",
61
66
  "c8": "^7.12.0",
62
67
  "element-internals-polyfill": "^1.1.11",
63
68
  "esbuild": "^0.17.12",
64
- "esbuild-minify-templates": "^0.10.0",
65
69
  "eslint": "^8.24.0",
66
70
  "eslint-config-airbnb-base": "^15.0.0",
67
71
  "eslint-plugin-compat": "^4.0.2",
@@ -70,7 +74,9 @@
70
74
  "eslint-plugin-jsdoc": "^40.0.3",
71
75
  "eslint-plugin-sort-class-members": "^1.15.2",
72
76
  "eslint-plugin-unicorn": "^46.0.0",
77
+ "html-minifier-terser": "^7.1.0",
73
78
  "http-server": "^14.1.1",
79
+ "magic-string": "^0.30.0",
74
80
  "postcss-styled": "^0.34.0",
75
81
  "postcss-styled-syntax": "^0.4.0",
76
82
  "stylelint": "^15.2.0",
package/index.js DELETED
@@ -1,77 +0,0 @@
1
- export { default as Badge } from './components/Badge.js';
2
- export { default as Body } from './components/Body.js';
3
- export { default as BottomAppBar } from './components/BottomAppBar.js';
4
- export { default as Box } from './components/Box.js';
5
- export { default as Button } from './components/Button.js';
6
- export { default as Card } from './components/Card.js';
7
- export { default as Checkbox } from './components/Checkbox.js';
8
- export { default as Chip } from './components/Chip.js';
9
- export { default as Dialog } from './components/Dialog.js';
10
- export { default as Divider } from './components/Divider.js';
11
- export { default as ExtendedFab } from './components/ExtendedFab.js';
12
- export { default as Fab } from './components/Fab.js';
13
- export { default as FilterChip } from './components/FilterChip.js';
14
- export { default as Headline } from './components/Headline.js';
15
- export { default as Icon } from './components/Icon.js';
16
- export { default as IconButton } from './components/IconButton.js';
17
- export { default as Input } from './components/Input.js';
18
- export { default as Label } from './components/Label.js';
19
- export { default as Layout } from './components/Layout.js';
20
- export { default as List } from './components/List.js';
21
- export { default as ListItem } from './components/ListItem.js';
22
- export { default as ListOption } from './components/ListOption.js';
23
- export { default as ListSelect } from './components/ListSelect.js';
24
- export { default as Menu } from './components/Menu.js';
25
- export { default as MenuItem } from './components/MenuItem.js';
26
- export { default as NavBar } from './components/NavBar.js';
27
- export { default as NavBarItem } from './components/NavBarItem.js';
28
- export { default as NavDrawer } from './components/NavDrawer.js';
29
- export { default as NavDrawerItem } from './components/NavDrawerItem.js';
30
- export { default as NavItem } from './components/NavItem.js';
31
- export { default as NavRail } from './components/NavRail.js';
32
- export { default as NavRailItem } from './components/NavRailItem.js';
33
- export { default as Pane } from './components/Pane.js';
34
- export { default as Progress } from './components/Progress.js';
35
- export { default as Radio } from './components/Radio.js';
36
- export { default as SegmentedButton } from './components/SegmentedButton.js';
37
- export { default as SegmentedButtonGroup } from './components/SegmentedButtonGroup.js';
38
- export { default as Select } from './components/Select.js';
39
- export { default as Slider } from './components/Slider.js';
40
- export { default as Snackbar } from './components/Snackbar.js';
41
- export { default as Surface } from './components/Surface.js';
42
- export { default as Switch } from './components/Switch.js';
43
- export { default as Tab } from './components/Tab.js';
44
- export { default as TabContent } from './components/TabContent.js';
45
- export { default as TabList } from './components/TabList.js';
46
- export { default as TabPanel } from './components/TabPanel.js';
47
- export { default as TextArea } from './components/TextArea.js';
48
- export { default as Title } from './components/Title.js';
49
- export { default as Tooltip } from './components/Tooltip.js';
50
- export { default as TopAppBar } from './components/TopAppBar.js';
51
-
52
- export { default as CustomElement } from './core/CustomElement.js';
53
- export { default as Composition } from './core/Composition.js';
54
-
55
- export { default as InputMixin } from './mixins/InputMixin.js';
56
- export { default as AriaReflectorMixin } from './mixins/AriaReflectorMixin.js';
57
- export { default as ControlMixin } from './mixins/ControlMixin.js';
58
- export { default as RTLObserverMixin } from './mixins/RTLObserverMixin.js';
59
- export { default as TouchTargetMixin } from './mixins/TouchTargetMixin.js';
60
- export { default as ShapeMixin } from './mixins/ShapeMixin.js';
61
- export { default as RippleMixin } from './mixins/RippleMixin.js';
62
- export { default as FormAssociatedMixin } from './mixins/FormAssociatedMixin.js';
63
- export { default as KeyboardNavMixin } from './mixins/KeyboardNavMixin.js';
64
- export { default as ResizeObserverMixin } from './mixins/ResizeObserverMixin.js';
65
- export { default as DensityMixin } from './mixins/DensityMixin.js';
66
- export { default as TooltipTriggerMixin } from './mixins/TooltipTriggerMixin.js';
67
- export { default as ScrollListenerMixin } from './mixins/ScrollListenerMixin.js';
68
- export { default as FlexableMixin } from './mixins/FlexableMixin.js';
69
- export { default as ThemableMixin } from './mixins/ThemableMixin.js';
70
- export { default as AriaToolbarMixin } from './mixins/AriaToolbarMixin.js';
71
- export { default as TextFieldMixin } from './mixins/TextFieldMixin.js';
72
- export { default as SurfaceMixin } from './mixins/SurfaceMixin.js';
73
- export { default as StateMixin } from './mixins/StateMixin.js';
74
-
75
- export * as themeLoader from './theming/loader.js';
76
-
77
- export * as theming from './theming/index.js';