@quartzds/core 1.0.0-beta.20 → 1.0.0-beta.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/index.d.ts +6 -0
- package/components/index.js +1 -1
- package/components/qds-select.js +1 -1
- package/components/qds-select.js.map +1 -1
- package/dist/cjs/{index-b608df4d.js → index-210f861c.js} +93 -15
- package/dist/cjs/index-210f861c.js.map +1 -0
- package/dist/cjs/index.cjs.js +2 -2
- package/dist/cjs/{library-17a14378.js → library-4a3613dd.js} +2 -2
- package/dist/cjs/{library-17a14378.js.map → library-4a3613dd.js.map} +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/loader.cjs.js.map +1 -1
- package/dist/cjs/qds-button.cjs.entry.js +1 -1
- package/dist/cjs/qds-checkbox.cjs.entry.js +1 -1
- package/dist/cjs/qds-dialog.cjs.entry.js +1 -1
- package/dist/cjs/qds-divider.cjs.entry.js +1 -1
- package/dist/cjs/qds-dropdown.cjs.entry.js +1 -1
- package/dist/cjs/qds-form-message.cjs.entry.js +1 -1
- package/dist/cjs/qds-icon.cjs.entry.js +2 -2
- package/dist/cjs/qds-inline-link.cjs.entry.js +1 -1
- package/dist/cjs/qds-input.cjs.entry.js +1 -1
- package/dist/cjs/qds-label.cjs.entry.js +1 -1
- package/dist/cjs/qds-radio.cjs.entry.js +1 -1
- package/dist/cjs/qds-select.cjs.entry.js +2 -2
- package/dist/cjs/qds-select.cjs.entry.js.map +1 -1
- package/dist/cjs/qds-switch.cjs.entry.js +1 -1
- package/dist/cjs/qds-table-body.cjs.entry.js +1 -1
- package/dist/cjs/qds-table-cell.cjs.entry.js +1 -1
- package/dist/cjs/qds-table-head-cell.cjs.entry.js +1 -1
- package/dist/cjs/qds-table-head.cjs.entry.js +1 -1
- package/dist/cjs/qds-table-row.cjs.entry.js +1 -1
- package/dist/cjs/qds-table.cjs.entry.js +1 -1
- package/dist/cjs/qds-textarea.cjs.entry.js +1 -1
- package/dist/cjs/qds-title.cjs.entry.js +1 -1
- package/dist/cjs/qds-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/qds.cjs.js +2 -2
- package/dist/cjs/qds.cjs.js.map +1 -1
- package/dist/docs.d.ts +322 -240
- package/dist/docs.json +3 -3
- package/dist/esm/{index-303382b7.js → index-7b820913.js} +93 -15
- package/dist/esm/index-7b820913.js.map +1 -0
- package/dist/esm/index.js +2 -2
- package/dist/esm/{library-f07754e6.js → library-68f03bea.js} +2 -2
- package/dist/esm/{library-f07754e6.js.map → library-68f03bea.js.map} +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/loader.js.map +1 -1
- package/dist/esm/qds-button.entry.js +1 -1
- package/dist/esm/qds-checkbox.entry.js +1 -1
- package/dist/esm/qds-dialog.entry.js +1 -1
- package/dist/esm/qds-divider.entry.js +1 -1
- package/dist/esm/qds-dropdown.entry.js +1 -1
- package/dist/esm/qds-form-message.entry.js +1 -1
- package/dist/esm/qds-icon.entry.js +2 -2
- package/dist/esm/qds-inline-link.entry.js +1 -1
- package/dist/esm/qds-input.entry.js +1 -1
- package/dist/esm/qds-label.entry.js +1 -1
- package/dist/esm/qds-radio.entry.js +1 -1
- package/dist/esm/qds-select.entry.js +2 -2
- package/dist/esm/qds-select.entry.js.map +1 -1
- package/dist/esm/qds-switch.entry.js +1 -1
- package/dist/esm/qds-table-body.entry.js +1 -1
- package/dist/esm/qds-table-cell.entry.js +1 -1
- package/dist/esm/qds-table-head-cell.entry.js +1 -1
- package/dist/esm/qds-table-head.entry.js +1 -1
- package/dist/esm/qds-table-row.entry.js +1 -1
- package/dist/esm/qds-table.entry.js +1 -1
- package/dist/esm/qds-textarea.entry.js +1 -1
- package/dist/esm/qds-title.entry.js +1 -1
- package/dist/esm/qds-tooltip.entry.js +1 -1
- package/dist/esm/qds.js +3 -3
- package/dist/esm/qds.js.map +1 -1
- package/dist/types/stencil-public-runtime.d.ts +17 -5
- package/hydrate/index.d.ts +6 -6
- package/hydrate/index.js +92 -81
- package/loader/index.d.ts +1 -1
- package/package.json +26 -22
- package/dist/cjs/index-b608df4d.js.map +0 -1
- package/dist/esm/index-303382b7.js.map +0 -1
package/components/index.d.ts
CHANGED
|
@@ -44,6 +44,12 @@ export { defineCustomElement as defineCustomElementQdsTitle } from './qds-title'
|
|
|
44
44
|
export { Tooltip as QdsTooltip } from '../dist/types/components/tooltip/tooltip';
|
|
45
45
|
export { defineCustomElement as defineCustomElementQdsTooltip } from './qds-tooltip';
|
|
46
46
|
|
|
47
|
+
/**
|
|
48
|
+
* Get the base path to where the assets can be found. Use "setAssetPath(path)"
|
|
49
|
+
* if the path needs to be customized.
|
|
50
|
+
*/
|
|
51
|
+
export declare const getAssetPath: (path: string) => string;
|
|
52
|
+
|
|
47
53
|
/**
|
|
48
54
|
* Used to manually set the base path where assets can be found.
|
|
49
55
|
* If the script is used as "module", it's recommended to use "import.meta.url",
|
package/components/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* SPDX-License-Identifier: LGPL-2.1-only
|
|
5
5
|
*/
|
|
6
|
-
export { setAssetPath, setNonce, setPlatformOptions } from '@stencil/core/internal/client';
|
|
6
|
+
export { getAssetPath, setAssetPath, setNonce, setPlatformOptions } from '@stencil/core/internal/client';
|
|
7
7
|
export { r as registerIconLibrary, u as unregisterIconLibrary } from './icon.js';
|
|
8
8
|
export { QdsButton, defineCustomElement as defineCustomElementQdsButton } from './qds-button.js';
|
|
9
9
|
export { QdsCheckbox, defineCustomElement as defineCustomElementQdsCheckbox } from './qds-checkbox.js';
|
package/components/qds-select.js
CHANGED
|
@@ -7,7 +7,7 @@ import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/i
|
|
|
7
7
|
import { p as pickFocusEventAttributes, a as invariant, e as pickInputEventAttributes, i as inheritAriaAttributes, b as inheritAttributes } from './helpers.js';
|
|
8
8
|
import { d as defineCustomElement$2 } from './icon.js';
|
|
9
9
|
|
|
10
|
-
const selectCss = "[hidden].sc-qds-select-h{display:none !important}.sc-qds-select-h{display:inline-block}.qds-container.sc-qds-select,.qds-select.sc-qds-select{height:100%}.qds-container.sc-qds-select{align-content:flex-start;align-items:center;box-sizing:border-box;display:grid;grid-template-areas:'select';width:inherit}.qds-container.qds-multiple.sc-qds-select{align-content:initial}.qds-icon.sc-qds-select,.qds-select.sc-qds-select,.sc-qds-select-s>optgroup,.sc-qds-select-s>optgroup>option,.sc-qds-select-s>option{color:var(--qds-theme-control-text-standard)}.qds-icon.sc-qds-select,.qds-select.sc-qds-select{grid-area:select}.qds-icon.sc-qds-select{justify-self:end;margin-inline-end:calc(\n var(--qds-control-input-padding-horizontal) +\n var(--qds-control-border-width)\n );pointer-events:none}.qds-select.sc-qds-select{-webkit-appearance:none;appearance:none;background-color:var(--qds-theme-control-input-background);border-radius:var(--qds-control-border-radius);border:var(--qds-control-border-width) solid var(--qds-theme-control-border);margin:0;padding-block:0;padding-inline:var(--qds-control-input-padding-horizontal)}.qds-select.sc-qds-select:focus-visible{outline:var(--qds-theme-focus-border) solid var(--qds-focus-border-width)}.qds-select[aria-invalid='true'].sc-qds-select:not(:focus){border-color:var(--qds-theme-feedback-result-failure)}.qds-select.sc-qds-select:disabled,.qds-select.sc-qds-select:disabled+.qds-icon.sc-qds-select{opacity:var(--qds-theme-disabled)}:is(.sc-qds-select-s>optgroup,.sc-qds-select-s>optgroup:not(:disabled)>option,.sc-qds-select-s>option):disabled{opacity:var(--qds-theme-disabled)}.sc-qds-select-s>optgroup{font:var(--qds-accessory-section-title)}.sc-qds-select-s>optgroup>option,.sc-qds-select-s>option{font:var(--qds-list-item-label-main)}.qds-select[data-size='small'].sc-qds-select{font:var(--qds-control-small-text)}.qds-select[data-size='small'].sc-qds-select:not([multiple]){height:var(--qds-control-small-height);padding-inline-end:calc(\n var(--qds-control-small-icon-size) + var(--qds-text-icon-gap) +\n var(--qds-control-input-padding-horizontal)\n )}.qds-icon[data-size='small'].sc-qds-select{height:var(--qds-control-small-icon-size);width:var(--qds-control-small-icon-size)}.qds-select[data-size='standard'].sc-qds-select{font:var(--qds-control-standard-text)}.qds-select[data-size='standard'].sc-qds-select:not([multiple]){height:var(--qds-control-standard-height);padding-inline-end:calc(\n var(--qds-control-standard-icon-size) + var(--qds-text-icon-gap) +\n var(--qds-control-input-padding-horizontal)\n )}.qds-icon[data-size='standard'].sc-qds-select{height:var(--qds-control-standard-icon-size);width:var(--qds-control-standard-icon-size)}.qds-select[data-size='large'].sc-qds-select{font:var(--qds-control-large-text)}.qds-select[data-size='large'].sc-qds-select:not([multiple]){height:var(--qds-control-large-height);padding-inline-end:calc(\n var(--qds-control-large-icon-size) + var(--qds-text-icon-gap) +\n var(--qds-control-input-padding-horizontal)\n )}.qds-icon[data-size='large'].sc-qds-select{height:var(--qds-control-large-icon-size);width:var(--qds-control-large-icon-size)}";
|
|
10
|
+
const selectCss = "[hidden].sc-qds-select-h{display:none !important}.sc-qds-select-h{display:inline-block}.qds-container.sc-qds-select,.qds-select.sc-qds-select{height:100%}.qds-container.sc-qds-select{align-content:flex-start;align-items:center;box-sizing:border-box;display:grid;grid-template-areas:'select';width:inherit}.qds-container.qds-multiple.sc-qds-select{align-content:initial}.qds-icon.sc-qds-select,.qds-select.sc-qds-select,.sc-qds-select-s>optgroup,.sc-qds-select-s>optgroup>option,.sc-qds-select-s>option{color:var(--qds-theme-control-text-standard)}.qds-icon.sc-qds-select,.qds-select.sc-qds-select{grid-area:select}.qds-icon.sc-qds-select{justify-self:end;margin-inline-end:calc(\n var(--qds-control-input-padding-horizontal) +\n var(--qds-control-border-width)\n );pointer-events:none}.qds-select.sc-qds-select{-webkit-appearance:none;appearance:none;background-color:var(--qds-theme-control-input-background);border-radius:var(--qds-control-border-radius);border:var(--qds-control-border-width) solid var(--qds-theme-control-border);margin:0;padding-block:0;padding-inline:var(--qds-control-input-padding-horizontal)}.qds-select.sc-qds-select:focus-visible{outline:var(--qds-theme-focus-border) solid var(--qds-focus-border-width);outline-offset:var(--qds-focus-border-offset)}.qds-select[aria-invalid='true'].sc-qds-select:not(:focus){border-color:var(--qds-theme-feedback-result-failure)}.qds-select.sc-qds-select:disabled,.qds-select.sc-qds-select:disabled+.qds-icon.sc-qds-select{opacity:var(--qds-theme-disabled)}:is(.sc-qds-select-s>optgroup,.sc-qds-select-s>optgroup:not(:disabled)>option,.sc-qds-select-s>option):disabled{opacity:var(--qds-theme-disabled)}.sc-qds-select-s>optgroup{font:var(--qds-accessory-section-title)}.sc-qds-select-s>optgroup>option,.sc-qds-select-s>option{font:var(--qds-list-item-label-main)}.qds-select[data-size='small'].sc-qds-select{font:var(--qds-control-small-text)}.qds-select[data-size='small'].sc-qds-select:not([multiple]){height:var(--qds-control-small-height);padding-inline-end:calc(\n var(--qds-control-small-icon-size) + var(--qds-text-icon-gap) +\n var(--qds-control-input-padding-horizontal)\n )}.qds-icon[data-size='small'].sc-qds-select{height:var(--qds-control-small-icon-size);width:var(--qds-control-small-icon-size)}.qds-select[data-size='standard'].sc-qds-select{font:var(--qds-control-standard-text)}.qds-select[data-size='standard'].sc-qds-select:not([multiple]){height:var(--qds-control-standard-height);padding-inline-end:calc(\n var(--qds-control-standard-icon-size) + var(--qds-text-icon-gap) +\n var(--qds-control-input-padding-horizontal)\n )}.qds-icon[data-size='standard'].sc-qds-select{height:var(--qds-control-standard-icon-size);width:var(--qds-control-standard-icon-size)}.qds-select[data-size='large'].sc-qds-select{font:var(--qds-control-large-text)}.qds-select[data-size='large'].sc-qds-select:not([multiple]){height:var(--qds-control-large-height);padding-inline-end:calc(\n var(--qds-control-large-icon-size) + var(--qds-text-icon-gap) +\n var(--qds-control-input-padding-horizontal)\n )}.qds-icon[data-size='large'].sc-qds-select{height:var(--qds-control-large-icon-size);width:var(--qds-control-large-icon-size)}";
|
|
11
11
|
|
|
12
12
|
let autoIncrementingId = 1;
|
|
13
13
|
const Select = /*@__PURE__*/ proxyCustomElement(class Select extends HTMLElement {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
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ACzB,GAAG,qBAAqB,CAAC,IAAI,CAAC,OAAO,CAAC;MACtC,GAAG,iBAAiB,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,UAAU,CAAC,CAAC;KACjD,CAAA;GACF;EAEM,MAAM;IACX,QACE,WACE,KAAK,EAAE;QACL,eAAe,EAAE,IAAI;QACrB,cAAc,EAAE,IAAI,CAAC,QAAQ,IAAI,KAAK;OACvC,eACU,IAAI,CAAC,IAAI,IAEpB,8BACgB,IAAI,CAAC,OAAO,GAAG,MAAM,GAAG,OAAO,EAC7C,YAAY,EAAE,IAAI,CAAC,YAAY;;MAE/B,SAAS,EAAE,IAAI,CAAC,SAAS,EACzB,KAAK,EAAC,YAAY,eACP,IAAI,CAAC,IAAI,EACpB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,SAAS,EAAE,IAAI,CAAC,SAAS,EACzB,GAAG,EAAE,IAAI,CAAC,GAAG,EACb,QAAQ,EAAE,IAAI,CAAC,QAAQ,KAEnB,IAAI,CAAC,mBAAmB,IAE5B,eAAQ,CACD,EACR,IAAI,CAAC,QAAQ,KAAK,IAAI,KACrB,gBACE,KAAK,EAAC,UAAU,eACL,IAAI,CAAC,IAAI,EACpB,OAAO,EAAC,MAAM,EACd,IAAI,EAAC,UAAU,GACf,CACH,CACG,EACP;GACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/select/select.css?tag=qds-select&encapsulation=scoped","src/components/select/select.tsx"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: © 2023 Schneider Electric\n *\n * SPDX-License-Identifier: LGPL-2.1-only\n */\n\n@import url('../shared.css');\n\n:host {\n display: inline-block;\n}\n\n.qds-container,\n.qds-select {\n height: 100%;\n}\n\n.qds-container {\n align-content: flex-start;\n align-items: center;\n box-sizing: border-box;\n display: grid;\n grid-template-areas: 'select';\n width: inherit;\n\n &.qds-multiple {\n align-content: initial;\n }\n}\n\n.qds-icon,\n.qds-select,\n::slotted(optgroup),\n::slotted(optgroup > option),\n::slotted(option) {\n color: var(--qds-theme-control-text-standard);\n}\n\n.qds-icon,\n.qds-select {\n grid-area: select;\n}\n\n.qds-icon {\n justify-self: end;\n margin-inline-end: calc(\n var(--qds-control-input-padding-horizontal) +\n var(--qds-control-border-width)\n );\n pointer-events: none;\n}\n\n.qds-select {\n appearance: none;\n background-color: var(--qds-theme-control-input-background);\n border-radius: var(--qds-control-border-radius);\n border: var(--qds-control-border-width) solid var(--qds-theme-control-border);\n margin: 0;\n padding-block: 0;\n padding-inline: var(--qds-control-input-padding-horizontal);\n\n &:focus-visible {\n outline: var(--qds-theme-focus-border) solid var(--qds-focus-border-width);\n }\n\n &:not(:focus)[aria-invalid='true'] {\n border-color: var(--qds-theme-feedback-result-failure);\n }\n}\n\n.qds-select:disabled,\n.qds-select:disabled + .qds-icon {\n opacity: var(--qds-theme-disabled);\n}\n\n:is(\n ::slotted(optgroup),\n ::slotted(optgroup:not(:disabled) > option),\n ::slotted(option)\n ):disabled {\n opacity: var(--qds-theme-disabled);\n}\n\n::slotted(optgroup) {\n font: var(--qds-accessory-section-title);\n}\n\n::slotted(optgroup > option),\n::slotted(option) {\n font: var(--qds-list-item-label-main);\n}\n\n[data-size='small'] {\n &.qds-select {\n font: var(--qds-control-small-text);\n\n &:not([multiple]) {\n height: var(--qds-control-small-height);\n padding-inline-end: calc(\n var(--qds-control-small-icon-size) + var(--qds-text-icon-gap) +\n var(--qds-control-input-padding-horizontal)\n );\n }\n }\n\n &.qds-icon {\n height: var(--qds-control-small-icon-size);\n width: var(--qds-control-small-icon-size);\n }\n}\n\n[data-size='standard'] {\n &.qds-select {\n font: var(--qds-control-standard-text);\n\n &:not([multiple]) {\n height: var(--qds-control-standard-height);\n padding-inline-end: calc(\n var(--qds-control-standard-icon-size) + var(--qds-text-icon-gap) +\n var(--qds-control-input-padding-horizontal)\n );\n }\n }\n\n &.qds-icon {\n height: var(--qds-control-standard-icon-size);\n width: var(--qds-control-standard-icon-size);\n }\n}\n\n[data-size='large'] {\n &.qds-select {\n font: var(--qds-control-large-text);\n\n &:not([multiple]) {\n height: var(--qds-control-large-height);\n padding-inline-end: calc(\n var(--qds-control-large-icon-size) + var(--qds-text-icon-gap) +\n var(--qds-control-input-padding-horizontal)\n );\n }\n }\n\n &.qds-icon {\n height: var(--qds-control-large-icon-size);\n width: var(--qds-control-large-icon-size);\n }\n}\n","// SPDX-FileCopyrightText: © 2023 Schneider Electric\n//\n// SPDX-License-Identifier: LGPL-2.1-only\n\nimport type { ComponentInterface, EventEmitter } from '@stencil/core'\nimport {\n Component,\n Element,\n Event,\n h,\n Method,\n Prop,\n Watch,\n} from '@stencil/core'\n\nimport type {\n Attributes,\n QdsFocusEventDetail,\n QdsInputEventDetail,\n} from '../../helpers'\nimport {\n inheritAriaAttributes,\n inheritAttributes,\n invariant,\n pickFocusEventAttributes,\n pickInputEventAttributes,\n} from '../../helpers'\nimport type { AutoComplete, Value } from '../controls'\n\nexport type SelectSize = 'large' | 'small' | 'standard'\n\nlet autoIncrementingId = 1\n\n/**\n * The `<qds-select>` element represents a control that provides a menu of\n * options.\n *\n * @see https://quartz.se.com/build/components/select\n */\n@Component({\n tag: 'qds-select',\n scoped: true,\n styleUrl: 'select.css',\n})\nexport class Select implements ComponentInterface {\n /**\n * Defines if the select is in an invalid state. Validity is determined by\n * the `required` attribute using [constraint validation][].\n *\n * [constraint validation]: https://developer.mozilla.org/docs/Web/Guide/HTML/Constraint_validation\n */\n @Prop({ mutable: true, reflect: true }) public invalid = false\n\n /**\n * The select's size.\n *\n * > ***NOTE:*** The native [`size` HTML attribute] is not supported. CSS\n * `height` should be used instead if this functionality is needed.\n *\n * [`size` HTML attribute]: https://developer.mozilla.org/docs/Web/HTML/Attributes/size\n */\n @Prop({ reflect: true }) public readonly size: SelectSize = 'standard'\n\n /**\n * Provides a hint for a [user agent's][] autocomplete feature. See\n * [the HTML `autocomplete` attribute][] for a complete list of values and\n * details on how to use `autoComplete`.\n *\n * [user agent's]: https://developer.mozilla.org/docs/Glossary/User_agent\n * [the HTML `autocomplete` attribute]: https://developer.mozilla.org/docs/Web/HTML/Attributes/autocomplete\n *\n * @webnative\n */\n @Prop({ attribute: 'autocomplete' })\n public readonly autoComplete?: AutoComplete\n\n /**\n * Specify whether the select should have focus when the page loads.\n *\n * @webnative\n */\n @Prop({ attribute: 'autofocus' }) public readonly autoFocus?: boolean\n\n /**\n * Prevents the select from being interacted with: it cannot be pressed or\n * focused.\n *\n * @webnative\n */\n @Prop({ mutable: true, reflect: true }) public disabled?: boolean\n\n /**\n * The [`<form>`](https://developer.mozilla.org/docs/Web/HTML/Element/form)\n * element to associate the select with (its form owner).\n *\n * The value of this attribute must be the id of a `<form>` in the same\n * document. If this attribute is not set, the `<qds-select>` is associated\n * with its ancestor `<form>` element, if any.\n *\n * This attribute lets you associate `<qds-select>` elements to `<form>`s\n * anywhere in the document, not just inside a `<form>`. It can also override\n * an ancestor `<form>` element.\n *\n * @webnative\n */\n @Prop() public readonly form?: string\n\n /**\n * Indicates that multiple options can be selected in the list. If it is not\n * specified, then only one option can be selected at a time. When `multiple`\n * is specified, most browsers will show a scrolling list box instead of a\n * single line dropdown.\n *\n * @webnative\n */\n @Prop({ reflect: true }) public multiple?: boolean\n\n /**\n * The name of the input, which is submitted with the form data. An\n * incrementing input ID is used by default.\n *\n * @webnative\n */\n @Prop() public readonly name = `qds-input-${autoIncrementingId}`\n\n /**\n * An `<option>` with a non-empty string value must be selected before this\n * select can be submitted.\n *\n * See [Client-side validation] and the [HTML attribute: `required`] for more\n * information.\n *\n * [Client-side validation]: https://developer.mozilla.org/docs/Web/HTML/Element/input#client-side_validation\n * [HTML attribute: `required`]: https://developer.mozilla.org/docs/Web/HTML/Attributes/required\n *\n * @webnative\n */\n @Prop() public readonly required?: boolean\n\n /**\n * The value of the select.\n *\n * @webnative\n */\n @Prop({ mutable: true }) public value?: Value\n\n /**\n * Emitted when the select loses focus.\n */\n @Event({ eventName: 'qdsBlur', bubbles: false, cancelable: false })\n private readonly blurEmitter!: EventEmitter<QdsFocusEventDetail>\n\n /**\n * Emitted when an alteration to the select's value is committed by the\n * user.\n */\n @Event({ eventName: 'qdsChange', cancelable: false })\n private readonly changeEmitter!: EventEmitter<void>\n\n /**\n * Emitted when the select gains focus.\n */\n @Event({ eventName: 'qdsFocus', bubbles: false, cancelable: false })\n private readonly focusEmitter!: EventEmitter<QdsFocusEventDetail>\n\n /**\n * Emitted when the select's value changes.\n */\n @Event({ eventName: 'qdsInput', cancelable: false })\n private readonly inputEmitter!: EventEmitter<QdsInputEventDetail>\n\n @Element() private readonly element!: HTMLQdsSelectElement\n\n private inheritedAttributes: Attributes = {}\n\n private select?: HTMLSelectElement\n\n /**\n * Adds an element to the options collection.\n *\n * @param element The element to add.\n * @param before An element of the options collection or a zero-based index\n * representing the item the element should be added before. If this\n * parameter is not specified or the index does not exist, the new element is\n * appended to the end of the collection.\n */\n @Method()\n public async addItem(\n element: HTMLOptGroupElement | HTMLOptionElement,\n before?: HTMLElement | number,\n ): Promise<void> {\n invariant(this.select)\n\n this.select.add(element, before)\n }\n\n /**\n * Retrieves an element from the options collection by its index.\n *\n * @param index Zero-based index of the [`HTMLOptionElement`][] to retrieve.\n *\n * [`HTMLOptionElement`]: https://developer.mozilla.org/docs/Web/API/HTMLOptionElement\n */\n @Method()\n public async item(index: number): Promise<HTMLOptionElement | null> {\n invariant(this.select)\n\n return this.select.item(index)\n }\n\n /**\n * Retrieves an element from the options collection by its name.\n *\n * @param name The `name` or `id` property of the [`HTMLOptionElement`][] to\n * retrieve.\n *\n * [`HTMLOptionElement`]: https://developer.mozilla.org/docs/Web/API/HTMLOptionElement\n */\n @Method()\n public async namedItem(name: string): Promise<HTMLOptionElement | null> {\n invariant(this.select)\n\n return this.select.namedItem(name)\n }\n\n /**\n * Removes an element from the options collection.\n *\n * @param index Zero-based index of the [`HTMLOptionElement`][] to remove\n * from the collection. If the index is not found the method has no effect.\n *\n * [`HTMLOptionElement`]: https://developer.mozilla.org/docs/Web/API/HTMLOptionElement\n */\n @Method()\n public async removeItem(index: number): Promise<void> {\n invariant(this.select)\n\n this.select.remove(index)\n }\n\n /**\n * Sets a custom validity message for the select. If this message is not the\n * empty string, then the element is considered invalid.\n */\n @Method()\n public async setCustomValidity(message: string): Promise<void> {\n invariant(this.select)\n\n this.select.setCustomValidity(message)\n this.invalid = !this.select.checkValidity()\n }\n\n @Watch('disabled')\n protected disabledChanged(): void {\n invariant(this.select)\n\n // Disabled selects are always valid, so we need to recheck validity when\n // the state changes.\n this.select.disabled = this.disabled ?? false\n this.invalid = !this.select.checkValidity()\n }\n\n @Watch('value')\n protected valueChanged(): void {\n invariant(this.select)\n\n this.select.value = this.value === null ? '' : String(this.value)\n this.invalid = !this.select.checkValidity()\n }\n\n public componentWillLoad(): void {\n autoIncrementingId += 1\n this.inheritedAttributes = {\n ...inheritAriaAttributes(this.element),\n ...inheritAttributes(this.element, ['tabindex']),\n }\n }\n\n public render() {\n return (\n <div\n class={{\n 'qds-container': true,\n 'qds-multiple': this.multiple ?? false,\n }}\n data-size={this.size}\n >\n <select\n aria-invalid={this.invalid ? 'true' : 'false'}\n autoComplete={this.autoComplete}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={this.autoFocus}\n class=\"qds-select\"\n data-size={this.size}\n disabled={this.disabled}\n form={this.form}\n multiple={this.multiple}\n name={this.name}\n onBlur={this.onBlur}\n onChange={this.onChange}\n onFocus={this.onFocus}\n onInput={this.onInput}\n onInvalid={this.onInvalid}\n ref={this.ref}\n required={this.required}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...this.inheritedAttributes}\n >\n <slot />\n </select>\n {this.multiple !== true && (\n <qds-icon\n class=\"qds-icon\"\n data-size={this.size}\n library=\"core\"\n name=\"dropdown\"\n />\n )}\n </div>\n )\n }\n\n private readonly ref = (select?: HTMLSelectElement): void => {\n this.select = select\n }\n\n private readonly onBlur = (event: FocusEvent): void => {\n this.blurEmitter.emit(pickFocusEventAttributes(event))\n }\n\n private readonly onChange = (): void => {\n this.changeEmitter.emit()\n }\n\n private readonly onFocus = (event: FocusEvent): void => {\n this.focusEmitter.emit(pickFocusEventAttributes(event))\n }\n\n private readonly onInput = (event: InputEvent): void => {\n invariant(this.select)\n\n this.value = this.select.value\n\n this.inputEmitter.emit(pickInputEventAttributes(event))\n }\n\n private readonly onInvalid = (): void => {\n this.invalid = true\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"qds-select.js","mappings":";;;;;;;;;AAAA,MAAM,SAAS,GAAG,gsGAAgsG;;AC+BltG,IAAI,kBAAkB,GAAG,CAAC,CAAA;MAab,MAAM;;;;;;;;IAiIT,wBAAmB,GAAe,EAAE,CAAA;IAqJ3B,QAAG,GAAG,CAAC,MAA0B;MAChD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;KACrB,CAAA;IAEgB,WAAM,GAAG,CAAC,KAAiB;MAC1C,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC,CAAA;KACvD,CAAA;IAEgB,aAAQ,GAAG;MAC1B,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,CAAA;KAC1B,CAAA;IAEgB,YAAO,GAAG,CAAC,KAAiB;MAC3C,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC,CAAA;KACxD,CAAA;IAEgB,YAAO,GAAG,CAAC,KAAiB;MAC3C,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;MAEtB,IAAI,CAAC,KAAK,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EAAE,IAAI,CAAC,OAAO,EACrB,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,SAAS,EAAE,IAAI,CAAC,SAAS,EACzB,GAAG,EAAE,IAAI,CAAC,GAAG,EACb,QAAQ,EAAE,IAAI,CAAC,QAAQ,KAEnB,IAAI,CAAC,mBAAmB,IAE5B,eAAQ,CACD,EACR,IAAI,CAAC,QAAQ,KAAK,IAAI,KACrB,gBACE,KAAK,EAAC,UAAU,eACL,IAAI,CAAC,IAAI,EACpB,OAAO,EAAC,MAAM,EACd,IAAI,EAAC,UAAU,GACf,CACH,CACG,EACP;GACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/select/select.css?tag=qds-select&encapsulation=scoped","src/components/select/select.tsx"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: © 2023 Schneider Electric\n *\n * SPDX-License-Identifier: LGPL-2.1-only\n */\n\n@import url('../shared.css');\n\n:host {\n display: inline-block;\n}\n\n.qds-container,\n.qds-select {\n height: 100%;\n}\n\n.qds-container {\n align-content: flex-start;\n align-items: center;\n box-sizing: border-box;\n display: grid;\n grid-template-areas: 'select';\n width: inherit;\n\n &.qds-multiple {\n align-content: initial;\n }\n}\n\n.qds-icon,\n.qds-select,\n::slotted(optgroup),\n::slotted(optgroup > option),\n::slotted(option) {\n color: var(--qds-theme-control-text-standard);\n}\n\n.qds-icon,\n.qds-select {\n grid-area: select;\n}\n\n.qds-icon {\n justify-self: end;\n margin-inline-end: calc(\n var(--qds-control-input-padding-horizontal) +\n var(--qds-control-border-width)\n );\n pointer-events: none;\n}\n\n.qds-select {\n appearance: none;\n background-color: var(--qds-theme-control-input-background);\n border-radius: var(--qds-control-border-radius);\n border: var(--qds-control-border-width) solid var(--qds-theme-control-border);\n margin: 0;\n padding-block: 0;\n padding-inline: var(--qds-control-input-padding-horizontal);\n\n &:focus-visible {\n outline: var(--qds-theme-focus-border) solid var(--qds-focus-border-width);\n outline-offset: var(--qds-focus-border-offset);\n }\n\n &:not(:focus)[aria-invalid='true'] {\n border-color: var(--qds-theme-feedback-result-failure);\n }\n}\n\n.qds-select:disabled,\n.qds-select:disabled + .qds-icon {\n opacity: var(--qds-theme-disabled);\n}\n\n:is(\n ::slotted(optgroup),\n ::slotted(optgroup:not(:disabled) > option),\n ::slotted(option)\n ):disabled {\n opacity: var(--qds-theme-disabled);\n}\n\n::slotted(optgroup) {\n font: var(--qds-accessory-section-title);\n}\n\n::slotted(optgroup > option),\n::slotted(option) {\n font: var(--qds-list-item-label-main);\n}\n\n[data-size='small'] {\n &.qds-select {\n font: var(--qds-control-small-text);\n\n &:not([multiple]) {\n height: var(--qds-control-small-height);\n padding-inline-end: calc(\n var(--qds-control-small-icon-size) + var(--qds-text-icon-gap) +\n var(--qds-control-input-padding-horizontal)\n );\n }\n }\n\n &.qds-icon {\n height: var(--qds-control-small-icon-size);\n width: var(--qds-control-small-icon-size);\n }\n}\n\n[data-size='standard'] {\n &.qds-select {\n font: var(--qds-control-standard-text);\n\n &:not([multiple]) {\n height: var(--qds-control-standard-height);\n padding-inline-end: calc(\n var(--qds-control-standard-icon-size) + var(--qds-text-icon-gap) +\n var(--qds-control-input-padding-horizontal)\n );\n }\n }\n\n &.qds-icon {\n height: var(--qds-control-standard-icon-size);\n width: var(--qds-control-standard-icon-size);\n }\n}\n\n[data-size='large'] {\n &.qds-select {\n font: var(--qds-control-large-text);\n\n &:not([multiple]) {\n height: var(--qds-control-large-height);\n padding-inline-end: calc(\n var(--qds-control-large-icon-size) + var(--qds-text-icon-gap) +\n var(--qds-control-input-padding-horizontal)\n );\n }\n }\n\n &.qds-icon {\n height: var(--qds-control-large-icon-size);\n width: var(--qds-control-large-icon-size);\n }\n}\n","// SPDX-FileCopyrightText: © 2023 Schneider Electric\n//\n// SPDX-License-Identifier: LGPL-2.1-only\n\nimport type { ComponentInterface, EventEmitter } from '@stencil/core'\nimport {\n Component,\n Element,\n Event,\n h,\n Method,\n Prop,\n Watch,\n} from '@stencil/core'\n\nimport type {\n Attributes,\n QdsFocusEventDetail,\n QdsInputEventDetail,\n} from '../../helpers'\nimport {\n inheritAriaAttributes,\n inheritAttributes,\n invariant,\n pickFocusEventAttributes,\n pickInputEventAttributes,\n} from '../../helpers'\nimport type { AutoComplete, Value } from '../controls'\n\nexport type SelectSize = 'large' | 'small' | 'standard'\n\nlet autoIncrementingId = 1\n\n/**\n * The `<qds-select>` element represents a control that provides a menu of\n * options.\n *\n * @see https://quartz.se.com/build/components/select\n */\n@Component({\n tag: 'qds-select',\n scoped: true,\n styleUrl: 'select.css',\n})\nexport class Select implements ComponentInterface {\n /**\n * Defines if the select is in an invalid state. Validity is determined by\n * the `required` attribute using [constraint validation][].\n *\n * [constraint validation]: https://developer.mozilla.org/docs/Web/Guide/HTML/Constraint_validation\n */\n @Prop({ mutable: true, reflect: true }) public invalid = false\n\n /**\n * The select's size.\n *\n * > ***NOTE:*** The native [`size` HTML attribute] is not supported. CSS\n * `height` should be used instead if this functionality is needed.\n *\n * [`size` HTML attribute]: https://developer.mozilla.org/docs/Web/HTML/Attributes/size\n */\n @Prop({ reflect: true }) public readonly size: SelectSize = 'standard'\n\n /**\n * Provides a hint for a [user agent's][] autocomplete feature. See\n * [the HTML `autocomplete` attribute][] for a complete list of values and\n * details on how to use `autoComplete`.\n *\n * [user agent's]: https://developer.mozilla.org/docs/Glossary/User_agent\n * [the HTML `autocomplete` attribute]: https://developer.mozilla.org/docs/Web/HTML/Attributes/autocomplete\n *\n * @webnative\n */\n @Prop({ attribute: 'autocomplete' })\n public readonly autoComplete?: AutoComplete\n\n /**\n * Specify whether the select should have focus when the page loads.\n *\n * @webnative\n */\n @Prop({ attribute: 'autofocus' }) public readonly autoFocus?: boolean\n\n /**\n * Prevents the select from being interacted with: it cannot be pressed or\n * focused.\n *\n * @webnative\n */\n @Prop({ mutable: true, reflect: true }) public disabled?: boolean\n\n /**\n * The [`<form>`](https://developer.mozilla.org/docs/Web/HTML/Element/form)\n * element to associate the select with (its form owner).\n *\n * The value of this attribute must be the id of a `<form>` in the same\n * document. If this attribute is not set, the `<qds-select>` is associated\n * with its ancestor `<form>` element, if any.\n *\n * This attribute lets you associate `<qds-select>` elements to `<form>`s\n * anywhere in the document, not just inside a `<form>`. It can also override\n * an ancestor `<form>` element.\n *\n * @webnative\n */\n @Prop() public readonly form?: string\n\n /**\n * Indicates that multiple options can be selected in the list. If it is not\n * specified, then only one option can be selected at a time. When `multiple`\n * is specified, most browsers will show a scrolling list box instead of a\n * single line dropdown.\n *\n * @webnative\n */\n @Prop({ reflect: true }) public multiple?: boolean\n\n /**\n * The name of the input, which is submitted with the form data. An\n * incrementing input ID is used by default.\n *\n * @webnative\n */\n @Prop() public readonly name = `qds-input-${autoIncrementingId}`\n\n /**\n * An `<option>` with a non-empty string value must be selected before this\n * select can be submitted.\n *\n * See [Client-side validation] and the [HTML attribute: `required`] for more\n * information.\n *\n * [Client-side validation]: https://developer.mozilla.org/docs/Web/HTML/Element/input#client-side_validation\n * [HTML attribute: `required`]: https://developer.mozilla.org/docs/Web/HTML/Attributes/required\n *\n * @webnative\n */\n @Prop() public readonly required?: boolean\n\n /**\n * The value of the select.\n *\n * @webnative\n */\n @Prop({ mutable: true }) public value?: Value\n\n /**\n * Emitted when the select loses focus.\n */\n @Event({ eventName: 'qdsBlur', bubbles: false, cancelable: false })\n private readonly blurEmitter!: EventEmitter<QdsFocusEventDetail>\n\n /**\n * Emitted when an alteration to the select's value is committed by the\n * user.\n */\n @Event({ eventName: 'qdsChange', cancelable: false })\n private readonly changeEmitter!: EventEmitter<void>\n\n /**\n * Emitted when the select gains focus.\n */\n @Event({ eventName: 'qdsFocus', bubbles: false, cancelable: false })\n private readonly focusEmitter!: EventEmitter<QdsFocusEventDetail>\n\n /**\n * Emitted when the select's value changes.\n */\n @Event({ eventName: 'qdsInput', cancelable: false })\n private readonly inputEmitter!: EventEmitter<QdsInputEventDetail>\n\n @Element() private readonly element!: HTMLQdsSelectElement\n\n private inheritedAttributes: Attributes = {}\n\n private select?: HTMLSelectElement\n\n /**\n * Adds an element to the options collection.\n *\n * @param element The element to add.\n * @param before An element of the options collection or a zero-based index\n * representing the item the element should be added before. If this\n * parameter is not specified or the index does not exist, the new element is\n * appended to the end of the collection.\n */\n @Method()\n public async addItem(\n element: HTMLOptGroupElement | HTMLOptionElement,\n before?: HTMLElement | number,\n ): Promise<void> {\n invariant(this.select)\n\n this.select.add(element, before)\n }\n\n /**\n * Retrieves an element from the options collection by its index.\n *\n * @param index Zero-based index of the [`HTMLOptionElement`][] to retrieve.\n *\n * [`HTMLOptionElement`]: https://developer.mozilla.org/docs/Web/API/HTMLOptionElement\n */\n @Method()\n public async item(index: number): Promise<HTMLOptionElement | null> {\n invariant(this.select)\n\n return this.select.item(index)\n }\n\n /**\n * Retrieves an element from the options collection by its name.\n *\n * @param name The `name` or `id` property of the [`HTMLOptionElement`][] to\n * retrieve.\n *\n * [`HTMLOptionElement`]: https://developer.mozilla.org/docs/Web/API/HTMLOptionElement\n */\n @Method()\n public async namedItem(name: string): Promise<HTMLOptionElement | null> {\n invariant(this.select)\n\n return this.select.namedItem(name)\n }\n\n /**\n * Removes an element from the options collection.\n *\n * @param index Zero-based index of the [`HTMLOptionElement`][] to remove\n * from the collection. If the index is not found the method has no effect.\n *\n * [`HTMLOptionElement`]: https://developer.mozilla.org/docs/Web/API/HTMLOptionElement\n */\n @Method()\n public async removeItem(index: number): Promise<void> {\n invariant(this.select)\n\n this.select.remove(index)\n }\n\n /**\n * Sets a custom validity message for the select. If this message is not the\n * empty string, then the element is considered invalid.\n */\n @Method()\n public async setCustomValidity(message: string): Promise<void> {\n invariant(this.select)\n\n this.select.setCustomValidity(message)\n this.invalid = !this.select.checkValidity()\n }\n\n @Watch('disabled')\n protected disabledChanged(): void {\n invariant(this.select)\n\n // Disabled selects are always valid, so we need to recheck validity when\n // the state changes.\n this.select.disabled = this.disabled ?? false\n this.invalid = !this.select.checkValidity()\n }\n\n @Watch('value')\n protected valueChanged(): void {\n invariant(this.select)\n\n this.select.value = this.value === null ? '' : String(this.value)\n this.invalid = !this.select.checkValidity()\n }\n\n public componentWillLoad(): void {\n autoIncrementingId += 1\n this.inheritedAttributes = {\n ...inheritAriaAttributes(this.element),\n ...inheritAttributes(this.element, ['tabindex']),\n }\n }\n\n public render() {\n return (\n <div\n class={{\n 'qds-container': true,\n 'qds-multiple': this.multiple ?? false,\n }}\n data-size={this.size}\n >\n <select\n aria-invalid={this.invalid ? 'true' : 'false'}\n autoComplete={this.autoComplete}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={this.autoFocus}\n class=\"qds-select\"\n data-size={this.size}\n disabled={this.disabled}\n form={this.form}\n multiple={this.multiple}\n name={this.name}\n onBlur={this.onBlur}\n onChange={this.onChange}\n onFocus={this.onFocus}\n onInput={this.onInput}\n onInvalid={this.onInvalid}\n ref={this.ref}\n required={this.required}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...this.inheritedAttributes}\n >\n <slot />\n </select>\n {this.multiple !== true && (\n <qds-icon\n class=\"qds-icon\"\n data-size={this.size}\n library=\"core\"\n name=\"dropdown\"\n />\n )}\n </div>\n )\n }\n\n private readonly ref = (select?: HTMLSelectElement): void => {\n this.select = select\n }\n\n private readonly onBlur = (event: FocusEvent): void => {\n this.blurEmitter.emit(pickFocusEventAttributes(event))\n }\n\n private readonly onChange = (): void => {\n this.changeEmitter.emit()\n }\n\n private readonly onFocus = (event: FocusEvent): void => {\n this.focusEmitter.emit(pickFocusEventAttributes(event))\n }\n\n private readonly onInput = (event: InputEvent): void => {\n invariant(this.select)\n\n this.value = this.select.value\n\n this.inputEmitter.emit(pickInputEventAttributes(event))\n }\n\n private readonly onInvalid = (): void => {\n this.invalid = true\n }\n}\n"],"version":3}
|
|
@@ -148,13 +148,13 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
148
148
|
};
|
|
149
149
|
walk(children);
|
|
150
150
|
if (vnodeData) {
|
|
151
|
-
// normalize class / classname attributes
|
|
152
151
|
if (vnodeData.key) {
|
|
153
152
|
key = vnodeData.key;
|
|
154
153
|
}
|
|
155
154
|
if (vnodeData.name) {
|
|
156
155
|
slotName = vnodeData.name;
|
|
157
156
|
}
|
|
157
|
+
// normalize class / className attributes
|
|
158
158
|
{
|
|
159
159
|
const classData = vnodeData.className || vnodeData.class;
|
|
160
160
|
if (classData) {
|
|
@@ -400,7 +400,7 @@ const clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes
|
|
|
400
400
|
}
|
|
401
401
|
}
|
|
402
402
|
else if (childVNode.$hostId$ === hostId) {
|
|
403
|
-
// this comment node is
|
|
403
|
+
// this comment node is specifically for this host id
|
|
404
404
|
if (childNodeType === SLOT_NODE_ID) {
|
|
405
405
|
// `${SLOT_NODE_ID}.${hostId}.${nodeId}.${depth}.${index}.${slotName}`;
|
|
406
406
|
childVNode.$tag$ = 'slot';
|
|
@@ -641,6 +641,21 @@ const convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g
|
|
|
641
641
|
*
|
|
642
642
|
* Modified for Stencil's compiler and vdom
|
|
643
643
|
*/
|
|
644
|
+
/**
|
|
645
|
+
* When running a VDom render set properties present on a VDom node onto the
|
|
646
|
+
* corresponding HTML element.
|
|
647
|
+
*
|
|
648
|
+
* Note that this function has special functionality for the `class`,
|
|
649
|
+
* `style`, `key`, and `ref` attributes, as well as event handlers (like
|
|
650
|
+
* `onClick`, etc). All others are just passed through as-is.
|
|
651
|
+
*
|
|
652
|
+
* @param elm the HTMLElement onto which attributes should be set
|
|
653
|
+
* @param memberName the name of the attribute to set
|
|
654
|
+
* @param oldValue the old value for the attribute
|
|
655
|
+
* @param newValue the new value for the attribute
|
|
656
|
+
* @param isSvg whether we're in an svg context or not
|
|
657
|
+
* @param flags bitflags for Vdom variables
|
|
658
|
+
*/
|
|
644
659
|
const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
645
660
|
if (oldValue !== newValue) {
|
|
646
661
|
let isProp = isMemberInElement(elm, memberName);
|
|
@@ -1503,17 +1518,44 @@ const nullifyVNodeRefs = (vNode) => {
|
|
|
1503
1518
|
* @param hostRef data needed to root and render the virtual DOM tree, such as
|
|
1504
1519
|
* the DOM node into which it should be rendered.
|
|
1505
1520
|
* @param renderFnResults the virtual DOM nodes to be rendered
|
|
1521
|
+
* @param isInitialLoad whether or not this is the first call after page load
|
|
1506
1522
|
*/
|
|
1507
|
-
const renderVdom = (hostRef, renderFnResults) => {
|
|
1523
|
+
const renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
|
|
1508
1524
|
const hostElm = hostRef.$hostElement$;
|
|
1509
1525
|
const cmpMeta = hostRef.$cmpMeta$;
|
|
1510
1526
|
const oldVNode = hostRef.$vnode$ || newVNode(null, null);
|
|
1527
|
+
// if `renderFnResults` is a Host node then we can use it directly. If not,
|
|
1528
|
+
// we need to call `h` again to wrap the children of our component in a
|
|
1529
|
+
// 'dummy' Host node (well, an empty vnode) since `renderVdom` assumes
|
|
1530
|
+
// implicitly that the top-level vdom node is 1) an only child and 2)
|
|
1531
|
+
// contains attrs that need to be set on the host element.
|
|
1511
1532
|
const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
|
|
1512
1533
|
hostTagName = hostElm.tagName;
|
|
1513
1534
|
if (cmpMeta.$attrsToReflect$) {
|
|
1514
1535
|
rootVnode.$attrs$ = rootVnode.$attrs$ || {};
|
|
1515
1536
|
cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
|
|
1516
1537
|
}
|
|
1538
|
+
// On the first render and *only* on the first render we want to check for
|
|
1539
|
+
// any attributes set on the host element which are also set on the vdom
|
|
1540
|
+
// node. If we find them, we override the value on the VDom node attrs with
|
|
1541
|
+
// the value from the host element, which allows developers building apps
|
|
1542
|
+
// with Stencil components to override e.g. the `role` attribute on a
|
|
1543
|
+
// component even if it's already set on the `Host`.
|
|
1544
|
+
if (isInitialLoad && rootVnode.$attrs$) {
|
|
1545
|
+
for (const key of Object.keys(rootVnode.$attrs$)) {
|
|
1546
|
+
// We have a special implementation in `setAccessor` for `style` and
|
|
1547
|
+
// `class` which reconciles values coming from the VDom with values
|
|
1548
|
+
// already present on the DOM element, so we don't want to override those
|
|
1549
|
+
// attributes on the VDom tree with values from the host element if they
|
|
1550
|
+
// are present.
|
|
1551
|
+
//
|
|
1552
|
+
// Likewise, `ref` and `key` are special internal values for the Stencil
|
|
1553
|
+
// runtime and we don't want to override those either.
|
|
1554
|
+
if (hostElm.hasAttribute(key) && !['key', 'ref', 'style', 'class'].includes(key)) {
|
|
1555
|
+
rootVnode.$attrs$[key] = hostElm[key];
|
|
1556
|
+
}
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1517
1559
|
rootVnode.$tag$ = null;
|
|
1518
1560
|
rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
|
|
1519
1561
|
hostRef.$vnode$ = rootVnode;
|
|
@@ -1580,7 +1622,7 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
1580
1622
|
// has a different next sibling or parent relocated
|
|
1581
1623
|
if (nodeToRelocate !== insertBeforeNode) {
|
|
1582
1624
|
if (!nodeToRelocate['s-hn'] && nodeToRelocate['s-ol']) {
|
|
1583
|
-
// probably a component in the index.html that doesn't have
|
|
1625
|
+
// probably a component in the index.html that doesn't have its hostname set
|
|
1584
1626
|
nodeToRelocate['s-hn'] = nodeToRelocate['s-ol'].parentNode.nodeName;
|
|
1585
1627
|
}
|
|
1586
1628
|
// add it back to the dom but in its new home
|
|
@@ -1701,6 +1743,16 @@ const enqueue = (maybePromise, fn) => isPromisey(maybePromise) ? maybePromise.th
|
|
|
1701
1743
|
*/
|
|
1702
1744
|
const isPromisey = (maybePromise) => maybePromise instanceof Promise ||
|
|
1703
1745
|
(maybePromise && maybePromise.then && typeof maybePromise.then === 'function');
|
|
1746
|
+
/**
|
|
1747
|
+
* Update a component given reference to its host elements and so on.
|
|
1748
|
+
*
|
|
1749
|
+
* @param hostRef an object containing references to the element's host node,
|
|
1750
|
+
* VDom nodes, and other metadata
|
|
1751
|
+
* @param instance a reference to the underlying host element where it will be
|
|
1752
|
+
* rendered
|
|
1753
|
+
* @param isInitialLoad whether or not this function is being called as part of
|
|
1754
|
+
* the first render cycle
|
|
1755
|
+
*/
|
|
1704
1756
|
const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
1705
1757
|
var _a;
|
|
1706
1758
|
const elm = hostRef.$hostElement$;
|
|
@@ -1712,7 +1764,7 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
1712
1764
|
}
|
|
1713
1765
|
const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
|
|
1714
1766
|
{
|
|
1715
|
-
callRender(hostRef, instance);
|
|
1767
|
+
callRender(hostRef, instance, elm, isInitialLoad);
|
|
1716
1768
|
}
|
|
1717
1769
|
if (rc) {
|
|
1718
1770
|
// ok, so turns out there are some child host elements
|
|
@@ -1736,7 +1788,19 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
1736
1788
|
}
|
|
1737
1789
|
}
|
|
1738
1790
|
};
|
|
1739
|
-
|
|
1791
|
+
/**
|
|
1792
|
+
* Handle making the call to the VDom renderer with the proper context given
|
|
1793
|
+
* various build variables
|
|
1794
|
+
*
|
|
1795
|
+
* @param hostRef an object containing references to the element's host node,
|
|
1796
|
+
* VDom nodes, and other metadata
|
|
1797
|
+
* @param instance a reference to the underlying host element where it will be
|
|
1798
|
+
* rendered
|
|
1799
|
+
* @param elm the Host element for the component
|
|
1800
|
+
* @param isInitialLoad whether or not this function is being called as part of
|
|
1801
|
+
* @returns an empty promise
|
|
1802
|
+
*/
|
|
1803
|
+
const callRender = (hostRef, instance, elm, isInitialLoad) => {
|
|
1740
1804
|
try {
|
|
1741
1805
|
instance = instance.render() ;
|
|
1742
1806
|
{
|
|
@@ -1751,7 +1815,7 @@ const callRender = (hostRef, instance, elm) => {
|
|
|
1751
1815
|
// or we need to update the css class/attrs on the host element
|
|
1752
1816
|
// DOM WRITE!
|
|
1753
1817
|
{
|
|
1754
|
-
renderVdom(hostRef, instance);
|
|
1818
|
+
renderVdom(hostRef, instance, isInitialLoad);
|
|
1755
1819
|
}
|
|
1756
1820
|
}
|
|
1757
1821
|
}
|
|
@@ -1930,12 +1994,12 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1930
1994
|
// customElements.define('my-component', MyComponent);
|
|
1931
1995
|
// </script>
|
|
1932
1996
|
// ```
|
|
1933
|
-
// In this case if we do not
|
|
1997
|
+
// In this case if we do not un-shadow here and use the value of the shadowing property, attributeChangedCallback
|
|
1934
1998
|
// will be called with `newValue = "some-value"` and will set the shadowed property (this.someAttribute = "another-value")
|
|
1935
1999
|
// to the value that was set inline i.e. "some-value" from above example. When
|
|
1936
|
-
// the connectedCallback attempts to
|
|
2000
|
+
// the connectedCallback attempts to un-shadow it will use "some-value" as the initial value rather than "another-value"
|
|
1937
2001
|
//
|
|
1938
|
-
// The case where the attribute was NOT set inline but was not set programmatically shall be handled/
|
|
2002
|
+
// The case where the attribute was NOT set inline but was not set programmatically shall be handled/un-shadowed
|
|
1939
2003
|
// by connectedCallback as this attributeChangedCallback will not fire.
|
|
1940
2004
|
//
|
|
1941
2005
|
// https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
|
|
@@ -2052,6 +2116,8 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
2052
2116
|
schedule();
|
|
2053
2117
|
}
|
|
2054
2118
|
};
|
|
2119
|
+
const fireConnectedCallback = (instance) => {
|
|
2120
|
+
};
|
|
2055
2121
|
const connectedCallback = (elm) => {
|
|
2056
2122
|
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
|
2057
2123
|
const hostRef = getHostRef(elm);
|
|
@@ -2119,6 +2185,11 @@ const connectedCallback = (elm) => {
|
|
|
2119
2185
|
// reattach any event listeners to the host
|
|
2120
2186
|
// since they would have been removed when disconnected
|
|
2121
2187
|
addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
|
|
2188
|
+
// fire off connectedCallback() on component instance
|
|
2189
|
+
if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$lazyInstance$) ;
|
|
2190
|
+
else if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$onReadyPromise$) {
|
|
2191
|
+
hostRef.$onReadyPromise$.then(() => fireConnectedCallback());
|
|
2192
|
+
}
|
|
2122
2193
|
}
|
|
2123
2194
|
endConnected();
|
|
2124
2195
|
}
|
|
@@ -2134,18 +2205,25 @@ const setContentReference = (elm) => {
|
|
|
2134
2205
|
contentRefElm['s-cn'] = true;
|
|
2135
2206
|
elm.insertBefore(contentRefElm, elm.firstChild);
|
|
2136
2207
|
};
|
|
2137
|
-
const
|
|
2208
|
+
const disconnectInstance = (instance) => {
|
|
2209
|
+
{
|
|
2210
|
+
safeCall(instance, 'disconnectedCallback');
|
|
2211
|
+
}
|
|
2212
|
+
};
|
|
2213
|
+
const disconnectedCallback = async (elm) => {
|
|
2138
2214
|
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
|
2139
2215
|
const hostRef = getHostRef(elm);
|
|
2140
|
-
const instance = hostRef.$lazyInstance$ ;
|
|
2141
2216
|
{
|
|
2142
2217
|
if (hostRef.$rmListeners$) {
|
|
2143
2218
|
hostRef.$rmListeners$.map((rmListener) => rmListener());
|
|
2144
2219
|
hostRef.$rmListeners$ = undefined;
|
|
2145
2220
|
}
|
|
2146
2221
|
}
|
|
2147
|
-
{
|
|
2148
|
-
|
|
2222
|
+
if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$lazyInstance$) {
|
|
2223
|
+
disconnectInstance(hostRef.$lazyInstance$);
|
|
2224
|
+
}
|
|
2225
|
+
else if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$onReadyPromise$) {
|
|
2226
|
+
hostRef.$onReadyPromise$.then(() => disconnectInstance(hostRef.$lazyInstance$));
|
|
2149
2227
|
}
|
|
2150
2228
|
}
|
|
2151
2229
|
};
|
|
@@ -2418,4 +2496,4 @@ exports.promiseResolve = promiseResolve;
|
|
|
2418
2496
|
exports.registerInstance = registerInstance;
|
|
2419
2497
|
exports.setNonce = setNonce;
|
|
2420
2498
|
|
|
2421
|
-
//# sourceMappingURL=index-
|
|
2499
|
+
//# sourceMappingURL=index-210f861c.js.map
|