@markuplint/ml-spec 2.0.0-dev.26 → 2.0.0-rc.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/attributes.d.ts +77 -11
- package/lib/get-attr-specs.d.ts +7 -0
- package/lib/get-attr-specs.js +95 -0
- package/lib/get-spec-by-tag-name.js +11 -3
- package/lib/get-spec.js +22 -5
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/permitted-structres.d.ts +12 -0
- package/lib/types.d.ts +25 -13
- package/package.json +6 -4
- package/schemas/attributes.schema.json +168 -181
- package/schemas/global-attributes.schema.json +749 -6
- package/schemas/permitted-structures.schema.json +19 -7
- package/src/attributes.ts +1393 -108
- package/src/get-attr-specs.spec.ts +44 -0
- package/src/get-attr-specs.ts +111 -0
- package/src/get-spec-by-tag-name.ts +14 -6
- package/src/get-spec.spec.ts +10 -17
- package/src/get-spec.ts +27 -6
- package/src/index.ts +1 -0
- package/src/permitted-structres.ts +12 -0
- package/src/types.ts +30 -13
- package/tsconfig.tsbuildinfo +1 -1
package/lib/attributes.d.ts
CHANGED
|
@@ -3,29 +3,95 @@
|
|
|
3
3
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
|
4
4
|
* and run json-schema-to-typescript to regenerate this file.
|
|
5
5
|
*/
|
|
6
|
-
export declare type AttributeType = ('String' | 'NonEmptyString' | 'Boolean' | 'Function' | 'Date' | 'Int' | 'Uint' | 'Float' | 'NonZeroUint' | 'ZeroToOne' | 'AcceptList' | 'AutoComplete' | 'BCP47' | 'Color' | 'ColSpan' | 'Coords' | 'Crossorigin' | 'DateTime' | 'Destination' | 'DOMID' | 'DOMIDList' | 'IRI' | 'ItemType' | 'LinkSizes' | 'LinkType' | 'LinkTypeList' | 'MediaQuery' | 'MediaQueryList' | 'MIMEType' | 'ReferrerPolicy' | 'RowSpan' | 'SourceSizeList' | 'SrcSet' | 'TabIndex' | 'Target' | 'URL' | 'URLHash' | 'URLList' | 'CSSAngle' | 'CSSBlendMode' | 'CSSClipPath' | 'CSSCustomIdent' | 'CSSDisplay' | 'CSSFilter' | 'CSSFontFamily' | 'CSSFontSize' | 'CSSFontVariant' | 'CSSFontWeight' | 'CSSMask' | 'CSSOpacity' | 'CSSTextDecoration' | 'CSSTransformList' | 'CSSTransformOrigin' | 'CSSURL' | 'SVGAnimatableValue' | 'SVGBeginValueList' | 'SVGClockValue' | 'SVGColorMatrix' | 'SVGDashArray' | 'SVGEndValueList' | 'SVGFilterPrimitiveReference' | 'SVGKernelMatrix' | 'SVGKeyPoints' | 'SVGKeySplines' | 'SVGKeyTimes' | 'SVGLanguageTags' | 'SVGLength' | 'SVGLengthList' | 'SVGNumberList' | 'SVGNumberOptionalNumber' | 'SVGOrigin' | 'SVGPaint' | 'SVGPathCommands' | 'SVGPercentage' | 'SVGPercentageList' | 'SVGPoints' | 'SVGPreserveAspectRatio' | 'SVGViewBox') | {
|
|
7
|
-
|
|
6
|
+
export declare type AttributeType = (("<'--*'>" | "<'-ms-accelerator'>" | "<'-ms-block-progression'>" | "<'-ms-content-zoom-chaining'>" | "<'-ms-content-zooming'>" | "<'-ms-content-zoom-limit'>" | "<'-ms-content-zoom-limit-max'>" | "<'-ms-content-zoom-limit-min'>" | "<'-ms-content-zoom-snap'>" | "<'-ms-content-zoom-snap-points'>" | "<'-ms-content-zoom-snap-type'>" | "<'-ms-filter'>" | "<'-ms-flow-from'>" | "<'-ms-flow-into'>" | "<'-ms-grid-columns'>" | "<'-ms-grid-rows'>" | "<'-ms-high-contrast-adjust'>" | "<'-ms-hyphenate-limit-chars'>" | "<'-ms-hyphenate-limit-lines'>" | "<'-ms-hyphenate-limit-zone'>" | "<'-ms-ime-align'>" | "<'-ms-overflow-style'>" | "<'-ms-scrollbar-3dlight-color'>" | "<'-ms-scrollbar-arrow-color'>" | "<'-ms-scrollbar-base-color'>" | "<'-ms-scrollbar-darkshadow-color'>" | "<'-ms-scrollbar-face-color'>" | "<'-ms-scrollbar-highlight-color'>" | "<'-ms-scrollbar-shadow-color'>" | "<'-ms-scrollbar-track-color'>" | "<'-ms-scroll-chaining'>" | "<'-ms-scroll-limit'>" | "<'-ms-scroll-limit-x-max'>" | "<'-ms-scroll-limit-x-min'>" | "<'-ms-scroll-limit-y-max'>" | "<'-ms-scroll-limit-y-min'>" | "<'-ms-scroll-rails'>" | "<'-ms-scroll-snap-points-x'>" | "<'-ms-scroll-snap-points-y'>" | "<'-ms-scroll-snap-type'>" | "<'-ms-scroll-snap-x'>" | "<'-ms-scroll-snap-y'>" | "<'-ms-scroll-translation'>" | "<'-ms-text-autospace'>" | "<'-ms-touch-select'>" | "<'-ms-user-select'>" | "<'-ms-wrap-flow'>" | "<'-ms-wrap-margin'>" | "<'-ms-wrap-through'>" | "<'-moz-appearance'>" | "<'-moz-binding'>" | "<'-moz-border-bottom-colors'>" | "<'-moz-border-left-colors'>" | "<'-moz-border-right-colors'>" | "<'-moz-border-top-colors'>" | "<'-moz-context-properties'>" | "<'-moz-float-edge'>" | "<'-moz-force-broken-image-icon'>" | "<'-moz-image-region'>" | "<'-moz-orient'>" | "<'-moz-outline-radius'>" | "<'-moz-outline-radius-bottomleft'>" | "<'-moz-outline-radius-bottomright'>" | "<'-moz-outline-radius-topleft'>" | "<'-moz-outline-radius-topright'>" | "<'-moz-stack-sizing'>" | "<'-moz-text-blink'>" | "<'-moz-user-focus'>" | "<'-moz-user-input'>" | "<'-moz-user-modify'>" | "<'-moz-window-dragging'>" | "<'-moz-window-shadow'>" | "<'-webkit-appearance'>" | "<'-webkit-border-before'>" | "<'-webkit-border-before-color'>" | "<'-webkit-border-before-style'>" | "<'-webkit-border-before-width'>" | "<'-webkit-box-reflect'>" | "<'-webkit-line-clamp'>" | "<'-webkit-mask'>" | "<'-webkit-mask-attachment'>" | "<'-webkit-mask-clip'>" | "<'-webkit-mask-composite'>" | "<'-webkit-mask-image'>" | "<'-webkit-mask-origin'>" | "<'-webkit-mask-position'>" | "<'-webkit-mask-position-x'>" | "<'-webkit-mask-position-y'>" | "<'-webkit-mask-repeat'>" | "<'-webkit-mask-repeat-x'>" | "<'-webkit-mask-repeat-y'>" | "<'-webkit-mask-size'>" | "<'-webkit-overflow-scrolling'>" | "<'-webkit-tap-highlight-color'>" | "<'-webkit-text-fill-color'>" | "<'-webkit-text-stroke'>" | "<'-webkit-text-stroke-color'>" | "<'-webkit-text-stroke-width'>" | "<'-webkit-touch-callout'>" | "<'-webkit-user-modify'>" | "<'align-content'>" | "<'align-items'>" | "<'align-self'>" | "<'align-tracks'>" | "<'all'>" | "<'animation'>" | "<'animation-delay'>" | "<'animation-direction'>" | "<'animation-duration'>" | "<'animation-fill-mode'>" | "<'animation-iteration-count'>" | "<'animation-name'>" | "<'animation-play-state'>" | "<'animation-timing-function'>" | "<'appearance'>" | "<'aspect-ratio'>" | "<'azimuth'>" | "<'backdrop-filter'>" | "<'backface-visibility'>" | "<'background'>" | "<'background-attachment'>" | "<'background-blend-mode'>" | "<'background-clip'>" | "<'background-color'>" | "<'background-image'>" | "<'background-origin'>" | "<'background-position'>" | "<'background-position-x'>" | "<'background-position-y'>" | "<'background-repeat'>" | "<'background-size'>" | "<'block-overflow'>" | "<'block-size'>" | "<'border'>" | "<'border-block'>" | "<'border-block-color'>" | "<'border-block-style'>" | "<'border-block-width'>" | "<'border-block-end'>" | "<'border-block-end-color'>" | "<'border-block-end-style'>" | "<'border-block-end-width'>" | "<'border-block-start'>" | "<'border-block-start-color'>" | "<'border-block-start-style'>" | "<'border-block-start-width'>" | "<'border-bottom'>" | "<'border-bottom-color'>" | "<'border-bottom-left-radius'>" | "<'border-bottom-right-radius'>" | "<'border-bottom-style'>" | "<'border-bottom-width'>" | "<'border-collapse'>" | "<'border-color'>" | "<'border-end-end-radius'>" | "<'border-end-start-radius'>" | "<'border-image'>" | "<'border-image-outset'>" | "<'border-image-repeat'>" | "<'border-image-slice'>" | "<'border-image-source'>" | "<'border-image-width'>" | "<'border-inline'>" | "<'border-inline-end'>" | "<'border-inline-color'>" | "<'border-inline-style'>" | "<'border-inline-width'>" | "<'border-inline-end-color'>" | "<'border-inline-end-style'>" | "<'border-inline-end-width'>" | "<'border-inline-start'>" | "<'border-inline-start-color'>" | "<'border-inline-start-style'>" | "<'border-inline-start-width'>" | "<'border-left'>" | "<'border-left-color'>" | "<'border-left-style'>" | "<'border-left-width'>" | "<'border-radius'>" | "<'border-right'>" | "<'border-right-color'>" | "<'border-right-style'>" | "<'border-right-width'>" | "<'border-spacing'>" | "<'border-start-end-radius'>" | "<'border-start-start-radius'>" | "<'border-style'>" | "<'border-top'>" | "<'border-top-color'>" | "<'border-top-left-radius'>" | "<'border-top-right-radius'>" | "<'border-top-style'>" | "<'border-top-width'>" | "<'border-width'>" | "<'bottom'>" | "<'box-align'>" | "<'box-decoration-break'>" | "<'box-direction'>" | "<'box-flex'>" | "<'box-flex-group'>" | "<'box-lines'>" | "<'box-ordinal-group'>" | "<'box-orient'>" | "<'box-pack'>" | "<'box-shadow'>" | "<'box-sizing'>" | "<'break-after'>" | "<'break-before'>" | "<'break-inside'>" | "<'caption-side'>" | "<'caret-color'>" | "<'clear'>" | "<'clip'>" | "<'clip-path'>" | "<'color'>" | "<'color-adjust'>" | "<'column-count'>" | "<'column-fill'>" | "<'column-gap'>" | "<'column-rule'>" | "<'column-rule-color'>" | "<'column-rule-style'>" | "<'column-rule-width'>" | "<'column-span'>" | "<'column-width'>" | "<'columns'>" | "<'contain'>" | "<'content'>" | "<'counter-increment'>" | "<'counter-reset'>" | "<'counter-set'>" | "<'cursor'>" | "<'direction'>" | "<'display'>" | "<'empty-cells'>" | "<'filter'>" | "<'flex'>" | "<'flex-basis'>" | "<'flex-direction'>" | "<'flex-flow'>" | "<'flex-grow'>" | "<'flex-shrink'>" | "<'flex-wrap'>" | "<'float'>" | "<'font'>" | "<'font-family'>" | "<'font-feature-settings'>" | "<'font-kerning'>" | "<'font-language-override'>" | "<'font-optical-sizing'>" | "<'font-variation-settings'>" | "<'font-size'>" | "<'font-size-adjust'>" | "<'font-smooth'>" | "<'font-stretch'>" | "<'font-style'>" | "<'font-synthesis'>" | "<'font-variant'>" | "<'font-variant-alternates'>" | "<'font-variant-caps'>" | "<'font-variant-east-asian'>" | "<'font-variant-ligatures'>" | "<'font-variant-numeric'>" | "<'font-variant-position'>" | "<'font-weight'>" | "<'gap'>" | "<'grid'>" | "<'grid-area'>" | "<'grid-auto-columns'>" | "<'grid-auto-flow'>" | "<'grid-auto-rows'>" | "<'grid-column'>" | "<'grid-column-end'>" | "<'grid-column-gap'>" | "<'grid-column-start'>" | "<'grid-gap'>" | "<'grid-row'>" | "<'grid-row-end'>" | "<'grid-row-gap'>" | "<'grid-row-start'>" | "<'grid-template'>" | "<'grid-template-areas'>" | "<'grid-template-columns'>" | "<'grid-template-rows'>" | "<'hanging-punctuation'>" | "<'height'>" | "<'hyphens'>" | "<'image-orientation'>" | "<'image-rendering'>" | "<'image-resolution'>" | "<'ime-mode'>" | "<'initial-letter'>" | "<'initial-letter-align'>" | "<'inline-size'>" | "<'inset'>" | "<'inset-block'>" | "<'inset-block-end'>" | "<'inset-block-start'>" | "<'inset-inline'>" | "<'inset-inline-end'>" | "<'inset-inline-start'>" | "<'isolation'>" | "<'justify-content'>" | "<'justify-items'>" | "<'justify-self'>" | "<'justify-tracks'>" | "<'left'>" | "<'letter-spacing'>" | "<'line-break'>" | "<'line-clamp'>" | "<'line-height'>" | "<'line-height-step'>" | "<'list-style'>" | "<'list-style-image'>" | "<'list-style-position'>" | "<'list-style-type'>" | "<'margin'>" | "<'margin-block'>" | "<'margin-block-end'>" | "<'margin-block-start'>" | "<'margin-bottom'>" | "<'margin-inline'>" | "<'margin-inline-end'>" | "<'margin-inline-start'>" | "<'margin-left'>" | "<'margin-right'>" | "<'margin-top'>" | "<'margin-trim'>" | "<'mask'>" | "<'mask-border'>" | "<'mask-border-mode'>" | "<'mask-border-outset'>" | "<'mask-border-repeat'>" | "<'mask-border-slice'>" | "<'mask-border-source'>" | "<'mask-border-width'>" | "<'mask-clip'>" | "<'mask-composite'>" | "<'mask-image'>" | "<'mask-mode'>" | "<'mask-origin'>" | "<'mask-position'>" | "<'mask-repeat'>" | "<'mask-size'>" | "<'mask-type'>" | "<'masonry-auto-flow'>" | "<'math-style'>" | "<'max-block-size'>" | "<'max-height'>" | "<'max-inline-size'>" | "<'max-lines'>" | "<'max-width'>" | "<'min-block-size'>" | "<'min-height'>" | "<'min-inline-size'>" | "<'min-width'>" | "<'mix-blend-mode'>" | "<'object-fit'>" | "<'object-position'>" | "<'offset'>" | "<'offset-anchor'>" | "<'offset-distance'>" | "<'offset-path'>" | "<'offset-position'>" | "<'offset-rotate'>" | "<'opacity'>" | "<'order'>" | "<'orphans'>" | "<'outline'>" | "<'outline-color'>" | "<'outline-offset'>" | "<'outline-style'>" | "<'outline-width'>" | "<'overflow'>" | "<'overflow-anchor'>" | "<'overflow-block'>" | "<'overflow-clip-box'>" | "<'overflow-inline'>" | "<'overflow-wrap'>" | "<'overflow-x'>" | "<'overflow-y'>" | "<'overscroll-behavior'>" | "<'overscroll-behavior-block'>" | "<'overscroll-behavior-inline'>" | "<'overscroll-behavior-x'>" | "<'overscroll-behavior-y'>" | "<'padding'>" | "<'padding-block'>" | "<'padding-block-end'>" | "<'padding-block-start'>" | "<'padding-bottom'>" | "<'padding-inline'>" | "<'padding-inline-end'>" | "<'padding-inline-start'>" | "<'padding-left'>" | "<'padding-right'>" | "<'padding-top'>" | "<'page-break-after'>" | "<'page-break-before'>" | "<'page-break-inside'>" | "<'paint-order'>" | "<'perspective'>" | "<'perspective-origin'>" | "<'place-content'>" | "<'place-items'>" | "<'place-self'>" | "<'pointer-events'>" | "<'position'>" | "<'quotes'>" | "<'resize'>" | "<'right'>" | "<'rotate'>" | "<'row-gap'>" | "<'ruby-align'>" | "<'ruby-merge'>" | "<'ruby-position'>" | "<'scale'>" | "<'scrollbar-color'>" | "<'scrollbar-gutter'>" | "<'scrollbar-width'>" | "<'scroll-behavior'>" | "<'scroll-margin'>" | "<'scroll-margin-block'>" | "<'scroll-margin-block-start'>" | "<'scroll-margin-block-end'>" | "<'scroll-margin-bottom'>" | "<'scroll-margin-inline'>" | "<'scroll-margin-inline-start'>" | "<'scroll-margin-inline-end'>" | "<'scroll-margin-left'>" | "<'scroll-margin-right'>" | "<'scroll-margin-top'>" | "<'scroll-padding'>" | "<'scroll-padding-block'>" | "<'scroll-padding-block-start'>" | "<'scroll-padding-block-end'>" | "<'scroll-padding-bottom'>" | "<'scroll-padding-inline'>" | "<'scroll-padding-inline-start'>" | "<'scroll-padding-inline-end'>" | "<'scroll-padding-left'>" | "<'scroll-padding-right'>" | "<'scroll-padding-top'>" | "<'scroll-snap-align'>" | "<'scroll-snap-coordinate'>" | "<'scroll-snap-destination'>" | "<'scroll-snap-points-x'>" | "<'scroll-snap-points-y'>" | "<'scroll-snap-stop'>" | "<'scroll-snap-type'>" | "<'scroll-snap-type-x'>" | "<'scroll-snap-type-y'>" | "<'shape-image-threshold'>" | "<'shape-margin'>" | "<'shape-outside'>" | "<'tab-size'>" | "<'table-layout'>" | "<'text-align'>" | "<'text-align-last'>" | "<'text-combine-upright'>" | "<'text-decoration'>" | "<'text-decoration-color'>" | "<'text-decoration-line'>" | "<'text-decoration-skip'>" | "<'text-decoration-skip-ink'>" | "<'text-decoration-style'>" | "<'text-decoration-thickness'>" | "<'text-emphasis'>" | "<'text-emphasis-color'>" | "<'text-emphasis-position'>" | "<'text-emphasis-style'>" | "<'text-indent'>" | "<'text-justify'>" | "<'text-orientation'>" | "<'text-overflow'>" | "<'text-rendering'>" | "<'text-shadow'>" | "<'text-size-adjust'>" | "<'text-transform'>" | "<'text-underline-offset'>" | "<'text-underline-position'>" | "<'top'>" | "<'touch-action'>" | "<'transform'>" | "<'transform-box'>" | "<'transform-origin'>" | "<'transform-style'>" | "<'transition'>" | "<'transition-delay'>" | "<'transition-duration'>" | "<'transition-property'>" | "<'transition-timing-function'>" | "<'translate'>" | "<'unicode-bidi'>" | "<'user-select'>" | "<'vertical-align'>" | "<'visibility'>" | "<'white-space'>" | "<'widows'>" | "<'width'>" | "<'will-change'>" | "<'word-break'>" | "<'word-spacing'>" | "<'word-wrap'>" | "<'writing-mode'>" | "<'z-index'>" | "<'zoom'>" | "<'-moz-background-clip'>" | "<'-moz-border-radius-bottomleft'>" | "<'-moz-border-radius-bottomright'>" | "<'-moz-border-radius-topleft'>" | "<'-moz-border-radius-topright'>" | "<'-moz-control-character-visibility'>" | "<'-moz-osx-font-smoothing'>" | "<'-moz-user-select'>" | "<'-ms-flex-align'>" | "<'-ms-flex-item-align'>" | "<'-ms-flex-line-pack'>" | "<'-ms-flex-negative'>" | "<'-ms-flex-pack'>" | "<'-ms-flex-order'>" | "<'-ms-flex-positive'>" | "<'-ms-flex-preferred-size'>" | "<'-ms-interpolation-mode'>" | "<'-ms-grid-column-align'>" | "<'-ms-grid-row-align'>" | "<'-ms-hyphenate-limit-last'>" | "<'-webkit-background-clip'>" | "<'-webkit-column-break-after'>" | "<'-webkit-column-break-before'>" | "<'-webkit-column-break-inside'>" | "<'-webkit-font-smoothing'>" | "<'-webkit-mask-box-image'>" | "<'-webkit-print-color-adjust'>" | "<'-webkit-text-security'>" | "<'-webkit-user-drag'>" | "<'-webkit-user-select'>" | "<'alignment-baseline'>" | "<'baseline-shift'>" | "<'behavior'>" | "<'clip-rule'>" | "<'cue'>" | "<'cue-after'>" | "<'cue-before'>" | "<'dominant-baseline'>" | "<'fill'>" | "<'fill-opacity'>" | "<'fill-rule'>" | "<'glyph-orientation-horizontal'>" | "<'glyph-orientation-vertical'>" | "<'kerning'>" | "<'marker'>" | "<'marker-end'>" | "<'marker-mid'>" | "<'marker-start'>" | "<'pause'>" | "<'pause-after'>" | "<'pause-before'>" | "<'rest'>" | "<'rest-after'>" | "<'rest-before'>" | "<'shape-rendering'>" | "<'src'>" | "<'speak'>" | "<'speak-as'>" | "<'stroke'>" | "<'stroke-dasharray'>" | "<'stroke-dashoffset'>" | "<'stroke-linecap'>" | "<'stroke-linejoin'>" | "<'stroke-miterlimit'>" | "<'stroke-opacity'>" | "<'stroke-width'>" | "<'text-anchor'>" | "<'unicode-range'>" | "<'voice-balance'>" | "<'voice-duration'>" | "<'voice-family'>" | "<'voice-pitch'>" | "<'voice-range'>" | "<'voice-rate'>" | "<'voice-stress'>" | "<'voice-volume'>" | '<absolute-size>' | '<alpha-value>' | '<angle-percentage>' | '<angular-color-hint>' | '<angular-color-stop>' | '<angular-color-stop-list>' | '<animateable-feature>' | '<attachment>' | '<attr()>' | '<attr-matcher>' | '<attr-modifier>' | '<attribute-selector>' | '<auto-repeat>' | '<auto-track-list>' | '<baseline-position>' | '<basic-shape>' | '<bg-image>' | '<bg-layer>' | '<bg-position>' | '<bg-size>' | '<blur()>' | '<blend-mode>' | '<box>' | '<brightness()>' | '<calc()>' | '<calc-sum>' | '<calc-product>' | '<calc-value>' | '<cf-final-image>' | '<cf-mixing-image>' | '<circle()>' | '<clamp()>' | '<class-selector>' | '<clip-source>' | '<color>' | '<color-stop>' | '<color-stop-angle>' | '<color-stop-length>' | '<color-stop-list>' | '<combinator>' | '<common-lig-values>' | '<compat-auto>' | '<composite-style>' | '<compositing-operator>' | '<compound-selector>' | '<compound-selector-list>' | '<complex-selector>' | '<complex-selector-list>' | '<conic-gradient()>' | '<contextual-alt-values>' | '<content-distribution>' | '<content-list>' | '<content-position>' | '<content-replacement>' | '<contrast()>' | '<counter()>' | '<counter-style>' | '<counter-style-name>' | '<counters()>' | '<cross-fade()>' | '<cubic-bezier-timing-function>' | '<deprecated-system-color>' | '<discretionary-lig-values>' | '<display-box>' | '<display-inside>' | '<display-internal>' | '<display-legacy>' | '<display-listitem>' | '<display-outside>' | '<drop-shadow()>' | '<east-asian-variant-values>' | '<east-asian-width-values>' | '<element()>' | '<ellipse()>' | '<ending-shape>' | '<env()>' | '<explicit-track-list>' | '<family-name>' | '<feature-tag-value>' | '<feature-type>' | '<feature-value-block>' | '<feature-value-block-list>' | '<feature-value-declaration>' | '<feature-value-declaration-list>' | '<feature-value-name>' | '<fill-rule>' | '<filter-function>' | '<filter-function-list>' | '<final-bg-layer>' | '<fit-content()>' | '<fixed-breadth>' | '<fixed-repeat>' | '<fixed-size>' | '<font-stretch-absolute>' | '<font-variant-css21>' | '<font-weight-absolute>' | '<frequency-percentage>' | '<general-enclosed>' | '<generic-family>' | '<generic-name>' | '<geometry-box>' | '<gradient>' | '<grayscale()>' | '<grid-line>' | '<historical-lig-values>' | '<hsl()>' | '<hsla()>' | '<hue>' | '<hue-rotate()>' | '<id-selector>' | '<image>' | '<image()>' | '<image-set()>' | '<image-set-option>' | '<image-src>' | '<image-tags>' | '<inflexible-breadth>' | '<inset()>' | '<invert()>' | '<keyframes-name>' | '<keyframe-block>' | '<keyframe-block-list>' | '<keyframe-selector>' | '<leader()>' | '<leader-type>' | '<length-percentage>' | '<line-names>' | '<line-name-list>' | '<line-style>' | '<line-width>' | '<linear-color-hint>' | '<linear-color-stop>' | '<linear-gradient()>' | '<mask-layer>' | '<mask-position>' | '<mask-reference>' | '<mask-source>' | '<masking-mode>' | '<matrix()>' | '<matrix3d()>' | '<max()>' | '<media-and>' | '<media-condition>' | '<media-condition-without-or>' | '<media-feature>' | '<media-in-parens>' | '<media-not>' | '<media-or>' | '<media-query>' | '<media-query-list>' | '<media-type>' | '<mf-boolean>' | '<mf-name>' | '<mf-plain>' | '<mf-range>' | '<mf-value>' | '<min()>' | '<minmax()>' | '<named-color>' | '<namespace-prefix>' | '<ns-prefix>' | '<number-percentage>' | '<numeric-figure-values>' | '<numeric-fraction-values>' | '<numeric-spacing-values>' | '<nth>' | '<opacity()>' | '<overflow-position>' | '<outline-radius>' | '<page-body>' | '<page-margin-box>' | '<page-margin-box-type>' | '<page-selector-list>' | '<page-selector>' | '<path()>' | '<paint()>' | '<perspective()>' | '<polygon()>' | '<position>' | '<pseudo-class-selector>' | '<pseudo-element-selector>' | '<pseudo-page>' | '<quote>' | '<radial-gradient()>' | '<relative-selector>' | '<relative-selector-list>' | '<relative-size>' | '<repeat-style>' | '<repeating-linear-gradient()>' | '<repeating-radial-gradient()>' | '<rgb()>' | '<rgba()>' | '<rotate()>' | '<rotate3d()>' | '<rotateX()>' | '<rotateY()>' | '<rotateZ()>' | '<saturate()>' | '<scale()>' | '<scale3d()>' | '<scaleX()>' | '<scaleY()>' | '<scaleZ()>' | '<self-position>' | '<shape-radius>' | '<skew()>' | '<skewX()>' | '<skewY()>' | '<sepia()>' | '<shadow>' | '<shadow-t>' | '<shape>' | '<shape-box>' | '<side-or-corner>' | '<single-animation>' | '<single-animation-direction>' | '<single-animation-fill-mode>' | '<single-animation-iteration-count>' | '<single-animation-play-state>' | '<single-transition>' | '<single-transition-property>' | '<size>' | '<step-position>' | '<step-timing-function>' | '<subclass-selector>' | '<supports-condition>' | '<supports-in-parens>' | '<supports-feature>' | '<supports-decl>' | '<supports-selector-fn>' | '<symbol>' | '<target>' | '<target-counter()>' | '<target-counters()>' | '<target-text()>' | '<time-percentage>' | '<timing-function>' | '<track-breadth>' | '<track-list>' | '<track-repeat>' | '<track-size>' | '<transform-function>' | '<transform-list>' | '<translate()>' | '<translate3d()>' | '<translateX()>' | '<translateY()>' | '<translateZ()>' | '<type-or-unit>' | '<type-selector>' | '<var()>' | '<viewport-length>' | '<wq-name>' | '<-legacy-gradient>' | '<-legacy-linear-gradient>' | '<-legacy-repeating-linear-gradient>' | '<-legacy-linear-gradient-arguments>' | '<-legacy-radial-gradient>' | '<-legacy-repeating-radial-gradient>' | '<-legacy-radial-gradient-arguments>' | '<-legacy-radial-gradient-size>' | '<-legacy-radial-gradient-shape>' | '<-non-standard-font>' | '<-non-standard-color>' | '<-non-standard-image-rendering>' | '<-non-standard-overflow>' | '<-non-standard-width>' | '<-webkit-gradient()>' | '<-webkit-gradient-color-stop>' | '<-webkit-gradient-point>' | '<-webkit-gradient-radius>' | '<-webkit-gradient-type>' | '<-webkit-mask-box-repeat>' | '<-webkit-mask-clip-style>' | '<-ms-filter-function-list>' | '<-ms-filter-function>' | '<-ms-filter-function-progid>' | '<-ms-filter-function-legacy>' | '<-ms-filter>' | '<age>' | '<attr-name>' | '<attr-fallback>' | '<border-radius>' | '<bottom>' | '<generic-voice>' | '<gender>' | '<left>' | '<mask-image>' | '<name-repeat>' | '<paint>' | '<page-size>' | '<ratio>' | '<right>' | '<svg-length>' | '<svg-writing-mode>' | '<top>' | '<track-group>' | '<track-list-v0>' | '<track-minmax>' | '<x>' | '<y>' | '<declaration>' | '<declaration-list>' | '<url>' | '<url-modifier>' | '<number-zero-one>' | '<number-one-or-greater>' | '<positive-integer>' | '<-non-standard-display>' | '<ident-token>' | '<function-token>' | '<at-keyword-token>' | '<hash-token>' | '<string-token>' | '<bad-string-token>' | '<url-token>' | '<bad-url-token>' | '<delim-token>' | '<number-token>' | '<percentage-token>' | '<dimension-token>' | '<whitespace-token>' | '<CDO-token>' | '<CDC-token>' | '<colon-token>' | '<semicolon-token>' | '<comma-token>' | '<[-token>' | '<]-token>' | '<(-token>' | '<)-token>' | '<{-token>' | '<}-token>' | '<string>' | '<ident>' | '<custom-ident>' | '<custom-property-name>' | '<hex-color>' | '<an-plus-b>' | '<urange>' | '<declaration-value>' | '<any-value>' | '<dimension>' | '<angle>' | '<decibel>' | '<frequency>' | '<flex>' | '<length>' | '<resolution>' | '<semitones>' | '<time>' | '<percentage>' | '<zero>' | '<number>' | '<integer>' | '<-ms-legacy-expression>' | '<bcp-47>') | ('Any' | 'NoEmptyAny' | 'OneLineAny' | 'Zero' | 'Number' | 'Int' | 'Uint' | 'XMLName' | 'DOMID' | 'FunctionBody' | 'Pattern' | 'DateTime' | 'TabIndex' | 'BCP47' | 'URL' | 'AbsoluteURL' | 'HashName' | 'OneCodePointChar' | 'CustomElementName' | 'BrowsingContextName' | 'BrowsingContextNameOrKeyword' | 'HTTPSchemaURL' | 'MIMEType' | 'ItemProp' | 'Srcset' | 'SourceSizeList' | 'IconSize' | 'AutoComplete' | 'Accept' | 'SerializedPermissionsPolicy' | '<css-declaration-list>' | '<class-list>' | '<svg-font-size>' | '<svg-font-size-adjust>' | "<'color-profile'>" | "<'color-rendering'>" | "<'enable-background'>" | '<list-of-svg-feature-string>' | '<animatable-value>' | '<begin-value-list>' | '<end-value-list>' | '<list-of-value>' | '<clock-value>' | '<color-matrix>' | '<dasharray>' | '<key-points>' | '<key-splines>' | '<key-times>' | '<system-language>' | '<origin>' | '<svg-path>' | '<points>' | '<preserve-aspect-ratio>' | '<view-box>' | '<rotate>' | '<text-coordinate>' | '<list-of-lengths>' | '<list-of-numbers>' | '<list-of-percentages>' | '<number-optional-number>') | 'Boolean') | {
|
|
7
|
+
token: ('Any' | 'NoEmptyAny' | 'OneLineAny' | 'Zero' | 'Number' | 'Int' | 'Uint' | 'XMLName' | 'DOMID' | 'FunctionBody' | 'Pattern' | 'DateTime' | 'TabIndex' | 'BCP47' | 'URL' | 'AbsoluteURL' | 'HashName' | 'OneCodePointChar' | 'CustomElementName' | 'BrowsingContextName' | 'BrowsingContextNameOrKeyword' | 'HTTPSchemaURL' | 'MIMEType' | 'ItemProp' | 'Srcset' | 'SourceSizeList' | 'IconSize' | 'AutoComplete' | 'Accept' | 'SerializedPermissionsPolicy' | '<css-declaration-list>' | '<class-list>' | '<svg-font-size>' | '<svg-font-size-adjust>' | "<'color-profile'>" | "<'color-rendering'>" | "<'enable-background'>" | '<list-of-svg-feature-string>' | '<animatable-value>' | '<begin-value-list>' | '<end-value-list>' | '<list-of-value>' | '<clock-value>' | '<color-matrix>' | '<dasharray>' | '<key-points>' | '<key-splines>' | '<key-times>' | '<system-language>' | '<origin>' | '<svg-path>' | '<points>' | '<preserve-aspect-ratio>' | '<view-box>' | '<rotate>' | '<text-coordinate>' | '<list-of-lengths>' | '<list-of-numbers>' | '<list-of-percentages>' | '<number-optional-number>') | {
|
|
8
|
+
enum: [string, ...string[]];
|
|
9
|
+
disallowToSurroundBySpaces?: boolean;
|
|
10
|
+
caseInsensitive?: boolean;
|
|
11
|
+
invalidValueDefault?: string;
|
|
12
|
+
missingValueDefault?: string;
|
|
13
|
+
sameStates?: {
|
|
14
|
+
[k: string]: unknown;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
disallowToSurroundBySpaces?: boolean;
|
|
18
|
+
allowEmpty?: boolean;
|
|
19
|
+
ordered?: boolean;
|
|
20
|
+
unique?: boolean;
|
|
21
|
+
caseInsensitive?: boolean;
|
|
22
|
+
number?: ('zeroOrMore' | 'oneOrMore') | {
|
|
23
|
+
min: number;
|
|
24
|
+
max: number;
|
|
25
|
+
};
|
|
26
|
+
separator: 'space' | 'comma';
|
|
27
|
+
} | {
|
|
28
|
+
enum: [string, ...string[]];
|
|
29
|
+
disallowToSurroundBySpaces?: boolean;
|
|
30
|
+
caseInsensitive?: boolean;
|
|
31
|
+
invalidValueDefault?: string;
|
|
32
|
+
missingValueDefault?: string;
|
|
33
|
+
sameStates?: {
|
|
34
|
+
[k: string]: unknown;
|
|
35
|
+
};
|
|
36
|
+
} | {
|
|
37
|
+
type: 'float' | 'integer';
|
|
38
|
+
gt?: number;
|
|
39
|
+
gte?: number;
|
|
40
|
+
lt?: number;
|
|
41
|
+
lte?: number;
|
|
42
|
+
clampable?: boolean;
|
|
8
43
|
};
|
|
9
44
|
export declare type AttributeCondition = {
|
|
10
|
-
ancestor:
|
|
45
|
+
ancestor: Selectors;
|
|
11
46
|
} | {
|
|
12
|
-
self:
|
|
47
|
+
self: Selectors;
|
|
13
48
|
};
|
|
49
|
+
export declare type Selectors = string | [string, string, ...string[]];
|
|
14
50
|
export interface AttributesSchema {
|
|
15
51
|
tag: string;
|
|
16
|
-
|
|
52
|
+
ref: string;
|
|
53
|
+
global?: GlobalAttributes;
|
|
54
|
+
attributes: Attributes;
|
|
55
|
+
}
|
|
56
|
+
export interface GlobalAttributes {
|
|
57
|
+
'#HTMLGlobalAttrs'?: boolean;
|
|
58
|
+
'#GlobalEventAttrs'?: boolean | ('onabort' | 'onauxclick' | 'onbeforeinput' | 'onblur' | 'oncancel' | 'oncanplay' | 'oncanplaythrough' | 'onchange' | 'onclick' | 'onclose' | 'oncontextlost' | 'oncompositionstart' | 'oncompositionupdate' | 'oncompositionend' | 'oncontextmenu' | 'oncontextrestored' | 'oncuechange' | 'ondblclick' | 'ondrag' | 'ondragend' | 'ondragenter' | 'ondragleave' | 'ondragover' | 'ondragstart' | 'ondrop' | 'ondurationchange' | 'onemptied' | 'onended' | 'onerror' | 'onfocus' | 'onformdata' | 'onfocusin' | 'onfocusout' | 'oninput' | 'oninvalid' | 'onkeydown' | 'onkeypress' | 'onkeyup' | 'onload' | 'onloadeddata' | 'onloadedmetadata' | 'onloadstart' | 'onmousedown' | 'onmouseenter' | 'onmouseleave' | 'onmousemove' | 'onmouseout' | 'onmouseover' | 'onmouseup' | 'onpause' | 'onplay' | 'onplaying' | 'onprogress' | 'onratechange' | 'onreset' | 'onresize' | 'onscroll' | 'onsecuritypolicyviolation' | 'onseeked' | 'onseeking' | 'onselect' | 'onslotchange' | 'onstalled' | 'onsubmit' | 'onsuspend' | 'ontimeupdate' | 'ontoggle' | 'onvolumechange' | 'onwaiting' | 'onwebkitanimationend' | 'onwebkitanimationiteration' | 'onwebkitanimationstart' | 'onwebkittransitionend' | 'onunload' | 'onwheel')[];
|
|
59
|
+
'#DocumentElementEventAttrs'?: boolean | ('oncopy' | 'oncut' | 'onpaste')[];
|
|
60
|
+
'#HTMLLinkAndFetchingAttrs'?: ('crossorigin' | 'download' | 'href' | 'hreflang' | 'integrity' | 'loading' | 'media' | 'ping' | 'referrerpolicy' | 'rel' | 'target' | 'type')[];
|
|
61
|
+
'#HTMLEmbededAndMediaContentAttrs'?: ('autoplay' | 'controls' | 'height' | 'loop' | 'muted' | 'preload' | 'sizes' | 'src' | 'srcset' | 'width')[];
|
|
62
|
+
'#HTMLFormControlElementAttrs'?: ('autocomplete' | 'dirname' | 'disabled' | 'form' | 'formaction' | 'formenctype' | 'formmethod' | 'formnovalidate' | 'formtarget' | 'maxlength' | 'minlength' | 'name' | 'readonly' | 'required')[];
|
|
63
|
+
'#HTMLTableCellElementAttrs'?: ('colspan' | 'headers' | 'rowspan')[];
|
|
64
|
+
'#ARIAAttrs'?: boolean;
|
|
65
|
+
'#SVGAnimationAdditionAttrs'?: ('additive' | 'accumulate')[];
|
|
66
|
+
'#SVGAnimationAttributeTargetAttrs'?: ('attributeName' | 'attributeType')[];
|
|
67
|
+
'#SVGAnimationEventAttrs'?: ('onbegin' | 'onend' | 'onrepeat')[];
|
|
68
|
+
'#SVGAnimationTargetElementAttrs'?: ('href' | 'xlink:href')[];
|
|
69
|
+
'#SVGAnimationTimingAttrs'?: ('begin' | 'dur' | 'end' | 'min' | 'max' | 'restart' | 'repeatCount' | 'repeatDur' | 'fill')[];
|
|
70
|
+
'#SVGAnimationValueAttrs'?: ('calcMode' | 'values' | 'keyTimes' | 'keySplines' | 'from' | 'to' | 'by' | 'accelerate' | 'decelerate' | 'autoReverse' | 'speed')[];
|
|
71
|
+
'#SVGConditionalProcessingAttrs'?: ('requiredExtensions' | 'systemLanguage' | 'requiredFeatures')[];
|
|
72
|
+
'#SVGCoreAttrs'?: ('id' | 'tabindex' | 'autofocus' | 'lang' | 'xml:space' | 'class' | 'style' | 'xmlns' | 'xml:lang' | 'xml:base')[];
|
|
73
|
+
'#SVGFilterPrimitiveAttrs'?: ('x' | 'y' | 'width' | 'height' | 'result' | 'in')[];
|
|
74
|
+
'#SVGPresentationAttrs'?: ('cx' | 'cy' | 'height' | 'width' | 'x' | 'y' | 'r' | 'rx' | 'ry' | 'd' | 'fill' | 'transform' | 'patternTransform' | 'gradientTransform' | 'alignment-baseline' | 'baseline-shift' | 'clip-path' | 'clip-rule' | 'color' | 'color-interpolation' | 'color-interpolation-filters' | 'cursor' | 'direction' | 'display' | 'dominant-baseline' | 'fill-opacity' | 'fill-rule' | 'filter' | 'flood-color' | 'flood-opacity' | 'font' | 'font-family' | 'font-size' | 'font-size-adjust' | 'font-stretch' | 'font-style' | 'font-variant' | 'font-weight' | 'glyph-orientation-horizontal' | 'glyph-orientation-vertical' | 'image-rendering' | 'isolation' | 'letter-spacing' | 'lighting-color' | 'marker' | 'marker-end' | 'marker-mid' | 'marker-start' | 'mask' | 'mask-type' | 'opacity' | 'overflow' | 'paint-order' | 'pointer-events' | 'shape-rendering' | 'stop-color' | 'stop-opacity' | 'stroke' | 'stroke-dasharray' | 'stroke-dashoffset' | 'stroke-linecap' | 'stroke-linejoin' | 'stroke-miterlimit' | 'stroke-opacity' | 'stroke-width' | 'text-anchor' | 'text-decoration' | 'text-overflow' | 'text-rendering' | 'transform-origin' | 'unicode-bidi' | 'vector-effect' | 'visibility' | 'white-space' | 'word-spacing' | 'writing-mode' | 'clip' | 'color-profile' | 'color-rendering' | 'enable-background' | 'kerning')[];
|
|
75
|
+
'#SVGTransferFunctionAttrs'?: ('type' | 'tableValues' | 'slope' | 'intercept' | 'amplitude' | 'exponent' | 'offset')[];
|
|
76
|
+
'#XLinkAttrs'?: ('xlink:href' | 'xlink:title' | 'xlink:actuate' | 'xlink:arcrole' | 'xlink:role' | 'xlink:show' | 'xlink:type')[];
|
|
77
|
+
}
|
|
78
|
+
export interface Attributes {
|
|
79
|
+
[k: string]: AttributeJSON;
|
|
17
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* This interface was referenced by `Attributes`'s JSON-Schema definition
|
|
83
|
+
* via the `patternProperty` ".*".
|
|
84
|
+
*/
|
|
18
85
|
export interface AttributeJSON {
|
|
19
|
-
|
|
20
|
-
|
|
86
|
+
_TODO_?: string;
|
|
87
|
+
ref: string;
|
|
88
|
+
type?: AttributeType | [AttributeType, ...AttributeType[]];
|
|
21
89
|
defaultValue?: string;
|
|
22
90
|
deprecated?: boolean;
|
|
23
91
|
required?: boolean | AttributeCondition;
|
|
24
92
|
requiredEither?: string[];
|
|
25
93
|
noUse?: boolean;
|
|
26
94
|
condition?: AttributeCondition;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
name: string;
|
|
30
|
-
defaultValue: string;
|
|
95
|
+
ineffective?: Selectors;
|
|
96
|
+
animatable?: boolean;
|
|
31
97
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { MLMLSpec, Attribute } from './types';
|
|
2
|
+
export declare function getAttrSpecs(nameWithNS: string, schema: MLMLSpec): Attribute[] | null;
|
|
3
|
+
declare type HasName = {
|
|
4
|
+
name: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function nameCompare(a: HasName | string, b: HasName | string): 1 | -1 | 0;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.nameCompare = exports.getAttrSpecs = void 0;
|
|
4
|
+
const cacheMap = new Map();
|
|
5
|
+
const schemaCache = new WeakSet();
|
|
6
|
+
function getAttrSpecs(nameWithNS, schema) {
|
|
7
|
+
if (!schemaCache.has(schema)) {
|
|
8
|
+
cacheMap.clear();
|
|
9
|
+
}
|
|
10
|
+
const cache = cacheMap.get(nameWithNS);
|
|
11
|
+
if (cache !== undefined) {
|
|
12
|
+
return cache;
|
|
13
|
+
}
|
|
14
|
+
schemaCache.add(schema);
|
|
15
|
+
const elSpec = schema.specs.find(spec => spec.name === nameWithNS);
|
|
16
|
+
if (!elSpec) {
|
|
17
|
+
cacheMap.set(nameWithNS, null);
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
const globalAttrs = schema.def['#globalAttrs'];
|
|
21
|
+
let attrs = {};
|
|
22
|
+
for (const catName in elSpec.globalAttrs) {
|
|
23
|
+
// @ts-ignore
|
|
24
|
+
const catAttrs = elSpec.globalAttrs[catName];
|
|
25
|
+
if (!catAttrs) {
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
if (typeof catAttrs === 'boolean') {
|
|
29
|
+
const global = globalAttrs[catName];
|
|
30
|
+
attrs = {
|
|
31
|
+
...attrs,
|
|
32
|
+
...global,
|
|
33
|
+
};
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
if (Array.isArray(catAttrs)) {
|
|
37
|
+
const global = globalAttrs[catName];
|
|
38
|
+
if (!global) {
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
catAttrs.forEach(selectedName => {
|
|
42
|
+
const selected = global[selectedName];
|
|
43
|
+
attrs[selectedName] = {
|
|
44
|
+
...attrs[selectedName],
|
|
45
|
+
...selected,
|
|
46
|
+
};
|
|
47
|
+
});
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
for (const attrName in elSpec.attributes) {
|
|
52
|
+
const attr = elSpec.attributes[attrName];
|
|
53
|
+
if (!attr) {
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
const current = attrs[attrName];
|
|
57
|
+
attrs[attrName] = {
|
|
58
|
+
description: '',
|
|
59
|
+
...current,
|
|
60
|
+
...attr,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
const attrList = Object.keys(attrs).map(name => {
|
|
64
|
+
const attr = attrs[name];
|
|
65
|
+
return { name, type: 'Any', ...attr };
|
|
66
|
+
});
|
|
67
|
+
for (const attr of attrList) {
|
|
68
|
+
if (!attr.type) {
|
|
69
|
+
throw new Error(`The type is empty in the ${attr.name} attribute of the ${nameWithNS} element,
|
|
70
|
+
'packages',
|
|
71
|
+
'@markuplint',
|
|
72
|
+
'html-spec',
|
|
73
|
+
'src',
|
|
74
|
+
'attributes',
|
|
75
|
+
nameWithNS.replace(':', '_') + '.json',
|
|
76
|
+
)})`);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
attrList.sort(nameCompare);
|
|
80
|
+
cacheMap.set(nameWithNS, attrList);
|
|
81
|
+
return attrList;
|
|
82
|
+
}
|
|
83
|
+
exports.getAttrSpecs = getAttrSpecs;
|
|
84
|
+
function nameCompare(a, b) {
|
|
85
|
+
const nameA = typeof a === 'string' ? a : a.name.toUpperCase();
|
|
86
|
+
const nameB = typeof b === 'string' ? b : b.name.toUpperCase();
|
|
87
|
+
if (nameA < nameB) {
|
|
88
|
+
return -1;
|
|
89
|
+
}
|
|
90
|
+
if (nameA > nameB) {
|
|
91
|
+
return 1;
|
|
92
|
+
}
|
|
93
|
+
return 0;
|
|
94
|
+
}
|
|
95
|
+
exports.nameCompare = nameCompare;
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getSpecByTagName = void 0;
|
|
4
|
-
|
|
4
|
+
const get_attr_specs_1 = require("./get-attr-specs");
|
|
5
|
+
const cacheMap = new WeakMap();
|
|
6
|
+
function getSpecOM(spec) {
|
|
7
|
+
const cache = cacheMap.get(spec);
|
|
8
|
+
if (cache) {
|
|
9
|
+
return cache;
|
|
10
|
+
}
|
|
5
11
|
const som = {};
|
|
6
|
-
for (const el of specs) {
|
|
12
|
+
for (const el of spec.specs) {
|
|
13
|
+
const attributes = (0, get_attr_specs_1.getAttrSpecs)(el.name, spec);
|
|
7
14
|
som[el.name] = {
|
|
8
15
|
experimental: !!el.experimental,
|
|
9
16
|
obsolete: typeof el.obsolete === 'boolean' ? !!el.obsolete : el.obsolete ? el.obsolete.alt : false,
|
|
@@ -11,9 +18,10 @@ function getSpecOM({ specs }) {
|
|
|
11
18
|
nonStandard: !!el.nonStandard,
|
|
12
19
|
categories: el.categories,
|
|
13
20
|
permittedStructures: el.permittedStructures,
|
|
14
|
-
attributes:
|
|
21
|
+
attributes: Object.values(attributes || {}),
|
|
15
22
|
};
|
|
16
23
|
}
|
|
24
|
+
cacheMap.set(spec, som);
|
|
17
25
|
return som;
|
|
18
26
|
}
|
|
19
27
|
function getSpecByTagName(nameWithNS, specs) {
|
package/lib/get-spec.js
CHANGED
|
@@ -22,10 +22,10 @@ function getSpec(schemas) {
|
|
|
22
22
|
result.def['#ariaAttrs'] = [...result.def['#ariaAttrs'], ...extendedSpec.def['#ariaAttrs']];
|
|
23
23
|
}
|
|
24
24
|
if ((_a = extendedSpec.def['#globalAttrs']) === null || _a === void 0 ? void 0 : _a['#extends']) {
|
|
25
|
-
result.def['#globalAttrs']['#HTMLGlobalAttrs'] =
|
|
26
|
-
...(((_b = result.def['#globalAttrs']) === null || _b === void 0 ? void 0 : _b['#HTMLGlobalAttrs']) ||
|
|
27
|
-
...(((_c = extendedSpec.def['#globalAttrs']) === null || _c === void 0 ? void 0 : _c['#extends']) ||
|
|
28
|
-
|
|
25
|
+
result.def['#globalAttrs']['#HTMLGlobalAttrs'] = {
|
|
26
|
+
...(((_b = result.def['#globalAttrs']) === null || _b === void 0 ? void 0 : _b['#HTMLGlobalAttrs']) || {}),
|
|
27
|
+
...(((_c = extendedSpec.def['#globalAttrs']) === null || _c === void 0 ? void 0 : _c['#extends']) || {}),
|
|
28
|
+
};
|
|
29
29
|
}
|
|
30
30
|
if (extendedSpec.def['#roles']) {
|
|
31
31
|
result.def['#roles'] = [...result.def['#roles'], ...extendedSpec.def['#roles']];
|
|
@@ -56,7 +56,11 @@ function getSpec(schemas) {
|
|
|
56
56
|
specs.push({
|
|
57
57
|
...elSpec,
|
|
58
58
|
...exSpec,
|
|
59
|
-
|
|
59
|
+
globalAttrs: {
|
|
60
|
+
...elSpec.globalAttrs,
|
|
61
|
+
...exSpec.globalAttrs,
|
|
62
|
+
},
|
|
63
|
+
attributes: mergeAttrSpec(elSpec.attributes, exSpec.attributes),
|
|
60
64
|
categories: (0, utils_1.mergeArray)(elSpec.categories, exSpec.categories),
|
|
61
65
|
});
|
|
62
66
|
}
|
|
@@ -66,3 +70,16 @@ function getSpec(schemas) {
|
|
|
66
70
|
return result;
|
|
67
71
|
}
|
|
68
72
|
exports.getSpec = getSpec;
|
|
73
|
+
function mergeAttrSpec(std, ex = {}) {
|
|
74
|
+
const result = {};
|
|
75
|
+
const keys = Array.from(new Set([...Object.keys(std), ...Object.keys(ex)]));
|
|
76
|
+
for (const key of keys) {
|
|
77
|
+
const _std = std[key];
|
|
78
|
+
const _ex = ex[key];
|
|
79
|
+
result[key] = {
|
|
80
|
+
..._std,
|
|
81
|
+
..._ex,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
return result;
|
|
85
|
+
}
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
(0, tslib_1.__exportStar)(require("./permitted-structres"), exports);
|
|
5
5
|
(0, tslib_1.__exportStar)(require("./attributes"), exports);
|
|
6
|
+
(0, tslib_1.__exportStar)(require("./get-attr-specs"), exports);
|
|
6
7
|
(0, tslib_1.__exportStar)(require("./get-spec-by-tag-name"), exports);
|
|
7
8
|
(0, tslib_1.__exportStar)(require("./get-spec"), exports);
|
|
8
9
|
(0, tslib_1.__exportStar)(require("./get-ns"), exports);
|
|
@@ -16,6 +16,12 @@ export interface PermittedStructuresSchema {
|
|
|
16
16
|
hasAttr: string;
|
|
17
17
|
} | {
|
|
18
18
|
parent: string;
|
|
19
|
+
/**
|
|
20
|
+
* Not support yet
|
|
21
|
+
*/
|
|
22
|
+
hasNotAttr?: string;
|
|
23
|
+
_TODO_?: string;
|
|
24
|
+
_parent?: string;
|
|
19
25
|
};
|
|
20
26
|
contents: PermittedContentSpec | boolean;
|
|
21
27
|
}[];
|
|
@@ -28,24 +34,28 @@ export interface PermittedContentRequire {
|
|
|
28
34
|
notAllowedDescendants?: Node[];
|
|
29
35
|
max?: number;
|
|
30
36
|
min?: number;
|
|
37
|
+
_TODO_?: string;
|
|
31
38
|
}
|
|
32
39
|
export interface PermittedContentOptional {
|
|
33
40
|
optional: Target;
|
|
34
41
|
ignore?: Target;
|
|
35
42
|
notAllowedDescendants?: Node[];
|
|
36
43
|
max?: number;
|
|
44
|
+
_TODO_?: string;
|
|
37
45
|
}
|
|
38
46
|
export interface PermittedContentOneOrMore {
|
|
39
47
|
oneOrMore: Target | PermittedContentSpec;
|
|
40
48
|
ignore?: Target;
|
|
41
49
|
notAllowedDescendants?: Node[];
|
|
42
50
|
max?: number;
|
|
51
|
+
_TODO_?: string;
|
|
43
52
|
}
|
|
44
53
|
export interface PermittedContentZeroOrMore {
|
|
45
54
|
zeroOrMore: Target | PermittedContentSpec;
|
|
46
55
|
ignore?: Target;
|
|
47
56
|
notAllowedDescendants?: Node[];
|
|
48
57
|
max?: number;
|
|
58
|
+
_TODO_?: string;
|
|
49
59
|
}
|
|
50
60
|
export interface PermittedContentChoice {
|
|
51
61
|
choice: [PermittedContentSpec, PermittedContentSpec] | [PermittedContentSpec, PermittedContentSpec, PermittedContentSpec] | [PermittedContentSpec, PermittedContentSpec, PermittedContentSpec, PermittedContentSpec] | [
|
|
@@ -55,7 +65,9 @@ export interface PermittedContentChoice {
|
|
|
55
65
|
PermittedContentSpec,
|
|
56
66
|
PermittedContentSpec
|
|
57
67
|
];
|
|
68
|
+
_TODO_?: string;
|
|
58
69
|
}
|
|
59
70
|
export interface PermittedContentInterleave {
|
|
60
71
|
interleave: [PermittedContentSpec, PermittedContentSpec, ...PermittedContentSpec[]];
|
|
72
|
+
_TODO_?: string;
|
|
61
73
|
}
|
package/lib/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AttributeJSON } from '.';
|
|
2
|
+
import type { AttributeType, GlobalAttributes } from './attributes';
|
|
2
3
|
import type { ContentModel, PermittedStructuresSchema } from './permitted-structres';
|
|
3
4
|
/**
|
|
4
5
|
* markuplit Markup-language spec
|
|
@@ -8,8 +9,9 @@ export interface MLMLSpec {
|
|
|
8
9
|
def: SpecDefs;
|
|
9
10
|
specs: ElementSpec[];
|
|
10
11
|
}
|
|
11
|
-
declare type ExtendedElementSpec = Partial<ElementSpec
|
|
12
|
+
export declare type ExtendedElementSpec = Partial<Omit<ElementSpec, 'name' | 'attributes'>> & {
|
|
12
13
|
name: ElementSpec['name'];
|
|
14
|
+
attributes?: Record<string, Partial<Attribute>>;
|
|
13
15
|
};
|
|
14
16
|
export declare type ExtendedSpec = {
|
|
15
17
|
cites?: Cites;
|
|
@@ -22,9 +24,9 @@ export declare type ExtendedSpec = {
|
|
|
22
24
|
export declare type Cites = string[];
|
|
23
25
|
export declare type SpecDefs = {
|
|
24
26
|
'#globalAttrs': Partial<{
|
|
25
|
-
'#extends': Attribute
|
|
26
|
-
'#HTMLGlobalAttrs': Attribute
|
|
27
|
-
[OtherGlobalAttrs: string]: Attribute
|
|
27
|
+
'#extends': Record<string, Partial<Attribute>>;
|
|
28
|
+
'#HTMLGlobalAttrs': Record<string, Partial<Attribute>>;
|
|
29
|
+
[OtherGlobalAttrs: string]: Record<string, Partial<Attribute>>;
|
|
28
30
|
}>;
|
|
29
31
|
'#ariaAttrs': ARIAAttribute[];
|
|
30
32
|
'#roles': ARIRRoleAttribute[];
|
|
@@ -105,10 +107,23 @@ export declare type ElementSpec = {
|
|
|
105
107
|
* Tag omittion
|
|
106
108
|
*/
|
|
107
109
|
omittion: ElementSpecOmittion;
|
|
110
|
+
/**
|
|
111
|
+
* Global Attributes
|
|
112
|
+
*/
|
|
113
|
+
globalAttrs: GlobalAttributes;
|
|
108
114
|
/**
|
|
109
115
|
* Attributes
|
|
110
116
|
*/
|
|
111
|
-
attributes:
|
|
117
|
+
attributes: Record<string, Attribute>;
|
|
118
|
+
/**
|
|
119
|
+
* If true, it is possible to add any properties as attributes,
|
|
120
|
+
* for example, when using a template engine or a view language.
|
|
121
|
+
*
|
|
122
|
+
* @see https://v2.vuejs.org/v2/guide/components-slots.html#Scoped-Slots
|
|
123
|
+
*
|
|
124
|
+
* **It assumes to specify it on the parser plugin.**
|
|
125
|
+
*/
|
|
126
|
+
possibleToAddProperties?: true;
|
|
112
127
|
};
|
|
113
128
|
/**
|
|
114
129
|
* If `false`, this mean is "No corresponding role".
|
|
@@ -129,18 +144,15 @@ declare type ElementCondition = {
|
|
|
129
144
|
};
|
|
130
145
|
export declare type Attribute = {
|
|
131
146
|
name: string;
|
|
132
|
-
type: AttributeType |
|
|
133
|
-
description
|
|
147
|
+
type: AttributeType | AttributeType[];
|
|
148
|
+
description?: string;
|
|
134
149
|
caseSensitive?: true;
|
|
135
150
|
experimental?: true;
|
|
136
151
|
obsolete?: true;
|
|
137
152
|
deprecated?: boolean;
|
|
138
153
|
nonStandard?: true;
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
noUse?: boolean;
|
|
142
|
-
condition?: AttributeCondition;
|
|
143
|
-
};
|
|
154
|
+
} & ExtendableAttributeSpec;
|
|
155
|
+
declare type ExtendableAttributeSpec = Omit<AttributeJSON, 'ref' | '_TODO_' | 'type'>;
|
|
144
156
|
export declare type ARIRRoleAttribute = {
|
|
145
157
|
name: string;
|
|
146
158
|
description: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markuplint/ml-spec",
|
|
3
|
-
"version": "2.0.0-
|
|
3
|
+
"version": "2.0.0-rc.5",
|
|
4
4
|
"description": "Types and schema that specs of the Markup languages for markuplint",
|
|
5
5
|
"repository": "git@github.com:markuplint/markuplint.git",
|
|
6
6
|
"author": "Yusuke Hirao <yusukehirao@me.com>",
|
|
@@ -15,15 +15,17 @@
|
|
|
15
15
|
"build": "tsc",
|
|
16
16
|
"dev": "tsc --build --watch",
|
|
17
17
|
"clean": "tsc --build --clean",
|
|
18
|
+
"schema:gen": "ts-node ./gen/gen.ts; prettier --write './schemas/*.json';",
|
|
18
19
|
"schema:structures": "json2ts ./schemas/permitted-structures.schema.json > ./src/permitted-structres.ts; prettier --write ./src/permitted-structres.ts; eslint --fix --config ../../../.eslintrc ./src/permitted-structres.ts",
|
|
19
|
-
"schema:attributes": "json2ts ./schemas/attributes.schema.json > ./src/attributes.ts; prettier --write ./src/attributes.ts; eslint --fix --config ../../../.eslintrc ./src/attributes.ts",
|
|
20
|
-
"schema": "yarn schema:structures; yarn schema:attributes;"
|
|
20
|
+
"schema:attributes": "json2ts ./schemas/attributes.schema.json --cwd ./schemas > ./src/attributes.ts; prettier --write ./src/attributes.ts; eslint --fix --config ../../../.eslintrc ./src/attributes.ts",
|
|
21
|
+
"schema": "yarn schema:gen; yarn schema:structures; yarn schema:attributes; tsc;"
|
|
21
22
|
},
|
|
22
23
|
"dependencies": {
|
|
23
24
|
"tslib": "^2.3.1"
|
|
24
25
|
},
|
|
25
26
|
"devDependencies": {
|
|
27
|
+
"@markuplint/types": "2.0.0-rc.5",
|
|
26
28
|
"json-schema-to-typescript": "^10.1.5"
|
|
27
29
|
},
|
|
28
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "6faa4e54f16d3700d23953330abea89ccb9d6150"
|
|
29
31
|
}
|