tiny-essentials 1.16.0 → 1.16.1
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/dist/v1/TinyAfterScrollWatcher.js +196 -0
- package/dist/v1/TinyAfterScrollWatcher.min.js +1 -0
- package/dist/v1/TinyBasicsEs.js +488 -0
- package/dist/v1/TinyBasicsEs.min.js +1 -1
- package/dist/v1/TinyDragger.js +488 -0
- package/dist/v1/TinyDragger.min.js +1 -1
- package/dist/v1/TinyEssentials.js +647 -0
- package/dist/v1/TinyEssentials.min.js +1 -1
- package/dist/v1/TinyHtml.js +488 -0
- package/dist/v1/TinyHtml.min.js +1 -1
- package/dist/v1/TinyUploadClicker.js +489 -0
- package/dist/v1/TinyUploadClicker.min.js +1 -1
- package/dist/v1/build/TinyAfterScrollWatcher.cjs +7 -0
- package/dist/v1/build/TinyAfterScrollWatcher.d.mts +3 -0
- package/dist/v1/build/TinyAfterScrollWatcher.mjs +2 -0
- package/dist/v1/index.cjs +2 -0
- package/dist/v1/index.d.mts +2 -1
- package/dist/v1/index.mjs +2 -1
- package/dist/v1/libs/TinyAfterScrollWatcher.cjs +157 -0
- package/dist/v1/libs/TinyAfterScrollWatcher.d.mts +86 -0
- package/dist/v1/libs/TinyAfterScrollWatcher.mjs +138 -0
- package/dist/v1/libs/TinyHtml.cjs +488 -0
- package/dist/v1/libs/TinyHtml.d.mts +150 -0
- package/dist/v1/libs/TinyHtml.mjs +469 -0
- package/dist/v1/libs/TinyUploadClicker.cjs +1 -0
- package/docs/v1/README.md +10 -10
- package/docs/v1/libs/TinyAfterScrollWatcher.md +181 -0
- package/docs/v1/libs/TinyHtml.md +325 -0
- package/package.json +1 -1
|
@@ -5871,6 +5871,494 @@ class TinyHtml_TinyHtml {
|
|
|
5871
5871
|
|
|
5872
5872
|
//////////////////////////////////////////////////////////////////////
|
|
5873
5873
|
|
|
5874
|
+
/**
|
|
5875
|
+
* Stores camelCase to kebab-case CSS property aliases.
|
|
5876
|
+
*
|
|
5877
|
+
* Used to normalize property names when interacting with `element.style` or `getComputedStyle`.
|
|
5878
|
+
*
|
|
5879
|
+
* ⚠️ This object should not be modified directly. Use `TinyHtml.cssPropAliases` instead to ensure reverse mappings stay in sync.
|
|
5880
|
+
*
|
|
5881
|
+
* Example of how to add a new alias:
|
|
5882
|
+
*
|
|
5883
|
+
* ```js
|
|
5884
|
+
* TinyHtml.cssPropAliases.tinyPudding = 'tiny-pudding';
|
|
5885
|
+
* ```
|
|
5886
|
+
*
|
|
5887
|
+
* This will automatically update `TinyHtml.cssPropRevAliases['tiny-pudding']` with `'tinyPudding'`.
|
|
5888
|
+
*
|
|
5889
|
+
* @type {Record<string | symbol, string>}
|
|
5890
|
+
*/
|
|
5891
|
+
static #cssPropAliases = {
|
|
5892
|
+
alignContent: 'align-content',
|
|
5893
|
+
alignItems: 'align-items',
|
|
5894
|
+
alignSelf: 'align-self',
|
|
5895
|
+
animationDelay: 'animation-delay',
|
|
5896
|
+
animationDirection: 'animation-direction',
|
|
5897
|
+
animationDuration: 'animation-duration',
|
|
5898
|
+
animationFillMode: 'animation-fill-mode',
|
|
5899
|
+
animationIterationCount: 'animation-iteration-count',
|
|
5900
|
+
animationName: 'animation-name',
|
|
5901
|
+
animationPlayState: 'animation-play-state',
|
|
5902
|
+
animationTimingFunction: 'animation-timing-function',
|
|
5903
|
+
backfaceVisibility: 'backface-visibility',
|
|
5904
|
+
backgroundAttachment: 'background-attachment',
|
|
5905
|
+
backgroundBlendMode: 'background-blend-mode',
|
|
5906
|
+
backgroundClip: 'background-clip',
|
|
5907
|
+
backgroundColor: 'background-color',
|
|
5908
|
+
backgroundImage: 'background-image',
|
|
5909
|
+
backgroundOrigin: 'background-origin',
|
|
5910
|
+
backgroundPosition: 'background-position',
|
|
5911
|
+
backgroundRepeat: 'background-repeat',
|
|
5912
|
+
backgroundSize: 'background-size',
|
|
5913
|
+
borderBottom: 'border-bottom',
|
|
5914
|
+
borderBottomColor: 'border-bottom-color',
|
|
5915
|
+
borderBottomLeftRadius: 'border-bottom-left-radius',
|
|
5916
|
+
borderBottomRightRadius: 'border-bottom-right-radius',
|
|
5917
|
+
borderBottomStyle: 'border-bottom-style',
|
|
5918
|
+
borderBottomWidth: 'border-bottom-width',
|
|
5919
|
+
borderCollapse: 'border-collapse',
|
|
5920
|
+
borderColor: 'border-color',
|
|
5921
|
+
borderImage: 'border-image',
|
|
5922
|
+
borderImageOutset: 'border-image-outset',
|
|
5923
|
+
borderImageRepeat: 'border-image-repeat',
|
|
5924
|
+
borderImageSlice: 'border-image-slice',
|
|
5925
|
+
borderImageSource: 'border-image-source',
|
|
5926
|
+
borderImageWidth: 'border-image-width',
|
|
5927
|
+
borderLeft: 'border-left',
|
|
5928
|
+
borderLeftColor: 'border-left-color',
|
|
5929
|
+
borderLeftStyle: 'border-left-style',
|
|
5930
|
+
borderLeftWidth: 'border-left-width',
|
|
5931
|
+
borderRadius: 'border-radius',
|
|
5932
|
+
borderRight: 'border-right',
|
|
5933
|
+
borderRightColor: 'border-right-color',
|
|
5934
|
+
borderRightStyle: 'border-right-style',
|
|
5935
|
+
borderRightWidth: 'border-right-width',
|
|
5936
|
+
borderSpacing: 'border-spacing',
|
|
5937
|
+
borderStyle: 'border-style',
|
|
5938
|
+
borderTop: 'border-top',
|
|
5939
|
+
borderTopColor: 'border-top-color',
|
|
5940
|
+
borderTopLeftRadius: 'border-top-left-radius',
|
|
5941
|
+
borderTopRightRadius: 'border-top-right-radius',
|
|
5942
|
+
borderTopStyle: 'border-top-style',
|
|
5943
|
+
borderTopWidth: 'border-top-width',
|
|
5944
|
+
borderWidth: 'border-width',
|
|
5945
|
+
boxDecorationBreak: 'box-decoration-break',
|
|
5946
|
+
boxShadow: 'box-shadow',
|
|
5947
|
+
boxSizing: 'box-sizing',
|
|
5948
|
+
breakAfter: 'break-after',
|
|
5949
|
+
breakBefore: 'break-before',
|
|
5950
|
+
breakInside: 'break-inside',
|
|
5951
|
+
captionSide: 'caption-side',
|
|
5952
|
+
caretColor: 'caret-color',
|
|
5953
|
+
clipPath: 'clip-path',
|
|
5954
|
+
columnCount: 'column-count',
|
|
5955
|
+
columnFill: 'column-fill',
|
|
5956
|
+
columnGap: 'column-gap',
|
|
5957
|
+
columnRule: 'column-rule',
|
|
5958
|
+
columnRuleColor: 'column-rule-color',
|
|
5959
|
+
columnRuleStyle: 'column-rule-style',
|
|
5960
|
+
columnRuleWidth: 'column-rule-width',
|
|
5961
|
+
columnSpan: 'column-span',
|
|
5962
|
+
columnWidth: 'column-width',
|
|
5963
|
+
counterIncrement: 'counter-increment',
|
|
5964
|
+
counterReset: 'counter-reset',
|
|
5965
|
+
emptyCells: 'empty-cells',
|
|
5966
|
+
flexBasis: 'flex-basis',
|
|
5967
|
+
flexDirection: 'flex-direction',
|
|
5968
|
+
flexFlow: 'flex-flow',
|
|
5969
|
+
flexGrow: 'flex-grow',
|
|
5970
|
+
flexShrink: 'flex-shrink',
|
|
5971
|
+
flexWrap: 'flex-wrap',
|
|
5972
|
+
fontFamily: 'font-family',
|
|
5973
|
+
fontFeatureSettings: 'font-feature-settings',
|
|
5974
|
+
fontKerning: 'font-kerning',
|
|
5975
|
+
fontLanguageOverride: 'font-language-override',
|
|
5976
|
+
fontSize: 'font-size',
|
|
5977
|
+
fontSizeAdjust: 'font-size-adjust',
|
|
5978
|
+
fontStretch: 'font-stretch',
|
|
5979
|
+
fontStyle: 'font-style',
|
|
5980
|
+
fontSynthesis: 'font-synthesis',
|
|
5981
|
+
fontVariant: 'font-variant',
|
|
5982
|
+
fontVariantAlternates: 'font-variant-alternates',
|
|
5983
|
+
fontVariantCaps: 'font-variant-caps',
|
|
5984
|
+
fontVariantEastAsian: 'font-variant-east-asian',
|
|
5985
|
+
fontVariantLigatures: 'font-variant-ligatures',
|
|
5986
|
+
fontVariantNumeric: 'font-variant-numeric',
|
|
5987
|
+
fontVariantPosition: 'font-variant-position',
|
|
5988
|
+
fontWeight: 'font-weight',
|
|
5989
|
+
gridArea: 'grid-area',
|
|
5990
|
+
gridAutoColumns: 'grid-auto-columns',
|
|
5991
|
+
gridAutoFlow: 'grid-auto-flow',
|
|
5992
|
+
gridAutoRows: 'grid-auto-rows',
|
|
5993
|
+
gridColumn: 'grid-column',
|
|
5994
|
+
gridColumnEnd: 'grid-column-end',
|
|
5995
|
+
gridColumnGap: 'grid-column-gap',
|
|
5996
|
+
gridColumnStart: 'grid-column-start',
|
|
5997
|
+
gridGap: 'grid-gap',
|
|
5998
|
+
gridRow: 'grid-row',
|
|
5999
|
+
gridRowEnd: 'grid-row-end',
|
|
6000
|
+
gridRowGap: 'grid-row-gap',
|
|
6001
|
+
gridRowStart: 'grid-row-start',
|
|
6002
|
+
gridTemplate: 'grid-template',
|
|
6003
|
+
gridTemplateAreas: 'grid-template-areas',
|
|
6004
|
+
gridTemplateColumns: 'grid-template-columns',
|
|
6005
|
+
gridTemplateRows: 'grid-template-rows',
|
|
6006
|
+
imageRendering: 'image-rendering',
|
|
6007
|
+
justifyContent: 'justify-content',
|
|
6008
|
+
letterSpacing: 'letter-spacing',
|
|
6009
|
+
lineBreak: 'line-break',
|
|
6010
|
+
lineHeight: 'line-height',
|
|
6011
|
+
listStyle: 'list-style',
|
|
6012
|
+
listStyleImage: 'list-style-image',
|
|
6013
|
+
listStylePosition: 'list-style-position',
|
|
6014
|
+
listStyleType: 'list-style-type',
|
|
6015
|
+
marginBottom: 'margin-bottom',
|
|
6016
|
+
marginLeft: 'margin-left',
|
|
6017
|
+
marginRight: 'margin-right',
|
|
6018
|
+
marginTop: 'margin-top',
|
|
6019
|
+
maskClip: 'mask-clip',
|
|
6020
|
+
maskComposite: 'mask-composite',
|
|
6021
|
+
maskImage: 'mask-image',
|
|
6022
|
+
maskMode: 'mask-mode',
|
|
6023
|
+
maskOrigin: 'mask-origin',
|
|
6024
|
+
maskPosition: 'mask-position',
|
|
6025
|
+
maskRepeat: 'mask-repeat',
|
|
6026
|
+
maskSize: 'mask-size',
|
|
6027
|
+
maskType: 'mask-type',
|
|
6028
|
+
maxHeight: 'max-height',
|
|
6029
|
+
maxWidth: 'max-width',
|
|
6030
|
+
minHeight: 'min-height',
|
|
6031
|
+
minWidth: 'min-width',
|
|
6032
|
+
mixBlendMode: 'mix-blend-mode',
|
|
6033
|
+
objectFit: 'object-fit',
|
|
6034
|
+
objectPosition: 'object-position',
|
|
6035
|
+
offsetAnchor: 'offset-anchor',
|
|
6036
|
+
offsetDistance: 'offset-distance',
|
|
6037
|
+
offsetPath: 'offset-path',
|
|
6038
|
+
offsetRotate: 'offset-rotate',
|
|
6039
|
+
outlineColor: 'outline-color',
|
|
6040
|
+
outlineOffset: 'outline-offset',
|
|
6041
|
+
outlineStyle: 'outline-style',
|
|
6042
|
+
outlineWidth: 'outline-width',
|
|
6043
|
+
overflowAnchor: 'overflow-anchor',
|
|
6044
|
+
overflowWrap: 'overflow-wrap',
|
|
6045
|
+
overflowX: 'overflow-x',
|
|
6046
|
+
overflowY: 'overflow-y',
|
|
6047
|
+
paddingBottom: 'padding-bottom',
|
|
6048
|
+
paddingLeft: 'padding-left',
|
|
6049
|
+
paddingRight: 'padding-right',
|
|
6050
|
+
paddingTop: 'padding-top',
|
|
6051
|
+
pageBreakAfter: 'page-break-after',
|
|
6052
|
+
pageBreakBefore: 'page-break-before',
|
|
6053
|
+
pageBreakInside: 'page-break-inside',
|
|
6054
|
+
perspectiveOrigin: 'perspective-origin',
|
|
6055
|
+
placeContent: 'place-content',
|
|
6056
|
+
placeItems: 'place-items',
|
|
6057
|
+
placeSelf: 'place-self',
|
|
6058
|
+
pointerEvents: 'pointer-events',
|
|
6059
|
+
rowGap: 'row-gap',
|
|
6060
|
+
scrollBehavior: 'scroll-behavior',
|
|
6061
|
+
scrollMargin: 'scroll-margin',
|
|
6062
|
+
scrollMarginBlock: 'scroll-margin-block',
|
|
6063
|
+
scrollMarginBlockEnd: 'scroll-margin-block-end',
|
|
6064
|
+
scrollMarginBlockStart: 'scroll-margin-block-start',
|
|
6065
|
+
scrollMarginBottom: 'scroll-margin-bottom',
|
|
6066
|
+
scrollMarginInline: 'scroll-margin-inline',
|
|
6067
|
+
scrollMarginInlineEnd: 'scroll-margin-inline-end',
|
|
6068
|
+
scrollMarginInlineStart: 'scroll-margin-inline-start',
|
|
6069
|
+
scrollMarginLeft: 'scroll-margin-left',
|
|
6070
|
+
scrollMarginRight: 'scroll-margin-right',
|
|
6071
|
+
scrollMarginTop: 'scroll-margin-top',
|
|
6072
|
+
scrollPadding: 'scroll-padding',
|
|
6073
|
+
scrollPaddingBlock: 'scroll-padding-block',
|
|
6074
|
+
scrollPaddingBlockEnd: 'scroll-padding-block-end',
|
|
6075
|
+
scrollPaddingBlockStart: 'scroll-padding-block-start',
|
|
6076
|
+
scrollPaddingBottom: 'scroll-padding-bottom',
|
|
6077
|
+
scrollPaddingInline: 'scroll-padding-inline',
|
|
6078
|
+
scrollPaddingInlineEnd: 'scroll-padding-inline-end',
|
|
6079
|
+
scrollPaddingInlineStart: 'scroll-padding-inline-start',
|
|
6080
|
+
scrollPaddingLeft: 'scroll-padding-left',
|
|
6081
|
+
scrollPaddingRight: 'scroll-padding-right',
|
|
6082
|
+
scrollPaddingTop: 'scroll-padding-top',
|
|
6083
|
+
scrollSnapAlign: 'scroll-snap-align',
|
|
6084
|
+
scrollSnapStop: 'scroll-snap-stop',
|
|
6085
|
+
scrollSnapType: 'scroll-snap-type',
|
|
6086
|
+
shapeImageThreshold: 'shape-image-threshold',
|
|
6087
|
+
shapeMargin: 'shape-margin',
|
|
6088
|
+
shapeOutside: 'shape-outside',
|
|
6089
|
+
tabSize: 'tab-size',
|
|
6090
|
+
tableLayout: 'table-layout',
|
|
6091
|
+
textAlign: 'text-align',
|
|
6092
|
+
textAlignLast: 'text-align-last',
|
|
6093
|
+
textCombineUpright: 'text-combine-upright',
|
|
6094
|
+
textDecoration: 'text-decoration',
|
|
6095
|
+
textDecorationColor: 'text-decoration-color',
|
|
6096
|
+
textDecorationLine: 'text-decoration-line',
|
|
6097
|
+
textDecorationStyle: 'text-decoration-style',
|
|
6098
|
+
textIndent: 'text-indent',
|
|
6099
|
+
textJustify: 'text-justify',
|
|
6100
|
+
textOrientation: 'text-orientation',
|
|
6101
|
+
textOverflow: 'text-overflow',
|
|
6102
|
+
textShadow: 'text-shadow',
|
|
6103
|
+
textTransform: 'text-transform',
|
|
6104
|
+
transformBox: 'transform-box',
|
|
6105
|
+
transformOrigin: 'transform-origin',
|
|
6106
|
+
transformStyle: 'transform-style',
|
|
6107
|
+
transitionDelay: 'transition-delay',
|
|
6108
|
+
transitionDuration: 'transition-duration',
|
|
6109
|
+
transitionProperty: 'transition-property',
|
|
6110
|
+
transitionTimingFunction: 'transition-timing-function',
|
|
6111
|
+
unicodeBidi: 'unicode-bidi',
|
|
6112
|
+
userSelect: 'user-select',
|
|
6113
|
+
verticalAlign: 'vertical-align',
|
|
6114
|
+
whiteSpace: 'white-space',
|
|
6115
|
+
willChange: 'will-change',
|
|
6116
|
+
wordBreak: 'word-break',
|
|
6117
|
+
wordSpacing: 'word-spacing',
|
|
6118
|
+
wordWrap: 'word-wrap',
|
|
6119
|
+
writingMode: 'writing-mode',
|
|
6120
|
+
zIndex: 'z-index',
|
|
6121
|
+
WebkitTransform: '-webkit-transform',
|
|
6122
|
+
WebkitTransition: '-webkit-transition',
|
|
6123
|
+
WebkitBoxShadow: '-webkit-box-shadow',
|
|
6124
|
+
MozBoxShadow: '-moz-box-shadow',
|
|
6125
|
+
MozTransform: '-moz-transform',
|
|
6126
|
+
MozTransition: '-moz-transition',
|
|
6127
|
+
msTransform: '-ms-transform',
|
|
6128
|
+
msTransition: '-ms-transition',
|
|
6129
|
+
};
|
|
6130
|
+
|
|
6131
|
+
/** @type {Record<string | symbol, string>} */
|
|
6132
|
+
static cssPropAliases = new Proxy(TinyHtml_TinyHtml.#cssPropAliases, {
|
|
6133
|
+
set(target, camelCaseKey, kebabValue) {
|
|
6134
|
+
target[camelCaseKey] = kebabValue;
|
|
6135
|
+
// @ts-ignore
|
|
6136
|
+
TinyHtml_TinyHtml.cssPropRevAliases[kebabValue] = camelCaseKey;
|
|
6137
|
+
return true;
|
|
6138
|
+
},
|
|
6139
|
+
});
|
|
6140
|
+
|
|
6141
|
+
/** @type {Record<string | symbol, string>} */
|
|
6142
|
+
static cssPropRevAliases = Object.fromEntries(
|
|
6143
|
+
Object.entries(TinyHtml_TinyHtml.#cssPropAliases).map(([camel, kebab]) => [kebab, camel]),
|
|
6144
|
+
);
|
|
6145
|
+
|
|
6146
|
+
/**
|
|
6147
|
+
* Converts a camelCase string to kebab-case
|
|
6148
|
+
* @param {string} str
|
|
6149
|
+
* @returns {string}
|
|
6150
|
+
*/
|
|
6151
|
+
static toStyleKc(str) {
|
|
6152
|
+
if (typeof TinyHtml_TinyHtml.cssPropAliases[str] === 'string') return TinyHtml_TinyHtml.cssPropAliases[str];
|
|
6153
|
+
return str;
|
|
6154
|
+
}
|
|
6155
|
+
|
|
6156
|
+
/**
|
|
6157
|
+
* Converts a kebab-case string to camelCase
|
|
6158
|
+
* @param {string} str
|
|
6159
|
+
* @returns {string}
|
|
6160
|
+
*/
|
|
6161
|
+
static toStyleCc(str) {
|
|
6162
|
+
if (typeof TinyHtml_TinyHtml.cssPropRevAliases[str] === 'string') return TinyHtml_TinyHtml.cssPropRevAliases[str];
|
|
6163
|
+
return str;
|
|
6164
|
+
}
|
|
6165
|
+
|
|
6166
|
+
/**
|
|
6167
|
+
* Sets one or more CSS inline style properties on the given element(s).
|
|
6168
|
+
*
|
|
6169
|
+
* - If `prop` is a string, the `value` will be applied to that property.
|
|
6170
|
+
* - If `prop` is an object, each key-value pair will be applied as a CSS property and value.
|
|
6171
|
+
*
|
|
6172
|
+
* @param {TinyHtmlElement|TinyHtmlElement[]} el - The element to inspect.
|
|
6173
|
+
* @param {string|Object} prop - The property name or an object with key-value pairs
|
|
6174
|
+
* @param {string|null} [value=null] - The value to set (if `prop` is a string)
|
|
6175
|
+
*/
|
|
6176
|
+
static setStyle(el, prop, value = null) {
|
|
6177
|
+
TinyHtml_TinyHtml._preHtmlElems(el, 'setStyle').forEach((elem) => {
|
|
6178
|
+
if (typeof prop === 'object') {
|
|
6179
|
+
for (const [k, v] of Object.entries(prop)) {
|
|
6180
|
+
elem.style.setProperty(
|
|
6181
|
+
TinyHtml_TinyHtml.toStyleKc(k),
|
|
6182
|
+
typeof v === 'string' ? v : typeof v === 'number' ? `${v}px` : String(v),
|
|
6183
|
+
);
|
|
6184
|
+
}
|
|
6185
|
+
} else elem.style.setProperty(TinyHtml_TinyHtml.toStyleKc(prop), value);
|
|
6186
|
+
});
|
|
6187
|
+
}
|
|
6188
|
+
|
|
6189
|
+
/**
|
|
6190
|
+
* Sets one or more CSS inline style properties on the given element(s).
|
|
6191
|
+
*
|
|
6192
|
+
* - If `prop` is a string, the `value` will be applied to that property.
|
|
6193
|
+
* - If `prop` is an object, each key-value pair will be applied as a CSS property and value.
|
|
6194
|
+
*
|
|
6195
|
+
* @param {string|Object} prop - The property name or an object with key-value pairs
|
|
6196
|
+
* @param {string|null} [value=null] - The value to set (if `prop` is a string)
|
|
6197
|
+
*/
|
|
6198
|
+
setStyle(prop, value) {
|
|
6199
|
+
return TinyHtml_TinyHtml.setStyle(this, prop, value);
|
|
6200
|
+
}
|
|
6201
|
+
|
|
6202
|
+
/**
|
|
6203
|
+
* Gets the value of a specific inline style property.
|
|
6204
|
+
*
|
|
6205
|
+
* Returns only the value set directly via the `style` attribute.
|
|
6206
|
+
*
|
|
6207
|
+
* @param {TinyHtmlElement|TinyHtmlElement[]} el - A single element to inspect.
|
|
6208
|
+
* @param {string} prop - The style property name to retrieve.
|
|
6209
|
+
* @returns {string} The style value of the specified property.
|
|
6210
|
+
*/
|
|
6211
|
+
static getStyle(el, prop) {
|
|
6212
|
+
return TinyHtml_TinyHtml._preHtmlElem(el, 'getStyle').style.getPropertyValue(TinyHtml_TinyHtml.toStyleKc(prop));
|
|
6213
|
+
}
|
|
6214
|
+
|
|
6215
|
+
/**
|
|
6216
|
+
* Gets the value of a specific inline style property.
|
|
6217
|
+
*
|
|
6218
|
+
* Returns only the value set directly via the `style` attribute.
|
|
6219
|
+
*
|
|
6220
|
+
* @param {string} prop - The style property name to retrieve.
|
|
6221
|
+
* @returns {string} The style value of the specified property.
|
|
6222
|
+
*/
|
|
6223
|
+
getStyle(prop) {
|
|
6224
|
+
return TinyHtml_TinyHtml.getStyle(this, prop);
|
|
6225
|
+
}
|
|
6226
|
+
|
|
6227
|
+
/**
|
|
6228
|
+
* Gets all inline styles defined directly on the element (`style` attribute).
|
|
6229
|
+
*
|
|
6230
|
+
* Returns an object with all property-value pairs in kebab-case format.
|
|
6231
|
+
*
|
|
6232
|
+
* @param {TinyHtmlElement|TinyHtmlElement[]} el - A single element to inspect.
|
|
6233
|
+
* @param {Object} [settings={}] - Optional configuration settings.
|
|
6234
|
+
* @param {boolean} [settings.camelCase=false] - If `true`, the property names will be converted to camelCase.
|
|
6235
|
+
* @param {boolean} [settings.rawAttr=false] - If `true`, reads the style string from the `style` attribute instead of using the style object.
|
|
6236
|
+
* @returns {Record<string, string>} All inline styles as an object.
|
|
6237
|
+
*
|
|
6238
|
+
* @throws {TypeError} If `camelCase` or `rawAttr` is not a boolean.
|
|
6239
|
+
*/
|
|
6240
|
+
static style(el, { camelCase = false, rawAttr = false } = {}) {
|
|
6241
|
+
if (typeof camelCase !== 'boolean')
|
|
6242
|
+
throw new TypeError(`"camelCase" must be a boolean. Received: ${typeof camelCase}`);
|
|
6243
|
+
if (typeof rawAttr !== 'boolean')
|
|
6244
|
+
throw new TypeError(`"rawAttr" must be a boolean. Received: ${typeof rawAttr}`);
|
|
6245
|
+
|
|
6246
|
+
const elem = TinyHtml_TinyHtml._preHtmlElem(el, 'style');
|
|
6247
|
+
/** @type {Record<string, string>} */
|
|
6248
|
+
const result = {};
|
|
6249
|
+
|
|
6250
|
+
if (rawAttr) {
|
|
6251
|
+
const raw = elem.getAttribute('style') || '';
|
|
6252
|
+
const entries = raw.split(';');
|
|
6253
|
+
for (const entry of entries) {
|
|
6254
|
+
const [rawProp, rawVal] = entry.split(':');
|
|
6255
|
+
if (!rawProp || !rawVal) continue;
|
|
6256
|
+
|
|
6257
|
+
const prop = rawProp.trim();
|
|
6258
|
+
const value = rawVal.trim();
|
|
6259
|
+
result[camelCase ? TinyHtml_TinyHtml.toStyleCc(prop) : prop] = value;
|
|
6260
|
+
}
|
|
6261
|
+
} else {
|
|
6262
|
+
const styles = elem.style;
|
|
6263
|
+
for (let i = 0; i < styles.length; i++) {
|
|
6264
|
+
const prop = styles[i]; // Already in kebab-case
|
|
6265
|
+
const value = styles.getPropertyValue(prop);
|
|
6266
|
+
result[camelCase ? TinyHtml_TinyHtml.toStyleCc(prop) : prop] = value;
|
|
6267
|
+
}
|
|
6268
|
+
}
|
|
6269
|
+
|
|
6270
|
+
return result;
|
|
6271
|
+
}
|
|
6272
|
+
|
|
6273
|
+
/**
|
|
6274
|
+
* Gets all inline styles defined directly on the element (`style` attribute).
|
|
6275
|
+
*
|
|
6276
|
+
* Returns an object with all property-value pairs in kebab-case format.
|
|
6277
|
+
*
|
|
6278
|
+
* @param {Object} [settings={}] - Optional configuration settings.
|
|
6279
|
+
* @param {boolean} [settings.camelCase=false] - If `true`, the property names will be converted to camelCase.
|
|
6280
|
+
* @param {boolean} [settings.rawAttr=false] - If `true`, reads the style string from the `style` attribute instead of using the style object.
|
|
6281
|
+
* @returns {Record<string, string>} All inline styles as an object.
|
|
6282
|
+
*/
|
|
6283
|
+
style(settings) {
|
|
6284
|
+
return TinyHtml_TinyHtml.style(this, settings);
|
|
6285
|
+
}
|
|
6286
|
+
|
|
6287
|
+
/**
|
|
6288
|
+
* Removes one or more inline CSS properties from the given element(s).
|
|
6289
|
+
*
|
|
6290
|
+
* @param {TinyHtmlElement|TinyHtmlElement[]} el - A single element or an array of elements.
|
|
6291
|
+
* @param {string|string[]} prop - A property name or an array of property names to remove.
|
|
6292
|
+
*/
|
|
6293
|
+
static removeStyle(el, prop) {
|
|
6294
|
+
TinyHtml_TinyHtml._preHtmlElems(el, 'removeStyle').forEach((elem) => {
|
|
6295
|
+
if (Array.isArray(prop)) {
|
|
6296
|
+
for (const p of prop) {
|
|
6297
|
+
elem.style.removeProperty(TinyHtml_TinyHtml.toStyleKc(p));
|
|
6298
|
+
}
|
|
6299
|
+
} else elem.style.removeProperty(TinyHtml_TinyHtml.toStyleKc(prop));
|
|
6300
|
+
});
|
|
6301
|
+
}
|
|
6302
|
+
|
|
6303
|
+
/**
|
|
6304
|
+
* Removes one or more inline CSS properties from the given element(s).
|
|
6305
|
+
*
|
|
6306
|
+
* @param {string|string[]} prop - A property name or an array of property names to remove.
|
|
6307
|
+
*/
|
|
6308
|
+
removeStyle(prop) {
|
|
6309
|
+
return TinyHtml_TinyHtml.removeStyle(this, prop);
|
|
6310
|
+
}
|
|
6311
|
+
|
|
6312
|
+
/**
|
|
6313
|
+
* Toggles a CSS property value between two given values.
|
|
6314
|
+
*
|
|
6315
|
+
* The current computed value is compared to `val1`. If it matches, the property is set to `val2`. Otherwise, it is set to `val1`.
|
|
6316
|
+
*
|
|
6317
|
+
* @param {TinyHtmlElement|TinyHtmlElement[]} el - A single element or an array of elements.
|
|
6318
|
+
* @param {string} prop - The CSS property to toggle.
|
|
6319
|
+
* @param {string} val1 - The first value (used as "current" check).
|
|
6320
|
+
* @param {string} val2 - The second value (used as the "alternative").
|
|
6321
|
+
*/
|
|
6322
|
+
static toggleStyle(el, prop, val1, val2) {
|
|
6323
|
+
TinyHtml_TinyHtml._preHtmlElems(el, 'toggleStyle').forEach((elem) => {
|
|
6324
|
+
const current = TinyHtml_TinyHtml.getStyle(elem, prop).trim();
|
|
6325
|
+
const newVal = current === TinyHtml_TinyHtml.toStyleKc(val1) ? val2 : val1;
|
|
6326
|
+
TinyHtml_TinyHtml.setStyle(elem, prop, newVal);
|
|
6327
|
+
});
|
|
6328
|
+
}
|
|
6329
|
+
|
|
6330
|
+
/**
|
|
6331
|
+
* Toggles a CSS property value between two given values.
|
|
6332
|
+
*
|
|
6333
|
+
* The current computed value is compared to `val1`. If it matches, the property is set to `val2`. Otherwise, it is set to `val1`.
|
|
6334
|
+
*
|
|
6335
|
+
* @param {string} prop - The CSS property to toggle.
|
|
6336
|
+
* @param {string} val1 - The first value (used as "current" check).
|
|
6337
|
+
* @param {string} val2 - The second value (used as the "alternative").
|
|
6338
|
+
*/
|
|
6339
|
+
toggleStyle(prop, val1, val2) {
|
|
6340
|
+
return TinyHtml_TinyHtml.toggleStyle(this, prop, val1, val2);
|
|
6341
|
+
}
|
|
6342
|
+
|
|
6343
|
+
/**
|
|
6344
|
+
* Removes all inline styles (`style` attribute) from the given element(s).
|
|
6345
|
+
*
|
|
6346
|
+
* @param {TinyElement|TinyElement[]} el - A single element or an array of elements.
|
|
6347
|
+
*/
|
|
6348
|
+
static clearStyle(el) {
|
|
6349
|
+
TinyHtml_TinyHtml._preElems(el, 'clearStyle').forEach((elem) => elem.removeAttribute('style'));
|
|
6350
|
+
}
|
|
6351
|
+
|
|
6352
|
+
/**
|
|
6353
|
+
* Removes all inline styles (`style` attribute) from the given element(s).
|
|
6354
|
+
*
|
|
6355
|
+
*/
|
|
6356
|
+
clearStyle() {
|
|
6357
|
+
return TinyHtml_TinyHtml.clearStyle(this);
|
|
6358
|
+
}
|
|
6359
|
+
|
|
6360
|
+
//////////////////////////////////////////////////////////////////////
|
|
6361
|
+
|
|
5874
6362
|
/**
|
|
5875
6363
|
* Focus the element.
|
|
5876
6364
|
*
|
|
@@ -9868,6 +10356,7 @@ class TinyDragger {
|
|
|
9868
10356
|
|
|
9869
10357
|
|
|
9870
10358
|
|
|
10359
|
+
|
|
9871
10360
|
|
|
9872
10361
|
|
|
9873
10362
|
;// ./src/v1/libs/TinyUploadClicker.mjs
|