@limetech/lime-elements 37.23.0 → 37.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js +1 -1
- package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-select.cjs.entry.js +25 -6
- package/dist/cjs/limel-select.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-text-editor.cjs.entry.js +8 -2
- package/dist/cjs/limel-text-editor.cjs.entry.js.map +1 -1
- package/dist/collection/components/select/select.js +16 -5
- package/dist/collection/components/select/select.js.map +1 -1
- package/dist/collection/components/select/select.template.js +19 -3
- package/dist/collection/components/select/select.template.js.map +1 -1
- package/dist/collection/components/text-editor/prosemirror-adapter/prosemirror-adapter.css +73 -82
- package/dist/collection/components/text-editor/text-editor.css +172 -4
- package/dist/collection/components/text-editor/text-editor.js +7 -1
- package/dist/collection/components/text-editor/text-editor.js.map +1 -1
- package/dist/collection/style/internal/fieldset.scss +62 -0
- package/dist/esm/limel-prosemirror-adapter.entry.js +1 -1
- package/dist/esm/limel-prosemirror-adapter.entry.js.map +1 -1
- package/dist/esm/limel-select.entry.js +25 -6
- package/dist/esm/limel-select.entry.js.map +1 -1
- package/dist/esm/limel-text-editor.entry.js +8 -2
- package/dist/esm/limel-text-editor.entry.js.map +1 -1
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/p-20d07aab.entry.js +68 -0
- package/dist/lime-elements/p-20d07aab.entry.js.map +1 -0
- package/dist/lime-elements/{p-5b2e8739.entry.js → p-60317f5c.entry.js} +2 -2
- package/dist/lime-elements/{p-5b2e8739.entry.js.map → p-60317f5c.entry.js.map} +1 -1
- package/dist/lime-elements/p-f1e1f867.entry.js +2 -0
- package/dist/lime-elements/p-f1e1f867.entry.js.map +1 -0
- package/dist/lime-elements/style/internal/fieldset.scss +62 -0
- package/dist/types/components/select/select.d.ts +4 -1
- package/dist/types/components/select/select.template.d.ts +2 -2
- package/dist/types/components/text-editor/text-editor.d.ts +1 -0
- package/dist/types/components.d.ts +6 -2
- package/package.json +3 -3
- package/dist/lime-elements/p-6fb481ea.entry.js +0 -68
- package/dist/lime-elements/p-6fb481ea.entry.js.map +0 -1
- package/dist/lime-elements/p-caf959fe.entry.js +0 -2
- package/dist/lime-elements/p-caf959fe.entry.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.template.js","sourceRoot":"","sources":["../../../src/components/select/select.template.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAuB,CAAC,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AA2BnE,MAAM,CAAC,MAAM,cAAc,GAA6C,CACpE,KAAK,EACP,EAAE;EACA,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;EAC1B,IAAI,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC;EAC7B,IAAI,YAAY,GAAG,IAAI,CAAC;EACxB,IAAI,UAAU,CAAC,KAAK,CAAC,EAAE;IACnB,QAAQ,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;GAC/B;OAAM,IAAI,QAAQ,EAAE;IACjB,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC;IACzB,YAAY,GAAG,KAAK,CAAC,IAAI,KAAK,EAAE,CAAC;GACpC;EAED,IAAI,OAAO,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC;EAC7B,IAAI,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,QAAQ,IAAI,CAAC,QAAQ,EAAE;IACjD,OAAO,GAAG,KAAK,CAAC;GACnB;EAED,MAAM,SAAS,GAAG;IACd,cAAc,EAAE,IAAI;IACpB,YAAY,EAAE,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tB,CAAC;AAED,SAAS,eAAe,CAAC,KAAU;EAC/B,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE;IACvB,OAAO,EAAE,CAAC;GACb;EAED,MAAM,IAAI,GAAG,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;EACrC,MAAM,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;EACxD,MAAM,KAAK,GAAQ,EAAE,CAAC;EACtB,IAAI,KAAK,EAAE;IACP,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;GACvB;EAED,OAAO,CACH,kBACI,KAAK,EAAC,qCAAqC,EAC3C,IAAI,EAAE,IAAI,EACV,IAAI,EAAC,QAAQ,EACb,KAAK,EAAE,KAAK,GACd,CACL,CAAC;AACN,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,OAAiB;EACrD,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;IACvB,IAAI,MAAM,CAAC,SAAS,EAAE;MAClB,yCAAyC;MACzC,OAAO,CAAC,IAAI,CACR,sKAAsK,CACzK,CAAC;KACL;EACL,CAAC,CAAC,CAAC;AACP,CAAC","sourcesContent":["import { ListItem } from '../list/list-item.types';\nimport { Option } from '../select/option.types';\nimport { FunctionalComponent, h } from '@stencil/core';\nimport { isMultiple } from '../../util/multiple';\nimport { getIconColor, getIconName } from '../icon/get-icon-props';\n\ninterface SelectTemplateProps {\n disabled?: boolean;\n readonly?: boolean;\n required?: boolean;\n invalid?: boolean;\n options: Option[];\n value: Option | Option[];\n label?: string;\n helperText?: string;\n multiple?: boolean;\n native: boolean;\n\n onNativeChange: (event: Event) => void;\n\n id: string;\n onMenuChange: (event: CustomEvent<ListItem | ListItem[]>) => void;\n onTriggerPress: (event: KeyboardEvent) => void;\n isOpen: boolean;\n open: () => void;\n close: () => void;\n checkValid: boolean;\n\n dropdownZIndex: string;\n}\n\nexport const SelectTemplate: FunctionalComponent<SelectTemplateProps> = (\n props,\n) => {\n const value = props.value;\n let hasValue = !!props.value;\n let hasEmptyText = true;\n if (isMultiple(value)) {\n hasValue = value.length > 0;\n } else if (hasValue) {\n hasValue = !!value.value;\n hasEmptyText = value.text === '';\n }\n\n let isValid = !props.invalid;\n if (props.checkValid && props.required && !hasValue) {\n isValid = false;\n }\n\n const classList = {\n 'limel-select': true,\n 'mdc-select': true,\n 'mdc-select--outlined': true,\n 'mdc-select--disabled': props.disabled,\n 'limel-select--readonly': props.readonly,\n 'limel-select--required': props.required,\n 'limel-select--invalid': !isValid,\n 'limel-select--empty': !hasValue,\n 'limel-select--with-helper-text': typeof props.helperText === 'string',\n };\n\n return (\n <div class={classList}>\n <SelectValue\n {...props}\n hasValue={hasValue}\n isValid={isValid}\n hasEmptyText={hasEmptyText}\n />\n <HelperText text={props.helperText} isValid={!props.invalid} />\n <SelectDropdown {...props} />\n </div>\n );\n};\n\nconst SelectValue: FunctionalComponent<\n SelectTemplateProps & {\n hasValue: boolean;\n isValid: boolean;\n hasEmptyText: boolean;\n }\n> = (props) => {\n const anchorClassList = {\n 'mdc-select__anchor': true,\n 'limel-select-trigger': true,\n 'limel-select--focused': props.isOpen,\n };\n const labelClassList = {\n 'mdc-floating-label': true,\n 'mdc-floating-label--float-above':\n !props.hasEmptyText ||\n props.isOpen ||\n props.readonly ||\n props.hasValue,\n 'mdc-floating-label--active': props.isOpen,\n };\n\n return (\n <button\n class={anchorClassList}\n onClick={props.open}\n onKeyPress={props.onTriggerPress}\n aria-haspopup=\"listbox\"\n aria-expanded={props.isOpen}\n aria-controls={props.id}\n aria-labelledby=\"s-label s-selected-text\"\n aria-required={props.required}\n disabled={props.disabled || props.readonly}\n >\n <span id=\"s-label\" class={labelClassList}>\n {props.label}\n </span>\n <span class=\"mdc-select__selected-text-container limel-select__selected-option\">\n {getSelectedIcon(props.value)}\n <span\n id=\"s-selected-text\"\n class=\"mdc-select__selected-text limel-select__selected-option__text\"\n >\n {getSelectedText(props.value, props.readonly)}\n </span>\n </span>\n <ShowIcon {...props} isValid={props.isValid} />\n <span class=\"mdc-select__dropdown-icon\">\n <svg\n class=\"mdc-select__dropdown-icon-graphic\"\n viewBox=\"7 10 10 5\"\n focusable=\"false\"\n >\n <polygon\n stroke=\"none\"\n fill-rule=\"evenodd\"\n points=\"7 10 12 15 17 10\"\n ></polygon>\n </svg>\n </span>\n </button>\n );\n};\n\nconst ShowIcon: FunctionalComponent<\n SelectTemplateProps & {\n isValid: boolean;\n }\n> = (props) => {\n if (props.isValid) {\n return;\n }\n\n return (\n <limel-icon name=\"high_importance\" size=\"medium\" class=\"invalid-icon\" />\n );\n};\n\nconst HelperText: FunctionalComponent<{ text: string; isValid: boolean }> = (\n props,\n) => {\n if (typeof props.text !== 'string') {\n return;\n }\n\n return (\n <limel-helper-line\n helperText={props.text.trim()}\n invalid={!props.isValid}\n />\n );\n};\n\nconst SelectDropdown: FunctionalComponent<SelectTemplateProps> = (props) => {\n if (props.native) {\n return <NativeDropdown {...props} />;\n }\n\n return <MenuDropdown {...props} />;\n};\n\nconst MenuDropdown: FunctionalComponent<SelectTemplateProps> = (props) => {\n const items = createMenuItems(props.options, props.value, props.required);\n\n return (\n <limel-portal\n containerId={props.id}\n visible={props.isOpen}\n inheritParentWidth={true}\n containerStyle={{ 'z-index': props.dropdownZIndex }}\n >\n <limel-menu-surface\n open={props.isOpen}\n onDismiss={props.close}\n style={{\n '--mdc-menu-min-width': '100%',\n 'max-height': 'inherit',\n display: 'flex',\n 'min-width': '100%',\n width: 'fit-content',\n }}\n >\n <limel-list\n items={items}\n type={props.multiple ? 'checkbox' : 'selectable'}\n onChange={props.onMenuChange}\n />\n </limel-menu-surface>\n </limel-portal>\n );\n};\n\nconst NativeDropdown: FunctionalComponent<SelectTemplateProps> = (props) => {\n return (\n <select\n required={props.required}\n aria-disabled={props.disabled}\n aria-required={props.required}\n onChange={props.onNativeChange}\n onFocus={props.open}\n onBlur={props.close}\n class=\"limel-select__native-control\"\n disabled={props.disabled}\n multiple={props.multiple}\n >\n {props.options.map((option) => {\n return (\n <option\n key={option.value}\n value={option.value}\n selected={isSelected(option, props.value)}\n disabled={option.disabled}\n >\n {option.text}\n </option>\n );\n })}\n </select>\n );\n};\n\nfunction isSelected(option: Option, value: Option | Option[]): boolean {\n if (!value) {\n return false;\n }\n\n if (isMultiple(value)) {\n return value.some((o) => option.value === o.value);\n }\n\n return option.value === value.value;\n}\n\nfunction createMenuItems(\n options: Option[],\n value: Option | Option[],\n selectIsRequired = false,\n): Array<ListItem<Option>> {\n const menuOptionFilter = getMenuOptionFilter(selectIsRequired);\n\n return options.filter(menuOptionFilter).map((option) => {\n const selected = isSelected(option, value);\n const { text, secondaryText, disabled } = option;\n const name = getIconName(option.icon);\n const color = getIconColor(option.icon, option.iconColor);\n\n if (!name) {\n return {\n text: text,\n secondaryText: secondaryText,\n selected: selected,\n disabled: disabled,\n value: option,\n };\n }\n\n return {\n text: text,\n secondaryText: secondaryText,\n selected: selected,\n disabled: disabled,\n value: option,\n icon: {\n name: name,\n color: color,\n },\n };\n });\n}\n\nfunction getMenuOptionFilter(selectIsRequired: boolean) {\n return (option: Option) => {\n if (!selectIsRequired) {\n // If the select component is NOT required, we keep all options.\n return true;\n }\n\n if (option.text) {\n // If the select component IS required, we keep only options\n // that are not \"empty\". We only check the text property, because\n // some systems use an \"empty option\" that will have a value for\n // the `value` property, to signify \"no option selected\". Such\n // an option should be treated as \"empty\".\n return true;\n }\n };\n}\n\nfunction getSelectedText(value: Option | Option[], readonly: boolean): string {\n if ((!value || (isMultiple(value) && !value.length)) && readonly) {\n return '–';\n }\n\n if (!value) {\n return '';\n }\n\n if (isMultiple(value)) {\n return value.map((option) => option.text).join(', ');\n }\n\n return value.text;\n}\n\nfunction getSelectedIcon(value: any) {\n if (!value || !value.icon) {\n return '';\n }\n\n const name = getIconName(value.icon);\n const color = getIconColor(value.icon, value.iconColor);\n const style: any = {};\n if (color) {\n style.color = color;\n }\n\n return (\n <limel-icon\n class=\"limel-select__selected-option__icon\"\n name={name}\n size=\"medium\"\n style={style}\n />\n );\n}\n\nexport function triggerIconColorWarning(options: Option[]) {\n options.forEach((option) => {\n if (option.iconColor) {\n /* eslint-disable-next-line no-console */\n console.warn(\n \"The `iconColor` prop is deprecated now! Use the new `Icon` interface and instead of `iconColor: 'color-name'` write `icon {name: 'icon-name', color: 'color-name'}`.\",\n );\n }\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"select.template.js","sourceRoot":"","sources":["../../../src/components/select/select.template.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAuB,CAAC,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AA2BnE,MAAM,CAAC,MAAM,cAAc,GAA6C,CACpE,KAAK,EACP,EAAE;EACA,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;EAC1B,IAAI,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC;EAC7B,IAAI,YAAY,GAAG,IAAI,CAAC;EACxB,IAAI,UAAU,CAAC,KAAK,CAAC,EAAE;IACnB,QAAQ,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;GAC/B;OAAM,IAAI,QAAQ,EAAE;IACjB,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC;IACzB,YAAY,GAAG,KAAK,CAAC,IAAI,KAAK,EAAE,CAAC;GACpC;EAED,IAAI,OAAO,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC;EAC7B,IAAI,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,QAAQ,IAAI,CAAC,QAAQ,EAAE;IACjD,OAAO,GAAG,KAAK,CAAC;GACnB;EAED,MAAM,SAAS,GAAG;IACd,cAAc,EAAE,IAAI;IACpB,YAAY,EAAE,IAAI;IAClB,sBAAsB,EAAE,I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port { Option } from '../select/option.types';\nimport { FunctionalComponent, h } from '@stencil/core';\nimport { isMultiple } from '../../util/multiple';\nimport { getIconColor, getIconName } from '../icon/get-icon-props';\n\ninterface SelectTemplateProps {\n disabled?: boolean;\n readonly?: boolean;\n required?: boolean;\n invalid?: boolean;\n options: Array<Option | ListSeparator>;\n value: Option | Option[];\n label?: string;\n helperText?: string;\n multiple?: boolean;\n native: boolean;\n\n onNativeChange: (event: Event) => void;\n\n id: string;\n onMenuChange: (event: CustomEvent<ListItem | ListItem[]>) => void;\n onTriggerPress: (event: KeyboardEvent) => void;\n isOpen: boolean;\n open: () => void;\n close: () => void;\n checkValid: boolean;\n\n dropdownZIndex: string;\n}\n\nexport const SelectTemplate: FunctionalComponent<SelectTemplateProps> = (\n props,\n) => {\n const value = props.value;\n let hasValue = !!props.value;\n let hasEmptyText = true;\n if (isMultiple(value)) {\n hasValue = value.length > 0;\n } else if (hasValue) {\n hasValue = !!value.value;\n hasEmptyText = value.text === '';\n }\n\n let isValid = !props.invalid;\n if (props.checkValid && props.required && !hasValue) {\n isValid = false;\n }\n\n const classList = {\n 'limel-select': true,\n 'mdc-select': true,\n 'mdc-select--outlined': true,\n 'mdc-select--disabled': props.disabled,\n 'limel-select--readonly': props.readonly,\n 'limel-select--required': props.required,\n 'limel-select--invalid': !isValid,\n 'limel-select--empty': !hasValue,\n 'limel-select--with-helper-text': typeof props.helperText === 'string',\n };\n\n return (\n <div class={classList}>\n <SelectValue\n {...props}\n hasValue={hasValue}\n isValid={isValid}\n hasEmptyText={hasEmptyText}\n />\n <HelperText text={props.helperText} isValid={!props.invalid} />\n <SelectDropdown {...props} />\n </div>\n );\n};\n\nconst SelectValue: FunctionalComponent<\n SelectTemplateProps & {\n hasValue: boolean;\n isValid: boolean;\n hasEmptyText: boolean;\n }\n> = (props) => {\n const anchorClassList = {\n 'mdc-select__anchor': true,\n 'limel-select-trigger': true,\n 'limel-select--focused': props.isOpen,\n };\n const labelClassList = {\n 'mdc-floating-label': true,\n 'mdc-floating-label--float-above':\n !props.hasEmptyText ||\n props.isOpen ||\n props.readonly ||\n props.hasValue,\n 'mdc-floating-label--active': props.isOpen,\n };\n\n return (\n <button\n class={anchorClassList}\n onClick={props.open}\n onKeyPress={props.onTriggerPress}\n aria-haspopup=\"listbox\"\n aria-expanded={props.isOpen}\n aria-controls={props.id}\n aria-labelledby=\"s-label s-selected-text\"\n aria-required={props.required}\n disabled={props.disabled || props.readonly}\n >\n <span id=\"s-label\" class={labelClassList}>\n {props.label}\n </span>\n <span class=\"mdc-select__selected-text-container limel-select__selected-option\">\n {getSelectedIcon(props.value)}\n <span\n id=\"s-selected-text\"\n class=\"mdc-select__selected-text limel-select__selected-option__text\"\n >\n {getSelectedText(props.value, props.readonly)}\n </span>\n </span>\n <ShowIcon {...props} isValid={props.isValid} />\n <span class=\"mdc-select__dropdown-icon\">\n <svg\n class=\"mdc-select__dropdown-icon-graphic\"\n viewBox=\"7 10 10 5\"\n focusable=\"false\"\n >\n <polygon\n stroke=\"none\"\n fill-rule=\"evenodd\"\n points=\"7 10 12 15 17 10\"\n ></polygon>\n </svg>\n </span>\n </button>\n );\n};\n\nconst ShowIcon: FunctionalComponent<\n SelectTemplateProps & {\n isValid: boolean;\n }\n> = (props) => {\n if (props.isValid) {\n return;\n }\n\n return (\n <limel-icon name=\"high_importance\" size=\"medium\" class=\"invalid-icon\" />\n );\n};\n\nconst HelperText: FunctionalComponent<{ text: string; isValid: boolean }> = (\n props,\n) => {\n if (typeof props.text !== 'string') {\n return;\n }\n\n return (\n <limel-helper-line\n helperText={props.text.trim()}\n invalid={!props.isValid}\n />\n );\n};\n\nconst SelectDropdown: FunctionalComponent<SelectTemplateProps> = (props) => {\n if (props.native) {\n return <NativeDropdown {...props} />;\n }\n\n return <MenuDropdown {...props} />;\n};\n\nconst MenuDropdown: FunctionalComponent<SelectTemplateProps> = (props) => {\n const items = createMenuItems(props.options, props.value, props.required);\n\n return (\n <limel-portal\n containerId={props.id}\n visible={props.isOpen}\n inheritParentWidth={true}\n containerStyle={{ 'z-index': props.dropdownZIndex }}\n >\n <limel-menu-surface\n open={props.isOpen}\n onDismiss={props.close}\n style={{\n '--mdc-menu-min-width': '100%',\n 'max-height': 'inherit',\n display: 'flex',\n 'min-width': '100%',\n width: 'fit-content',\n }}\n >\n <limel-list\n items={items}\n type={props.multiple ? 'checkbox' : 'selectable'}\n onChange={props.onMenuChange}\n />\n </limel-menu-surface>\n </limel-portal>\n );\n};\n\nconst NativeDropdown: FunctionalComponent<SelectTemplateProps> = (props) => {\n const options = props.options\n .filter((option): option is Option => !('separator' in option))\n .map(renderOption(props.value));\n\n return (\n <select\n required={props.required}\n aria-disabled={props.disabled}\n aria-required={props.required}\n onChange={props.onNativeChange}\n onFocus={props.open}\n onBlur={props.close}\n class=\"limel-select__native-control\"\n disabled={props.disabled}\n multiple={props.multiple}\n >\n {options}\n </select>\n );\n};\n\nconst renderOption = (selectedOption: Option | Option[]) => {\n return (option: Option) => {\n const { value, disabled, text } = option;\n\n return (\n <option\n key={value}\n value={value}\n selected={isSelected(option, selectedOption)}\n disabled={disabled}\n >\n {text}\n </option>\n );\n };\n};\n\nfunction isSelected(option: Option, value: Option | Option[]): boolean {\n if (!value) {\n return false;\n }\n\n if (isMultiple(value)) {\n return value.some((o) => option.value === o.value);\n }\n\n return option.value === value.value;\n}\n\nfunction createMenuItems(\n options: Array<Option | ListSeparator>,\n value: Option | Option[],\n selectIsRequired = false,\n): Array<ListItem<Option> | ListSeparator> {\n const menuOptionFilter = getMenuOptionFilter(selectIsRequired);\n\n return options.filter(menuOptionFilter).map((option) => {\n if ('separator' in option) {\n return {\n text: option.text,\n separator: true,\n };\n }\n\n const selected = isSelected(option, value);\n const { text, secondaryText, disabled } = option;\n const name = getIconName(option.icon);\n const color = getIconColor(option.icon, option.iconColor);\n\n if (!name) {\n return {\n text: text,\n secondaryText: secondaryText,\n selected: selected,\n disabled: disabled,\n value: option,\n };\n }\n\n return {\n text: text,\n secondaryText: secondaryText,\n selected: selected,\n disabled: disabled,\n value: option,\n icon: {\n name: name,\n color: color,\n },\n };\n });\n}\n\nfunction getMenuOptionFilter(selectIsRequired: boolean) {\n return (option: Option | ListSeparator) => {\n if (!selectIsRequired) {\n // If the select component is NOT required, we keep all options.\n return true;\n }\n\n if (option.text) {\n // If the select component IS required, we keep only options\n // that are not \"empty\". We only check the text property, because\n // some systems use an \"empty option\" that will have a value for\n // the `value` property, to signify \"no option selected\". Such\n // an option should be treated as \"empty\".\n return true;\n }\n\n if ('separator' in option) {\n return true;\n }\n };\n}\n\nfunction getSelectedText(value: Option | Option[], readonly: boolean): string {\n if ((!value || (isMultiple(value) && !value.length)) && readonly) {\n return '–';\n }\n\n if (!value) {\n return '';\n }\n\n if (isMultiple(value)) {\n return value.map((option) => option.text).join(', ');\n }\n\n return value.text;\n}\n\nfunction getSelectedIcon(value: any) {\n if (!value || !value.icon) {\n return '';\n }\n\n const name = getIconName(value.icon);\n const color = getIconColor(value.icon, value.iconColor);\n const style: any = {};\n if (color) {\n style.color = color;\n }\n\n return (\n <limel-icon\n class=\"limel-select__selected-option__icon\"\n name={name}\n size=\"medium\"\n style={style}\n />\n );\n}\n\nexport function triggerIconColorWarning(options: Option[]) {\n options.forEach((option) => {\n if (option.iconColor) {\n /* eslint-disable-next-line no-console */\n console.warn(\n \"The `iconColor` prop is deprecated now! Use the new `Icon` interface and instead of `iconColor: 'color-name'` write `icon {name: 'icon-name', color: 'color-name'}`.\",\n );\n }\n });\n}\n"]}
|
|
@@ -1,71 +1,5 @@
|
|
|
1
1
|
@charset "UTF-8";
|
|
2
|
-
|
|
3
|
-
* This file is imported into every component!
|
|
4
|
-
*
|
|
5
|
-
* Nothing in this file may output any CSS
|
|
6
|
-
* without being explicitly called by outside code.
|
|
7
|
-
*/
|
|
8
|
-
/*
|
|
9
|
-
* This file is imported into every component that uses MDC!
|
|
10
|
-
*
|
|
11
|
-
* Anything in this file that generates CSS output on its own,
|
|
12
|
-
* without being explicitly used, will output that CSS in every
|
|
13
|
-
* single component, increasing the size of the production build.
|
|
14
|
-
* Avoid that unless there's very good reason for it!
|
|
15
|
-
*/
|
|
16
|
-
/*
|
|
17
|
-
* This file is imported into every component that uses MDC!
|
|
18
|
-
*
|
|
19
|
-
* Anything in this file that generates CSS output on its own,
|
|
20
|
-
* without being explicitly used, will output that CSS in every
|
|
21
|
-
* single component, increasing the size of the production build.
|
|
22
|
-
* Avoid that unless there's very good reason for it!
|
|
23
|
-
*/
|
|
24
|
-
:host {
|
|
25
|
-
--mdc-theme-primary: var(
|
|
26
|
-
--lime-primary-color,
|
|
27
|
-
rgb(var(--color-teal-default))
|
|
28
|
-
);
|
|
29
|
-
--mdc-theme-secondary: var(
|
|
30
|
-
--lime-secondary-color,
|
|
31
|
-
rgb(var(--contrast-1100))
|
|
32
|
-
);
|
|
33
|
-
--mdc-theme-on-primary: var(
|
|
34
|
-
--lime-on-primary-color,
|
|
35
|
-
rgb(var(--contrast-100))
|
|
36
|
-
);
|
|
37
|
-
--mdc-theme-on-secondary: var(
|
|
38
|
-
--lime-on-secondary-color,
|
|
39
|
-
rgb(var(--contrast-100))
|
|
40
|
-
);
|
|
41
|
-
--mdc-theme-text-disabled-on-background: var(
|
|
42
|
-
--lime-text-disabled-on-background-color,
|
|
43
|
-
rgba(var(--contrast-1700), 0.38)
|
|
44
|
-
);
|
|
45
|
-
--mdc-theme-text-primary-on-background: var(
|
|
46
|
-
--lime-text-primary-on-background-color,
|
|
47
|
-
rgba(var(--contrast-1700), 0.87)
|
|
48
|
-
);
|
|
49
|
-
--mdc-theme-text-secondary-on-background: var(
|
|
50
|
-
--lime-text-secondary-on-background-color,
|
|
51
|
-
rgba(var(--contrast-1700), 0.54)
|
|
52
|
-
);
|
|
53
|
-
--mdc-theme-error: var(
|
|
54
|
-
--lime-error-background-color,
|
|
55
|
-
rgb(var(--color-red-dark))
|
|
56
|
-
);
|
|
57
|
-
--lime-error-text-color: rgb(var(--color-red-darker));
|
|
58
|
-
--mdc-theme-surface: var(
|
|
59
|
-
--lime-surface-background-color,
|
|
60
|
-
rgb(var(--contrast-100))
|
|
61
|
-
);
|
|
62
|
-
--mdc-theme-on-surface: var(
|
|
63
|
-
--lime-on-surface-color,
|
|
64
|
-
rgb(var(--contrast-1500))
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
:host(limel-text-editor) {
|
|
2
|
+
:host(limel-prosemirror-adapter) {
|
|
69
3
|
isolation: isolate;
|
|
70
4
|
display: block;
|
|
71
5
|
}
|
|
@@ -75,18 +9,8 @@
|
|
|
75
9
|
}
|
|
76
10
|
|
|
77
11
|
.ProseMirror-menubar-wrapper {
|
|
78
|
-
transition: border 0.2s ease;
|
|
79
12
|
display: grid;
|
|
80
13
|
grid-template-rows: auto 1fr;
|
|
81
|
-
border-radius: 0.25rem;
|
|
82
|
-
border: 1px solid;
|
|
83
|
-
border-color: rgba(var(--contrast-700), 0.65);
|
|
84
|
-
}
|
|
85
|
-
.ProseMirror-menubar-wrapper:hover {
|
|
86
|
-
border-color: rgba(var(--contrast-700), 1);
|
|
87
|
-
}
|
|
88
|
-
.ProseMirror-menubar-wrapper:focus-within {
|
|
89
|
-
border-color: var(--mdc-theme-primary);
|
|
90
14
|
}
|
|
91
15
|
|
|
92
16
|
.ProseMirror-textblock-dropdown {
|
|
@@ -107,10 +31,7 @@
|
|
|
107
31
|
-webkit-font-variant-ligatures: none;
|
|
108
32
|
font-variant-ligatures: none;
|
|
109
33
|
font-feature-settings: "liga" 0;
|
|
110
|
-
|
|
111
|
-
border-bottom-right-radius: 0.5rem;
|
|
112
|
-
padding: var(--limel-text-editor-padding);
|
|
113
|
-
background-color: rgb(var(--contrast-100));
|
|
34
|
+
padding-top: 0.75rem;
|
|
114
35
|
}
|
|
115
36
|
.ProseMirror [draggable][contenteditable=false] {
|
|
116
37
|
user-select: text;
|
|
@@ -206,10 +127,81 @@ img.ProseMirror-separator {
|
|
|
206
127
|
* 2. the CSS variables of `--kompendium-example-font-family`
|
|
207
128
|
* in the `<style>` tag of `index.html`.
|
|
208
129
|
*/
|
|
130
|
+
/*
|
|
131
|
+
* This file is imported into every component!
|
|
132
|
+
*
|
|
133
|
+
* Nothing in this file may output any CSS
|
|
134
|
+
* without being explicitly called by outside code.
|
|
135
|
+
*/
|
|
136
|
+
/*
|
|
137
|
+
* This file is imported into every component that uses MDC!
|
|
138
|
+
*
|
|
139
|
+
* Anything in this file that generates CSS output on its own,
|
|
140
|
+
* without being explicitly used, will output that CSS in every
|
|
141
|
+
* single component, increasing the size of the production build.
|
|
142
|
+
* Avoid that unless there's very good reason for it!
|
|
143
|
+
*/
|
|
144
|
+
/*
|
|
145
|
+
* This file is imported into every component that uses MDC!
|
|
146
|
+
*
|
|
147
|
+
* Anything in this file that generates CSS output on its own,
|
|
148
|
+
* without being explicitly used, will output that CSS in every
|
|
149
|
+
* single component, increasing the size of the production build.
|
|
150
|
+
* Avoid that unless there's very good reason for it!
|
|
151
|
+
*/
|
|
152
|
+
:host {
|
|
153
|
+
--mdc-theme-primary: var(
|
|
154
|
+
--lime-primary-color,
|
|
155
|
+
rgb(var(--color-teal-default))
|
|
156
|
+
);
|
|
157
|
+
--mdc-theme-secondary: var(
|
|
158
|
+
--lime-secondary-color,
|
|
159
|
+
rgb(var(--contrast-1100))
|
|
160
|
+
);
|
|
161
|
+
--mdc-theme-on-primary: var(
|
|
162
|
+
--lime-on-primary-color,
|
|
163
|
+
rgb(var(--contrast-100))
|
|
164
|
+
);
|
|
165
|
+
--mdc-theme-on-secondary: var(
|
|
166
|
+
--lime-on-secondary-color,
|
|
167
|
+
rgb(var(--contrast-100))
|
|
168
|
+
);
|
|
169
|
+
--mdc-theme-text-disabled-on-background: var(
|
|
170
|
+
--lime-text-disabled-on-background-color,
|
|
171
|
+
rgba(var(--contrast-1700), 0.38)
|
|
172
|
+
);
|
|
173
|
+
--mdc-theme-text-primary-on-background: var(
|
|
174
|
+
--lime-text-primary-on-background-color,
|
|
175
|
+
rgba(var(--contrast-1700), 0.87)
|
|
176
|
+
);
|
|
177
|
+
--mdc-theme-text-secondary-on-background: var(
|
|
178
|
+
--lime-text-secondary-on-background-color,
|
|
179
|
+
rgba(var(--contrast-1700), 0.54)
|
|
180
|
+
);
|
|
181
|
+
--mdc-theme-error: var(
|
|
182
|
+
--lime-error-background-color,
|
|
183
|
+
rgb(var(--color-red-dark))
|
|
184
|
+
);
|
|
185
|
+
--lime-error-text-color: rgb(var(--color-red-darker));
|
|
186
|
+
--mdc-theme-surface: var(
|
|
187
|
+
--lime-surface-background-color,
|
|
188
|
+
rgb(var(--contrast-100))
|
|
189
|
+
);
|
|
190
|
+
--mdc-theme-on-surface: var(
|
|
191
|
+
--lime-on-surface-color,
|
|
192
|
+
rgb(var(--contrast-1500))
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
|
|
209
196
|
div#editor .ProseMirror-menubar {
|
|
210
197
|
position: sticky !important;
|
|
211
198
|
z-index: 1;
|
|
212
199
|
top: 0;
|
|
200
|
+
margin-left: -0.75rem;
|
|
201
|
+
margin-right: -0.75rem;
|
|
202
|
+
background-color: rgba(var(--contrast-200), 0.5);
|
|
203
|
+
backdrop-filter: blur(0.25rem);
|
|
204
|
+
-webkit-backdrop-filter: blur(0.25rem);
|
|
213
205
|
}
|
|
214
206
|
div#editor .ProseMirror-menubar[style*="position: fixed"] {
|
|
215
207
|
box-shadow: 0 0.25rem 0.5rem -0.5rem rgb(var(--color-black), 0.8);
|
|
@@ -226,7 +218,6 @@ div#editor .ProseMirror-menubar-spacer {
|
|
|
226
218
|
gap: 0.25rem;
|
|
227
219
|
align-items: center;
|
|
228
220
|
padding: 0.125rem;
|
|
229
|
-
background-color: rgb(var(--contrast-100));
|
|
230
221
|
border-top-left-radius: 0.5rem;
|
|
231
222
|
border-top-right-radius: 0.5rem;
|
|
232
223
|
}
|
|
@@ -1,8 +1,176 @@
|
|
|
1
|
+
@charset "UTF-8";
|
|
1
2
|
:host(limel-text-editor) {
|
|
2
|
-
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
width: 100%;
|
|
3
6
|
}
|
|
4
7
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
+
fieldset {
|
|
9
|
+
min-width: 0;
|
|
10
|
+
min-height: 0;
|
|
11
|
+
}
|
|
12
|
+
:host(limel-text-editor[readonly]) fieldset {
|
|
13
|
+
padding-block-start: 0.75rem;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/*
|
|
17
|
+
* This file is imported into every component!
|
|
18
|
+
*
|
|
19
|
+
* Nothing in this file may output any CSS
|
|
20
|
+
* without being explicitly called by outside code.
|
|
21
|
+
*/
|
|
22
|
+
/*
|
|
23
|
+
* This file is imported into every component that uses MDC!
|
|
24
|
+
*
|
|
25
|
+
* Anything in this file that generates CSS output on its own,
|
|
26
|
+
* without being explicitly used, will output that CSS in every
|
|
27
|
+
* single component, increasing the size of the production build.
|
|
28
|
+
* Avoid that unless there's very good reason for it!
|
|
29
|
+
*/
|
|
30
|
+
/*
|
|
31
|
+
* This file is imported into every component that uses MDC!
|
|
32
|
+
*
|
|
33
|
+
* Anything in this file that generates CSS output on its own,
|
|
34
|
+
* without being explicitly used, will output that CSS in every
|
|
35
|
+
* single component, increasing the size of the production build.
|
|
36
|
+
* Avoid that unless there's very good reason for it!
|
|
37
|
+
*/
|
|
38
|
+
:host {
|
|
39
|
+
--mdc-theme-primary: var(
|
|
40
|
+
--lime-primary-color,
|
|
41
|
+
rgb(var(--color-teal-default))
|
|
42
|
+
);
|
|
43
|
+
--mdc-theme-secondary: var(
|
|
44
|
+
--lime-secondary-color,
|
|
45
|
+
rgb(var(--contrast-1100))
|
|
46
|
+
);
|
|
47
|
+
--mdc-theme-on-primary: var(
|
|
48
|
+
--lime-on-primary-color,
|
|
49
|
+
rgb(var(--contrast-100))
|
|
50
|
+
);
|
|
51
|
+
--mdc-theme-on-secondary: var(
|
|
52
|
+
--lime-on-secondary-color,
|
|
53
|
+
rgb(var(--contrast-100))
|
|
54
|
+
);
|
|
55
|
+
--mdc-theme-text-disabled-on-background: var(
|
|
56
|
+
--lime-text-disabled-on-background-color,
|
|
57
|
+
rgba(var(--contrast-1700), 0.38)
|
|
58
|
+
);
|
|
59
|
+
--mdc-theme-text-primary-on-background: var(
|
|
60
|
+
--lime-text-primary-on-background-color,
|
|
61
|
+
rgba(var(--contrast-1700), 0.87)
|
|
62
|
+
);
|
|
63
|
+
--mdc-theme-text-secondary-on-background: var(
|
|
64
|
+
--lime-text-secondary-on-background-color,
|
|
65
|
+
rgba(var(--contrast-1700), 0.54)
|
|
66
|
+
);
|
|
67
|
+
--mdc-theme-error: var(
|
|
68
|
+
--lime-error-background-color,
|
|
69
|
+
rgb(var(--color-red-dark))
|
|
70
|
+
);
|
|
71
|
+
--lime-error-text-color: rgb(var(--color-red-darker));
|
|
72
|
+
--mdc-theme-surface: var(
|
|
73
|
+
--lime-surface-background-color,
|
|
74
|
+
rgb(var(--contrast-100))
|
|
75
|
+
);
|
|
76
|
+
--mdc-theme-on-surface: var(
|
|
77
|
+
--lime-on-surface-color,
|
|
78
|
+
rgb(var(--contrast-1500))
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Note! This file is exported to `dist/scss/` in the published
|
|
84
|
+
* node module, for consumer projects to import.
|
|
85
|
+
* That means this file cannot import from any file that isn't
|
|
86
|
+
* also exported, keeping the same relative path.
|
|
87
|
+
*
|
|
88
|
+
* Or, just don't import anything, that works too.
|
|
89
|
+
*/
|
|
90
|
+
/**
|
|
91
|
+
* This can be used on a trigger element that opens a dropdown menu or a popover.
|
|
92
|
+
*/
|
|
93
|
+
/**
|
|
94
|
+
* This mixin will mask out the content that is close to
|
|
95
|
+
* the edges of a scrollable area.
|
|
96
|
+
* - If the scrollable content has `overflow-y`, use `vertically`
|
|
97
|
+
* as an argument for `$direction`.
|
|
98
|
+
- If the scrollable content has `overflow-x`, use `horizontally`
|
|
99
|
+
* as an argument for `$direction`.
|
|
100
|
+
*
|
|
101
|
+
* For the visual effect to work smoothly, we need to make sure that
|
|
102
|
+
* the size of the fade-out edge effect is the same as the
|
|
103
|
+
* internal paddings of the scrollable area. Otherwise, content of a
|
|
104
|
+
* scrollable area that does not have a padding will fade out before
|
|
105
|
+
* any scrolling has been done.
|
|
106
|
+
* This is why this mixin already adds paddings, which automatically
|
|
107
|
+
* default to the size of the fade-out effect.
|
|
108
|
+
* This size defaults to `1rem`, but to override the size use
|
|
109
|
+
* `--limel-top-edge-fade-height` & `--limel-bottom-edge-fade-height`
|
|
110
|
+
* when `vertically` argument is set, and use
|
|
111
|
+
* `--limel-left-edge-fade-width` & `--limel-right-edge-fade-width`
|
|
112
|
+
* when `horizontally` argument is set.
|
|
113
|
+
* Of course you can also programmatically increase and decrease the
|
|
114
|
+
* size of these variables for each edge, based on the amount of
|
|
115
|
+
* scrolling that has been done by the user. In this case, make sure
|
|
116
|
+
* to add a custom padding where the mixin is used, to override
|
|
117
|
+
* the paddings that are automatically added by the mixin in the
|
|
118
|
+
* compiled CSS code.
|
|
119
|
+
*/
|
|
120
|
+
/**
|
|
121
|
+
* This mixin will add an animated underline to the bottom of an `a` elements.
|
|
122
|
+
* Note that you may need to add `all: unset;` –depending on your use case–
|
|
123
|
+
* before using this mixin.
|
|
124
|
+
*/
|
|
125
|
+
/**
|
|
126
|
+
* This mixin creates a cross-browser font stack.
|
|
127
|
+
* - `sans-serif` can be used for the UI of the components.
|
|
128
|
+
* - `monospace` can be used for code.
|
|
129
|
+
*
|
|
130
|
+
* ⚠️ If we change the font stacks, we need to update
|
|
131
|
+
* 1. the consumer documentation in `README.md`, and
|
|
132
|
+
* 2. the CSS variables of `--kompendium-example-font-family`
|
|
133
|
+
* in the `<style>` tag of `index.html`.
|
|
134
|
+
*/
|
|
135
|
+
fieldset {
|
|
136
|
+
box-sizing: border-box;
|
|
137
|
+
transition: border-color 0.2s ease, background-color 0.2s ease;
|
|
138
|
+
border: 1px solid;
|
|
139
|
+
border-radius: 0.25rem;
|
|
140
|
+
margin-inline-start: 0;
|
|
141
|
+
margin-inline-end: 0;
|
|
142
|
+
padding-block-start: 0;
|
|
143
|
+
padding-inline-start: 0.75rem;
|
|
144
|
+
padding-inline-end: 0.75rem;
|
|
145
|
+
padding-block-end: 0.75rem;
|
|
146
|
+
}
|
|
147
|
+
fieldset:not([disabled]) {
|
|
148
|
+
border-color: rgba(var(--contrast-700), 0.65);
|
|
149
|
+
background-color: rgba(var(--contrast-200), 0.5);
|
|
150
|
+
}
|
|
151
|
+
fieldset:not([disabled]):hover {
|
|
152
|
+
border-color: rgba(var(--contrast-700), 1);
|
|
153
|
+
background-color: rgba(var(--contrast-200), 1);
|
|
154
|
+
}
|
|
155
|
+
fieldset:not([disabled]):focus-within {
|
|
156
|
+
border-color: var(--mdc-theme-primary);
|
|
157
|
+
}
|
|
158
|
+
fieldset[disabled] {
|
|
159
|
+
border-color: transparent;
|
|
160
|
+
}
|
|
161
|
+
fieldset:has(legend) {
|
|
162
|
+
margin-top: calc((-0.75rem / 2) + (1px / 2));
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
legend {
|
|
166
|
+
box-sizing: border-box;
|
|
167
|
+
overflow: hidden;
|
|
168
|
+
white-space: nowrap;
|
|
169
|
+
text-overflow: ellipsis;
|
|
170
|
+
max-width: 100%;
|
|
171
|
+
color: rgba(var(--contrast-1200), 1);
|
|
172
|
+
font-size: 0.65rem;
|
|
173
|
+
letter-spacing: var(--mdc-typography-subtitle1-letter-spacing, 0.009375em);
|
|
174
|
+
padding-inline-start: 0.25rem;
|
|
175
|
+
padding-inline-end: 0.25rem;
|
|
8
176
|
}
|
|
@@ -29,7 +29,7 @@ export class TextEditor {
|
|
|
29
29
|
this.value = undefined;
|
|
30
30
|
}
|
|
31
31
|
render() {
|
|
32
|
-
return this.renderEditor();
|
|
32
|
+
return (h("fieldset", { disabled: this.readonly || this.disabled }, this.renderLabel(), this.renderEditor()));
|
|
33
33
|
}
|
|
34
34
|
renderEditor() {
|
|
35
35
|
if (this.readonly) {
|
|
@@ -37,6 +37,12 @@ export class TextEditor {
|
|
|
37
37
|
}
|
|
38
38
|
return (h("limel-prosemirror-adapter", { onChange: this.handleChange, value: this.value }));
|
|
39
39
|
}
|
|
40
|
+
renderLabel() {
|
|
41
|
+
if (!this.label) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
return h("legend", null, this.label);
|
|
45
|
+
}
|
|
40
46
|
static get is() { return "limel-text-editor"; }
|
|
41
47
|
static get encapsulation() { return "shadow"; }
|
|
42
48
|
static get originalStyleUrls() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-editor.js","sourceRoot":"","sources":["../../../src/components/text-editor/text-editor.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,IAAI,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAExE;;;;;;;;;;;;;;GAcG;AAMH,MAAM,OAAO,UAAU;;
|
|
1
|
+
{"version":3,"file":"text-editor.js","sourceRoot":"","sources":["../../../src/components/text-editor/text-editor.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,IAAI,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAExE;;;;;;;;;;;;;;GAcG;AAMH,MAAM,OAAO,UAAU;;IA0FX,iBAAY,GAAG,GAAG,EAAE,CAAC,CAAC,KAA0B,EAAE,EAAE;MACxD,KAAK,CAAC,eAAe,EAAE,CAAC;MACxB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC,CAAC;;;;;;;;;EAjCK,MAAM;IACT,OAAO,CACH,gBAAU,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ;MAC7C,IAAI,CAAC,WAAW,EAAE;MAClB,IAAI,CAAC,YAAY,EAAE,CACb,CACd,CAAC;EACN,CAAC;EAEO,YAAY;IAChB,IAAI,IAAI,CAAC,QAAQ,EAAE;MACf,OAAO,sBAAgB,KAAK,EAAE,IAAI,CAAC,KAAK,GAAI,CAAC;KAChD;IAED,OAAO,CACH,iCACI,QAAQ,EAAE,IAAI,CAAC,YAAY,EAC3B,KAAK,EAAE,IAAI,CAAC,KAAK,GACnB,CACL,CAAC;EACN,CAAC;EAEO,WAAW;IACf,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;MACb,OAAO;KACV;IAED,OAAO,kBAAS,IAAI,CAAC,KAAK,CAAU,CAAC;EACzC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAMJ","sourcesContent":["import { Component, Event, EventEmitter, Prop, h } from '@stencil/core';\nimport { FormComponent } from '../form/form.types';\n/**\n * A rich text editor that offers a rich text editing experience with markdown support,\n * in the sense that you can easily type markdown syntax and see the rendered\n * result as rich text in real-time. For instance, you can type `# Hello, world!`\n * and see it directly turning to a heading 1 (an `<h1>` HTML element).\n *\n * Naturally, you can use standard keyboard hotkeys such as <kbd>Ctrl</kbd> + <kbd>B</kbd>\n * to toggle bold text, <kbd>Ctrl</kbd> + <kbd>I</kbd> to toggle italic text, and so on.\n *\n * @exampleComponent limel-example-text-editor-basic\n * @exampleComponent limel-example-text-editor-as-form-component\n * @exampleComponent limel-example-text-editor-composite\n * @beta\n * @private\n */\n@Component({\n tag: 'limel-text-editor',\n shadow: true,\n styleUrl: 'text-editor.scss',\n})\nexport class TextEditor implements FormComponent<string> {\n /**\n * Set to `true` to disable the field.\n * Use `disabled` to indicate that the field can normally be interacted\n * with, but is currently disabled. This tells the user that if certain\n * requirements are met, the field may become enabled again.\n */\n @Prop({ reflect: true })\n public disabled?: boolean;\n\n /**\n * Set to `true` to make the component read-only.\n * Use `readonly` when the field is only there to present the data it holds,\n * and will not become possible for the current user to edit.\n * :::note\n * Consider that it might be better to use `limel-markdown`\n * instead of `limel-text-editor` when the goal is visualizing data.\n * :::\n */\n @Prop({ reflect: true })\n public readonly?: boolean;\n\n /**\n * Optional helper text to display below the input field when it has focus\n */\n @Prop({ reflect: true })\n public helperText?: string;\n\n /**\n * The placeholder text shown inside the input field,\n * when the field is empty.\n */\n @Prop({ reflect: true })\n public placeholder?: string;\n\n /**\n * The label of the editor\n */\n @Prop({ reflect: true })\n public label?: string;\n\n /**\n * Set to `true` to indicate that the current value of the editor is\n * invalid.\n */\n @Prop({ reflect: true })\n public invalid?: boolean;\n\n /**\n * Description of the text inside the editor as serialised HTML\n */\n @Prop({ reflect: true })\n public value: string;\n\n /**\n * Dispatched when a change is made to the editor\n */\n @Event()\n public change: EventEmitter<string>;\n\n public render() {\n return (\n <fieldset disabled={this.readonly || this.disabled}>\n {this.renderLabel()}\n {this.renderEditor()}\n </fieldset>\n );\n }\n\n private renderEditor() {\n if (this.readonly) {\n return <limel-markdown value={this.value} />;\n }\n\n return (\n <limel-prosemirror-adapter\n onChange={this.handleChange}\n value={this.value}\n />\n );\n }\n\n private renderLabel() {\n if (!this.label) {\n return;\n }\n\n return <legend>{this.label}</legend>;\n }\n\n private handleChange = () => (event: CustomEvent<string>) => {\n event.stopPropagation();\n this.change.emit(event.detail);\n };\n}\n"]}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
@use './shared_input-select-picker.scss';
|
|
2
|
+
@use '../mixins.scss';
|
|
3
|
+
|
|
4
|
+
$_thickness-of-the-border: 1px;
|
|
5
|
+
|
|
6
|
+
fieldset {
|
|
7
|
+
box-sizing: border-box;
|
|
8
|
+
transition:
|
|
9
|
+
border-color 0.2s ease,
|
|
10
|
+
background-color 0.2s ease;
|
|
11
|
+
border: $_thickness-of-the-border solid;
|
|
12
|
+
border-radius: 0.25rem;
|
|
13
|
+
|
|
14
|
+
margin-inline-start: 0;
|
|
15
|
+
margin-inline-end: 0;
|
|
16
|
+
padding-block-start: 0;
|
|
17
|
+
padding-inline-start: 0.75rem;
|
|
18
|
+
padding-inline-end: 0.75rem;
|
|
19
|
+
padding-block-end: 0.75rem;
|
|
20
|
+
|
|
21
|
+
&:not([disabled]) {
|
|
22
|
+
border-color: shared_input-select-picker.$lime-text-field-outline-color;
|
|
23
|
+
background-color: shared_input-select-picker.$background-color-normal;
|
|
24
|
+
|
|
25
|
+
&:hover {
|
|
26
|
+
border-color: shared_input-select-picker.$lime-text-field-outline-color--hovered;
|
|
27
|
+
background-color: shared_input-select-picker.$background-color-hovered;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&:focus-within {
|
|
31
|
+
border-color: shared_input-select-picker.$lime-text-field-outline-color--focused;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&[disabled] {
|
|
36
|
+
border-color: transparent;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
&:has(legend) {
|
|
40
|
+
// In input fields, the `label`s are optional,
|
|
41
|
+
// and we use the `legend` to render the `label`.
|
|
42
|
+
// This ensures that when or if the label appears,
|
|
43
|
+
// the field doesn't visually move down in the DOM.
|
|
44
|
+
$_height-of-the-legend: -0.75rem;
|
|
45
|
+
margin-top: calc(
|
|
46
|
+
(#{$_height-of-the-legend} / 2) + (#{$_thickness-of-the-border} / 2)
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
legend {
|
|
52
|
+
box-sizing: border-box;
|
|
53
|
+
@include mixins.truncate-text;
|
|
54
|
+
max-width: 100%;
|
|
55
|
+
|
|
56
|
+
color: shared_input-select-picker.$label-color;
|
|
57
|
+
font-size: 0.65rem; // `10.4px` similar to MDC's floating label
|
|
58
|
+
letter-spacing: var(--mdc-typography-subtitle1-letter-spacing, 0.009375em);
|
|
59
|
+
|
|
60
|
+
padding-inline-start: 0.25rem;
|
|
61
|
+
padding-inline-end: 0.25rem;
|
|
62
|
+
}
|
|
@@ -16020,7 +16020,7 @@ const isDropdown = (item) => {
|
|
|
16020
16020
|
return item.content !== undefined;
|
|
16021
16021
|
};
|
|
16022
16022
|
|
|
16023
|
-
const prosemirrorAdapterCss = "@charset \"UTF-8\";:host{--mdc-theme-primary:var(\n --lime-primary-color,\n rgb(var(--color-teal-default))\n );--mdc-theme-secondary:var(\n --lime-secondary-color,\n rgb(var(--contrast-1100))\n );--mdc-theme-on-primary:var(\n --lime-on-primary-color,\n rgb(var(--contrast-100))\n );--mdc-theme-on-secondary:var(\n --lime-on-secondary-color,\n rgb(var(--contrast-100))\n );--mdc-theme-text-disabled-on-background:var(\n --lime-text-disabled-on-background-color,\n rgba(var(--contrast-1700), 0.38)\n );--mdc-theme-text-primary-on-background:var(\n --lime-text-primary-on-background-color,\n rgba(var(--contrast-1700), 0.87)\n );--mdc-theme-text-secondary-on-background:var(\n --lime-text-secondary-on-background-color,\n rgba(var(--contrast-1700), 0.54)\n );--mdc-theme-error:var(\n --lime-error-background-color,\n rgb(var(--color-red-dark))\n );--lime-error-text-color:rgb(var(--color-red-darker));--mdc-theme-surface:var(\n --lime-surface-background-color,\n rgb(var(--contrast-100))\n );--mdc-theme-on-surface:var(\n --lime-on-surface-color,\n rgb(var(--contrast-1500))\n )}:host(limel-text-editor){isolation:isolate;display:block}*{box-sizing:border-box}.ProseMirror-menubar-wrapper{transition:border 0.2s ease;display:grid;grid-template-rows:auto 1fr;border-radius:0.25rem;border:1px solid;border-color:rgba(var(--contrast-700), 0.65)}.ProseMirror-menubar-wrapper:hover{border-color:rgba(var(--contrast-700), 1)}.ProseMirror-menubar-wrapper:focus-within{border-color:var(--mdc-theme-primary)}.ProseMirror-textblock-dropdown{min-width:3em}.ProseMirror-tooltip .ProseMirror-menu{width:-webkit-fit-content;width:fit-content;white-space:pre}.ProseMirror{position:relative;word-wrap:break-word;white-space:pre-wrap;white-space:break-spaces;-webkit-font-variant-ligatures:none;font-variant-ligatures:none;font-feature-settings:\"liga\" 0;border-bottom-left-radius:0.5rem;border-bottom-right-radius:0.5rem;padding:var(--limel-text-editor-padding);background-color:rgb(var(--contrast-100))}.ProseMirror [draggable][contenteditable=false]{user-select:text}.ProseMirror:focus-visible{outline:none}.ProseMirror-hideselection{caret-color:transparent}.ProseMirror-hideselection *::selection{background:transparent}.ProseMirror-hideselection *::-moz-selection{background:transparent}.ProseMirror-selectednode{outline:0.125rem solid rgb(var(--color-sky-light))}li.ProseMirror-selectednode{outline:none}li.ProseMirror-selectednode:after{content:\"\";position:absolute;left:-2rem;right:-0.125rem;top:-0.125rem;bottom:-0.125rem;border:0.125rem solid rgb(var(--color-sky-light));pointer-events:none}img.ProseMirror-separator{display:inline !important;border:none !important;margin:0 !important}div#editor .ProseMirror-menubar{position:sticky !important;z-index:1;top:0}div#editor .ProseMirror-menubar[style*=\"position: fixed\"]{box-shadow:0 0.25rem 0.5rem -0.5rem rgb(var(--color-black), 0.8)}div#editor .ProseMirror-menubar-spacer{display:none}.ProseMirror-menubar{position:relative;z-index:1;display:flex;flex-wrap:wrap;gap:0.25rem;align-items:center;padding:0.125rem;background-color:rgb(var(--contrast-100));border-top-left-radius:0.5rem;border-top-right-radius:0.5rem}.ProseMirror-menuitem{position:relative;flex-shrink:0;display:flex;align-items:center;justify-content:center;white-space:nowrap;line-height:1;height:1.5rem;min-width:1.5rem;border-radius:0.25rem;color:rgb(var(--contrast-1100));font-size:0.8125rem}.ProseMirror-menuitem:not(:has(.ProseMirror-menu-disabled)){transition:color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease-out;cursor:pointer;color:var(--mdc-theme-on-surface);background-color:transparent}.ProseMirror-menuitem:not(:has(.ProseMirror-menu-disabled)):hover{color:var(--mdc-theme-on-surface);background-color:var(--lime-elevated-surface-background-color);box-shadow:var(--button-shadow-hovered)}.ProseMirror-menuitem:not(:has(.ProseMirror-menu-disabled)):active{box-shadow:var(--button-shadow-pressed);transform:translate3d(0, 0.08rem, 0)}.ProseMirror-menuitem:has(.ProseMirror-menu-active){box-shadow:var(--button-shadow-inset);color:var(--mdc-theme-primary)}.ProseMirror-menuitem:has(.ProseMirror-menu-active) svg{color:var(--mdc-theme-primary)}.ProseMirror-menuitem:has(.ProseMirror-menu-dropdown-menu){box-shadow:var(--button-shadow-inset)}.ProseMirror-menuitem svg{fill:currentColor;height:1rem;color:rgb(var(--contrast-1100))}.ProseMirror-menuseparator{border-radius:1rem;background-color:rgb(var(--contrast-600));width:0.125rem;height:1rem}.ProseMirror-menu-dropdown{position:relative;display:flex;align-items:center;gap:0.5rem;padding:0 0.5rem}.ProseMirror-menu-dropdown:after{content:\"\";border-left:0.25rem solid transparent;border-right:0.25rem solid transparent;border-top:0.25rem solid currentColor}.ProseMirror-menu-dropdown-menu,.ProseMirror-menu-submenu{box-shadow:0px 5px 5px -3px rgba(0, 0, 0, 0.2), 0px 8px 10px 1px rgba(0, 0, 0, 0.14), 0px 3px 14px 2px rgba(0, 0, 0, 0.12)}.ProseMirror-menu-dropdown-menu{position:absolute;top:100%;background:rgb(var(--contrast-100));border-radius:0.25rem;padding:0.125rem}.ProseMirror-menu-submenu{position:absolute;background:rgb(var(--contrast-100));border-radius:0.25rem;padding:0.125rem;display:none;min-width:4em;left:100%;top:-0.75rem}.ProseMirror-menu-dropdown-item{transition:background-color 0.2s ease;cursor:pointer;border-radius:0.375rem;min-height:2.5rem;display:flex;align-items:center;width:100%}.ProseMirror-menu-dropdown-item>div{padding:0 1rem;width:100%}.ProseMirror-menu-dropdown-item:not(:has(.ProseMirror-menu-disabled)):hover{background-color:rgb(var(--contrast-300))}.ProseMirror-menu-submenu-wrap{position:relative;margin-right:-0.25rem}.ProseMirror-menu-submenu-wrap:hover .ProseMirror-menu-submenu{display:block}.ProseMirror-menu-submenu-label{position:relative;display:flex;align-items:center;justify-content:space-between;gap:0.5rem}.ProseMirror-menu-submenu-label:after{content:\"\";border-top:0.25rem solid transparent;border-bottom:0.25rem solid transparent;border-left:0.25rem solid currentColor}.ProseMirror-menu-disabled{opacity:0.3;cursor:default}.ProseMirror-menu-submenu-wrap-active .ProseMirror-menu-submenu{display:block}blockquote{position:relative;font-weight:100;font-size:0.875rem;max-width:100%;line-height:1.4;margin:0;padding:0.5rem 1.25rem;border-radius:0.05rem 0.75rem;background-color:rgb(var(--contrast-300))}blockquote:before,blockquote:after{position:absolute;font-size:2.75rem;opacity:0.4}blockquote:before{content:\"“\";left:0;top:-0.75rem}blockquote:after{content:\"”\";right:0;bottom:-2rem}:host(limel-markdown.truncate-paragraphs) p{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}p,li{font-size:0.875rem;word-break:break-word;hyphens:auto;-webkit-hyphens:auto}a{word-break:break-all}p{margin-top:0;margin-bottom:0.5rem}p:only-child{margin-bottom:0}a{transition:color 0.2s ease;color:var(--markdown-hyperlink-color, rgb(var(--color-blue-dark)));text-decoration:none}a:hover{color:var(--markdown-hyperlink-color--hovered, rgb(var(--color-blue-default)))}hr{margin:1.75rem 0 2rem 0;border-width:0;border-top:1px solid rgb(var(--contrast-500))}dl{display:grid;grid-template-columns:1fr 2fr;grid-template-rows:1fr;margin-bottom:2rem;border:1px solid rgb(var(--contrast-400));border-radius:0.375rem;background-color:rgb(var(--contrast-200))}dl dt,dl dd{padding:0.375rem 0.5rem;font-size:0.875rem;margin:0}dl dt:nth-of-type(even),dl dd:nth-of-type(even){background-color:rgb(var(--contrast-300))}dl dt:first-child{border-top-left-radius:0.375rem}dl dt:last-child{border-bottom-left-radius:0.375rem}dl dd:first-child{border-top-right-radius:0.375rem}dl dd:last-child{border-bottom-right-radius:0.375rem}h1{font-size:1.5rem}h2{font-size:1.25rem}h3{font-size:1.125rem}h4{font-size:1rem}h5{font-size:0.875rem}h6{font-size:0.75rem}h1,h2{margin-top:0.5rem;margin-bottom:0.5rem;letter-spacing:-0.03125rem;font-weight:500}h3,h4{margin-top:0.75rem;margin-bottom:0.25rem;font-weight:600}h5,h6{margin-top:0.5rem;margin-bottom:0.125rem;font-weight:600}h1,h2,h3,h4,h5,h6{word-break:break-word;hyphens:auto;-webkit-hyphens:auto}:not([contenteditable=true]) h1,:not([contenteditable=true]) h2,:not([contenteditable=true]) h3,:not([contenteditable=true]) h4,:not([contenteditable=true]) h5,:not([contenteditable=true]) h6{text-wrap:balance}[contenteditable=true] h1,[contenteditable=true] h2,[contenteditable=true] h3,[contenteditable=true] h4,[contenteditable=true] h5,[contenteditable=true] h6{text-wrap:initial}ul{list-style:none}ul li{position:relative;margin-left:0.75rem}ul li:before{content:\"\";position:absolute;left:-0.5rem;top:0.5rem;width:0.25rem;height:0.25rem;border-radius:50%;background-color:rgb(var(--contrast-700));display:block}ol{margin-top:0.25rem;padding-left:1rem}ul{margin-top:0.25rem;padding-left:0}ul ul,ul ol,ol ol,ol ul{margin-left:0}li{margin-bottom:0.25rem}code{font-family:ui-monospace, \"Cascadia Code\", \"Source Code Pro\", Menlo, Consolas, \"DejaVu Sans Mono\", monospace;font-size:0.8125rem;letter-spacing:-0.0125rem;color:rgb(var(--contrast-1300));-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none;display:inline-block;border-radius:0.25rem;padding:0.03125rem 0.25rem;background-color:rgb(var(--contrast-600))}pre>code{display:block;margin:0.5rem 0;padding:0.5rem 0.75rem;overflow:auto;white-space:pre-wrap}:host(limel-markdown:not(.no-table-styles)) table{table-layout:auto;min-width:100%;border-collapse:collapse;border-spacing:0;background:transparent;margin:0.75rem 0;border:1px solid rgb(var(--contrast-400))}:host(limel-markdown:not(.no-table-styles)) th,:host(limel-markdown:not(.no-table-styles)) td{text-align:left;vertical-align:top;transition:background-color 0.2s ease;font-size:0.875rem}:host(limel-markdown:not(.no-table-styles)) td{padding:0.5rem 0.375rem 0.75rem 0.375rem}:host(limel-markdown:not(.no-table-styles)) tr th{background-color:rgb(var(--contrast-400));padding:0.25rem 0.375rem;font-weight:normal}:host(limel-markdown:not(.no-table-styles)) tr th:only-child{text-align:center}:host(limel-markdown:not(.no-table-styles)) tbody tr:nth-child(odd) td{background-color:rgb(var(--contrast-200))}:host(limel-markdown:not(.no-table-styles)) tbody tr:hover td{background-color:rgb(var(--contrast-300))}";
|
|
16023
|
+
const prosemirrorAdapterCss = "@charset \"UTF-8\";:host(limel-prosemirror-adapter){isolation:isolate;display:block}*{box-sizing:border-box}.ProseMirror-menubar-wrapper{display:grid;grid-template-rows:auto 1fr}.ProseMirror-textblock-dropdown{min-width:3em}.ProseMirror-tooltip .ProseMirror-menu{width:-webkit-fit-content;width:fit-content;white-space:pre}.ProseMirror{position:relative;word-wrap:break-word;white-space:pre-wrap;white-space:break-spaces;-webkit-font-variant-ligatures:none;font-variant-ligatures:none;font-feature-settings:\"liga\" 0;padding-top:0.75rem}.ProseMirror [draggable][contenteditable=false]{user-select:text}.ProseMirror:focus-visible{outline:none}.ProseMirror-hideselection{caret-color:transparent}.ProseMirror-hideselection *::selection{background:transparent}.ProseMirror-hideselection *::-moz-selection{background:transparent}.ProseMirror-selectednode{outline:0.125rem solid rgb(var(--color-sky-light))}li.ProseMirror-selectednode{outline:none}li.ProseMirror-selectednode:after{content:\"\";position:absolute;left:-2rem;right:-0.125rem;top:-0.125rem;bottom:-0.125rem;border:0.125rem solid rgb(var(--color-sky-light));pointer-events:none}img.ProseMirror-separator{display:inline !important;border:none !important;margin:0 !important}:host{--mdc-theme-primary:var(\n --lime-primary-color,\n rgb(var(--color-teal-default))\n );--mdc-theme-secondary:var(\n --lime-secondary-color,\n rgb(var(--contrast-1100))\n );--mdc-theme-on-primary:var(\n --lime-on-primary-color,\n rgb(var(--contrast-100))\n );--mdc-theme-on-secondary:var(\n --lime-on-secondary-color,\n rgb(var(--contrast-100))\n );--mdc-theme-text-disabled-on-background:var(\n --lime-text-disabled-on-background-color,\n rgba(var(--contrast-1700), 0.38)\n );--mdc-theme-text-primary-on-background:var(\n --lime-text-primary-on-background-color,\n rgba(var(--contrast-1700), 0.87)\n );--mdc-theme-text-secondary-on-background:var(\n --lime-text-secondary-on-background-color,\n rgba(var(--contrast-1700), 0.54)\n );--mdc-theme-error:var(\n --lime-error-background-color,\n rgb(var(--color-red-dark))\n );--lime-error-text-color:rgb(var(--color-red-darker));--mdc-theme-surface:var(\n --lime-surface-background-color,\n rgb(var(--contrast-100))\n );--mdc-theme-on-surface:var(\n --lime-on-surface-color,\n rgb(var(--contrast-1500))\n )}div#editor .ProseMirror-menubar{position:sticky !important;z-index:1;top:0;margin-left:-0.75rem;margin-right:-0.75rem;background-color:rgba(var(--contrast-200), 0.5);backdrop-filter:blur(0.25rem);-webkit-backdrop-filter:blur(0.25rem)}div#editor .ProseMirror-menubar[style*=\"position: fixed\"]{box-shadow:0 0.25rem 0.5rem -0.5rem rgb(var(--color-black), 0.8)}div#editor .ProseMirror-menubar-spacer{display:none}.ProseMirror-menubar{position:relative;z-index:1;display:flex;flex-wrap:wrap;gap:0.25rem;align-items:center;padding:0.125rem;border-top-left-radius:0.5rem;border-top-right-radius:0.5rem}.ProseMirror-menuitem{position:relative;flex-shrink:0;display:flex;align-items:center;justify-content:center;white-space:nowrap;line-height:1;height:1.5rem;min-width:1.5rem;border-radius:0.25rem;color:rgb(var(--contrast-1100));font-size:0.8125rem}.ProseMirror-menuitem:not(:has(.ProseMirror-menu-disabled)){transition:color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease-out;cursor:pointer;color:var(--mdc-theme-on-surface);background-color:transparent}.ProseMirror-menuitem:not(:has(.ProseMirror-menu-disabled)):hover{color:var(--mdc-theme-on-surface);background-color:var(--lime-elevated-surface-background-color);box-shadow:var(--button-shadow-hovered)}.ProseMirror-menuitem:not(:has(.ProseMirror-menu-disabled)):active{box-shadow:var(--button-shadow-pressed);transform:translate3d(0, 0.08rem, 0)}.ProseMirror-menuitem:has(.ProseMirror-menu-active){box-shadow:var(--button-shadow-inset);color:var(--mdc-theme-primary)}.ProseMirror-menuitem:has(.ProseMirror-menu-active) svg{color:var(--mdc-theme-primary)}.ProseMirror-menuitem:has(.ProseMirror-menu-dropdown-menu){box-shadow:var(--button-shadow-inset)}.ProseMirror-menuitem svg{fill:currentColor;height:1rem;color:rgb(var(--contrast-1100))}.ProseMirror-menuseparator{border-radius:1rem;background-color:rgb(var(--contrast-600));width:0.125rem;height:1rem}.ProseMirror-menu-dropdown{position:relative;display:flex;align-items:center;gap:0.5rem;padding:0 0.5rem}.ProseMirror-menu-dropdown:after{content:\"\";border-left:0.25rem solid transparent;border-right:0.25rem solid transparent;border-top:0.25rem solid currentColor}.ProseMirror-menu-dropdown-menu,.ProseMirror-menu-submenu{box-shadow:0px 5px 5px -3px rgba(0, 0, 0, 0.2), 0px 8px 10px 1px rgba(0, 0, 0, 0.14), 0px 3px 14px 2px rgba(0, 0, 0, 0.12)}.ProseMirror-menu-dropdown-menu{position:absolute;top:100%;background:rgb(var(--contrast-100));border-radius:0.25rem;padding:0.125rem}.ProseMirror-menu-submenu{position:absolute;background:rgb(var(--contrast-100));border-radius:0.25rem;padding:0.125rem;display:none;min-width:4em;left:100%;top:-0.75rem}.ProseMirror-menu-dropdown-item{transition:background-color 0.2s ease;cursor:pointer;border-radius:0.375rem;min-height:2.5rem;display:flex;align-items:center;width:100%}.ProseMirror-menu-dropdown-item>div{padding:0 1rem;width:100%}.ProseMirror-menu-dropdown-item:not(:has(.ProseMirror-menu-disabled)):hover{background-color:rgb(var(--contrast-300))}.ProseMirror-menu-submenu-wrap{position:relative;margin-right:-0.25rem}.ProseMirror-menu-submenu-wrap:hover .ProseMirror-menu-submenu{display:block}.ProseMirror-menu-submenu-label{position:relative;display:flex;align-items:center;justify-content:space-between;gap:0.5rem}.ProseMirror-menu-submenu-label:after{content:\"\";border-top:0.25rem solid transparent;border-bottom:0.25rem solid transparent;border-left:0.25rem solid currentColor}.ProseMirror-menu-disabled{opacity:0.3;cursor:default}.ProseMirror-menu-submenu-wrap-active .ProseMirror-menu-submenu{display:block}blockquote{position:relative;font-weight:100;font-size:0.875rem;max-width:100%;line-height:1.4;margin:0;padding:0.5rem 1.25rem;border-radius:0.05rem 0.75rem;background-color:rgb(var(--contrast-300))}blockquote:before,blockquote:after{position:absolute;font-size:2.75rem;opacity:0.4}blockquote:before{content:\"“\";left:0;top:-0.75rem}blockquote:after{content:\"”\";right:0;bottom:-2rem}:host(limel-markdown.truncate-paragraphs) p{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}p,li{font-size:0.875rem;word-break:break-word;hyphens:auto;-webkit-hyphens:auto}a{word-break:break-all}p{margin-top:0;margin-bottom:0.5rem}p:only-child{margin-bottom:0}a{transition:color 0.2s ease;color:var(--markdown-hyperlink-color, rgb(var(--color-blue-dark)));text-decoration:none}a:hover{color:var(--markdown-hyperlink-color--hovered, rgb(var(--color-blue-default)))}hr{margin:1.75rem 0 2rem 0;border-width:0;border-top:1px solid rgb(var(--contrast-500))}dl{display:grid;grid-template-columns:1fr 2fr;grid-template-rows:1fr;margin-bottom:2rem;border:1px solid rgb(var(--contrast-400));border-radius:0.375rem;background-color:rgb(var(--contrast-200))}dl dt,dl dd{padding:0.375rem 0.5rem;font-size:0.875rem;margin:0}dl dt:nth-of-type(even),dl dd:nth-of-type(even){background-color:rgb(var(--contrast-300))}dl dt:first-child{border-top-left-radius:0.375rem}dl dt:last-child{border-bottom-left-radius:0.375rem}dl dd:first-child{border-top-right-radius:0.375rem}dl dd:last-child{border-bottom-right-radius:0.375rem}h1{font-size:1.5rem}h2{font-size:1.25rem}h3{font-size:1.125rem}h4{font-size:1rem}h5{font-size:0.875rem}h6{font-size:0.75rem}h1,h2{margin-top:0.5rem;margin-bottom:0.5rem;letter-spacing:-0.03125rem;font-weight:500}h3,h4{margin-top:0.75rem;margin-bottom:0.25rem;font-weight:600}h5,h6{margin-top:0.5rem;margin-bottom:0.125rem;font-weight:600}h1,h2,h3,h4,h5,h6{word-break:break-word;hyphens:auto;-webkit-hyphens:auto}:not([contenteditable=true]) h1,:not([contenteditable=true]) h2,:not([contenteditable=true]) h3,:not([contenteditable=true]) h4,:not([contenteditable=true]) h5,:not([contenteditable=true]) h6{text-wrap:balance}[contenteditable=true] h1,[contenteditable=true] h2,[contenteditable=true] h3,[contenteditable=true] h4,[contenteditable=true] h5,[contenteditable=true] h6{text-wrap:initial}ul{list-style:none}ul li{position:relative;margin-left:0.75rem}ul li:before{content:\"\";position:absolute;left:-0.5rem;top:0.5rem;width:0.25rem;height:0.25rem;border-radius:50%;background-color:rgb(var(--contrast-700));display:block}ol{margin-top:0.25rem;padding-left:1rem}ul{margin-top:0.25rem;padding-left:0}ul ul,ul ol,ol ol,ol ul{margin-left:0}li{margin-bottom:0.25rem}code{font-family:ui-monospace, \"Cascadia Code\", \"Source Code Pro\", Menlo, Consolas, \"DejaVu Sans Mono\", monospace;font-size:0.8125rem;letter-spacing:-0.0125rem;color:rgb(var(--contrast-1300));-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none;display:inline-block;border-radius:0.25rem;padding:0.03125rem 0.25rem;background-color:rgb(var(--contrast-600))}pre>code{display:block;margin:0.5rem 0;padding:0.5rem 0.75rem;overflow:auto;white-space:pre-wrap}:host(limel-markdown:not(.no-table-styles)) table{table-layout:auto;min-width:100%;border-collapse:collapse;border-spacing:0;background:transparent;margin:0.75rem 0;border:1px solid rgb(var(--contrast-400))}:host(limel-markdown:not(.no-table-styles)) th,:host(limel-markdown:not(.no-table-styles)) td{text-align:left;vertical-align:top;transition:background-color 0.2s ease;font-size:0.875rem}:host(limel-markdown:not(.no-table-styles)) td{padding:0.5rem 0.375rem 0.75rem 0.375rem}:host(limel-markdown:not(.no-table-styles)) tr th{background-color:rgb(var(--contrast-400));padding:0.25rem 0.375rem;font-weight:normal}:host(limel-markdown:not(.no-table-styles)) tr th:only-child{text-align:center}:host(limel-markdown:not(.no-table-styles)) tbody tr:nth-child(odd) td{background-color:rgb(var(--contrast-200))}:host(limel-markdown:not(.no-table-styles)) tbody tr:hover td{background-color:rgb(var(--contrast-300))}";
|
|
16024
16024
|
|
|
16025
16025
|
const ProsemirrorAdapter = class {
|
|
16026
16026
|
constructor(hostRef) {
|