@ibyar/elements 0.6.0 → 0.8.2-dev.20221008

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.
Files changed (45) hide show
  1. package/README.md +5 -2
  2. package/accessibility/a11y.d.ts +1 -0
  3. package/accessibility/a11y.js +39 -0
  4. package/accessibility/a11y.js.map +1 -0
  5. package/accessibility/drag-and-drop.d.ts +11 -0
  6. package/accessibility/drag-and-drop.js +9 -0
  7. package/accessibility/drag-and-drop.js.map +1 -0
  8. package/accessibility/index.d.ts +5 -0
  9. package/accessibility/index.js +6 -0
  10. package/accessibility/index.js.map +1 -0
  11. package/accessibility/region.d.ts +17 -0
  12. package/accessibility/region.js +13 -0
  13. package/accessibility/region.js.map +1 -0
  14. package/accessibility/relationship.d.ts +77 -0
  15. package/accessibility/relationship.js +42 -0
  16. package/accessibility/relationship.js.map +1 -0
  17. package/accessibility/widget.d.ts +77 -0
  18. package/accessibility/widget.js +53 -0
  19. package/accessibility/widget.js.map +1 -0
  20. package/ast/dom.d.ts +36 -0
  21. package/ast/dom.js +36 -0
  22. package/ast/dom.js.map +1 -1
  23. package/attributes/attributes.js +0 -1
  24. package/attributes/attributes.js.map +1 -1
  25. package/attributes/common.d.ts +11 -0
  26. package/attributes/common.js +16 -0
  27. package/attributes/common.js.map +1 -0
  28. package/attributes/form.d.ts +34 -3
  29. package/attributes/form.js +88 -7
  30. package/attributes/form.js.map +1 -1
  31. package/attributes/shadow.js +1 -1
  32. package/attributes/shadow.js.map +1 -1
  33. package/attributes/tags.d.ts +0 -11
  34. package/attributes/tags.js +1 -15
  35. package/attributes/tags.js.map +1 -1
  36. package/index.d.ts +2 -1
  37. package/index.js +2 -1
  38. package/index.js.map +1 -1
  39. package/node/html-parser.d.ts +11 -6
  40. package/node/html-parser.js +213 -134
  41. package/node/html-parser.js.map +1 -1
  42. package/node.d.ts +4 -0
  43. package/node.js +5 -0
  44. package/node.js.map +1 -0
  45. package/package.json +7 -5
package/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C,CAAC;YACxC,IAAI,QAAQ,EAAE;gBACb,GAAG,CAAC,IAAI,CAAC,IAAI,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC;aACpC;YACD,MAAM,QAAQ,GAAG,IAAI,eAAe,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;YACtE,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACnB,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;YAChC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;SAC9B;aAAM;YACN,MAAM;SACN;KACD;IACD,IAAI,IAAI,EAAE;QACT,GAAG,CAAC,IAAI,CAAC,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;KAChC;IACD,OAAO,GAAG,CAAC,OAAO,EAAE,CAAC;AACtB,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,IAAY;IAC/C,MAAM,IAAI,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;IAClC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,YAAY,eAAe,CAAC,CAAC,CAAC,IAAI,GAAG,GAAG,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC5G,OAAO,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AACxB,CAAC","sourcesContent":["\n/**\n * a normal attribute with its source value without any binding.\n */\nexport class Attribute<N, V> {\n\tconstructor(public name: N, public value: V) { }\n}\n\nexport class ElementAttribute<N, V> extends Attribute<N, V> { }\n\n/**\n * an attribute with its source value for binding\n */\nexport class LiveAttribute extends Attribute<string, string> { }\n\n/**\n * \n * @param name \n * @param value \n * @returns LiveAttribute\n */\nexport function createLiveAttribute(name: string, value: string) {\n\treturn new LiveAttribute(name, value);\n}\n\n/**\n * a normal text\n */\nexport class TextContent extends Attribute<'textContent', string> {\n\tstatic propName: 'textContent' = 'textContent';\n\tconstructor(text: string) {\n\t\tsuper(TextContent.propName, text);\n\t}\n}\n\n/**\n * a text that its content is binding to variable from the component model.\n */\nexport class LiveTextContent extends TextContent { }\n\nexport function isLiveTextContent(text: object): text is LiveTextContent {\n\treturn text instanceof LiveTextContent;\n}\n\n/**\n * to comment in dom\n */\nexport class CommentNode {\n\tconstructor(public comment: string) { }\n}\n\n\nexport class BaseNode {\n\n\t/**\n\t * hold static attr and event that will resolve normally from the global window.\n\t */\n\tattributes?: ElementAttribute<string, string | number | boolean | object>[];\n\n\t/**\n\t * hold the attrs/inputs name marked as one way binding\n\t */\n\tinputs?: LiveAttribute[];\n\n\t/**\n\t * hold the name of events that should be connected to a listener\n\t */\n\toutputs?: ElementAttribute<string, string>[];\n\n\t/**\n\t * hold the name of attributes marked for 2 way data binding\n\t */\n\ttwoWayBinding?: LiveAttribute[];\n\n\t/**\n\t * directive attribute\n\t */\n\ttemplateAttrs?: LiveAttribute[];\n\n\t/**\n\t * attributes directive\n\t */\n\tattributeDirectives?: DomAttributeDirectiveNode[];\n\n\taddAttribute(attrName: string, value?: string | number | boolean | object) {\n\t\tif (this.attributes) {\n\t\t\tthis.attributes.push(new ElementAttribute(attrName, value ?? true));\n\t\t} else {\n\t\t\tthis.attributes = [new ElementAttribute(attrName, value ?? true)];\n\t\t}\n\t}\n\n\taddInput(attrName: string, valueSource: string) {\n\t\tif (this.inputs) {\n\t\t\tthis.inputs.push(new LiveAttribute(attrName, valueSource));\n\t\t} else {\n\t\t\tthis.inputs = [new LiveAttribute(attrName, valueSource)];\n\t\t}\n\t}\n\n\taddOutput(eventName: string, handlerSource: string) {\n\t\tif (this.outputs) {\n\t\t\tthis.outputs.push(new LiveAttribute(eventName, handlerSource));\n\t\t} else {\n\t\t\tthis.outputs = [new LiveAttribute(eventName, handlerSource)];\n\t\t}\n\t}\n\n\taddTwoWayBinding(eventName: string, handlerSource: string) {\n\t\tif (this.twoWayBinding) {\n\t\t\tthis.twoWayBinding.push(new LiveAttribute(eventName, handlerSource));\n\t\t} else {\n\t\t\tthis.twoWayBinding = [new LiveAttribute(eventName, handlerSource)];\n\t\t}\n\t}\n\n\taddTemplateAttr(attrName: string, valueSource: string) {\n\t\tvalueSource = valueSource.trim();\n\t\tif (/^\\{\\{(.+)\\}\\}$/g.test(valueSource)) {\n\t\t\t// as one way binding\n\t\t\tconst substring = valueSource.substring(2, valueSource.length - 2);\n\t\t\tif (!(/\\{\\{(.+)\\}\\}/g).test(substring)) {\n\t\t\t\tthis.addInput(attrName, substring);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t// as string \n\t\tvalueSource = parseStringTemplate(valueSource);\n\t\tif (this.templateAttrs) {\n\t\t\tthis.templateAttrs.push(new LiveAttribute(attrName, valueSource));\n\t\t} else {\n\t\t\tthis.templateAttrs = [new LiveAttribute(attrName, valueSource)];\n\t\t}\n\t}\n\n}\n\nexport class DomAttributeDirectiveNode extends BaseNode {\n\n\t/**\n\t * name of the directive \n\t */\n\tname: string;\n\n\n\t/**\n\t * set to `undefined` stop, loop\n\t */\n\tdeclare attributeDirectives: undefined;\n\n\tconstructor(name: string) {\n\t\tsuper();\n\t\tthis.name = name;\n\t}\n}\n\nexport class DomParentNode extends BaseNode {\n\t/**\n\t * element children list\n\t */\n\tchildren?: DomChild[];\n\n\taddChild(child: DomChild) {\n\t\tif (this.children) {\n\t\t\tthis.children.push(child);\n\t\t} else {\n\t\t\tthis.children = [child];\n\t\t}\n\t}\n\n\taddTextChild(text: string) {\n\t\tconst children = (this.children ??= []);\n\t\tparseTextChild(text).forEach(childText => children.push(childText));\n\t}\n\n}\n\n/**\n * parent for a list of elements \n */\nexport class DomFragmentNode extends DomParentNode {\n\tconstructor(children?: DomChild[]) {\n\t\tsuper();\n\t\tif (children) {\n\t\t\tthis.children = children;\n\t\t}\n\t}\n}\nexport class DomElementNode extends DomParentNode {\n\n\t/**\n\t * the tag name of the element \n\t */\n\ttagName: string;\n\n\t/**\n\t * used to upgrade an element to another custom-element name\n\t */\n\tis?: string;\n\n\t/**\n\t * a given name for element\n\t */\n\ttemplateRefName?: Attribute<string, string | undefined>;\n\n\tconstructor(tagName: string, is?: string) {\n\t\tsuper();\n\t\tthis.tagName = tagName;\n\t\tif (is) {\n\t\t\tthis.is = is;\n\t\t}\n\t}\n\n\tsetTagName(tagName: string) {\n\t\tthis.tagName = tagName;\n\t}\n\n\tsetTemplateRefName(name: string, value?: string) {\n\t\tthis.templateRefName = new Attribute(name, value);\n\t}\n\n}\n\n/**\n * structural directive \n */\nexport class DomStructuralDirectiveNode extends BaseNode {\n\n\t/**\n\t * name of the directive \n\t */\n\tname: string;\n\n\t/**\n\t * value of the directive \n\t */\n\tvalue?: string;\n\n\t/**\n\t * the value of the template node, that this directive going to host-on \n\t */\n\tnode: DomNode;\n\n\tconstructor(name: string, node: DomNode, value?: string) {\n\t\tsuper();\n\t\tthis.name = name;\n\t\tthis.node = node;\n\t\tthis.value = value;\n\t}\n}\n\nexport function isDOMDirectiveNode(node: object): node is DomStructuralDirectiveNode {\n\treturn node instanceof DomStructuralDirectiveNode;\n}\nexport type DomChild = DomElementNode | DomStructuralDirectiveNode | CommentNode | TextContent | LiveTextContent;\n\nexport type DomNode = DomFragmentNode | DomElementNode | DomStructuralDirectiveNode | CommentNode | TextContent | LiveTextContent;\n\nexport type DomRenderNode<T> = (model: T) => DomNode;\n\nexport function parseTextChild(text: string): Array<TextContent | LiveTextContent> {\n\t// split from end with '}}', then search for the first '{{'\n\tlet all: (TextContent | LiveTextContent)[] = [];\n\tlet temp = text;\n\tlet last = temp.lastIndexOf('}}');\n\tlet first: number;\n\twhile (last > -1) {\n\t\tfirst = text.lastIndexOf('{{', last);\n\t\tif (first > -1) {\n\t\t\tlet lastPart = temp.substring(last + 2);\n\t\t\tif (lastPart) {\n\t\t\t\tall.push(new TextContent(lastPart));\n\t\t\t}\n\t\t\tconst liveText = new LiveTextContent(temp.substring(first + 2, last));\n\t\t\tall.push(liveText);\n\t\t\ttemp = temp.substring(0, first);\n\t\t\tlast = temp.lastIndexOf('}}');\n\t\t} else {\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (temp) {\n\t\tall.push(new TextContent(temp));\n\t}\n\treturn all.reverse();\n}\n\nexport function parseStringTemplate(text: string): string {\n\tconst node = parseTextChild(text);\n\tconst map = node.map(str => (str instanceof LiveTextContent ? '${' + str.value + '}' : str.value)).join('');\n\treturn '`' + map + '`';\n}\n"]}
1
+ {"version":3,"file":"dom.js","sourceRoot":"","sources":["../../../src/elements/ast/dom.ts"],"names":[],"mappings":"AACA;;GAEG;AACH,MAAM,OAAO,SAAS;IACrB,YAAmB,IAAO,EAAS,KAAQ;QAAxB,SAAI,GAAJ,IAAI,CAAG;QAAS,UAAK,GAAL,KAAK,CAAG;IAAI,CAAC;IAChD,MAAM;QACL,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC;IACvD,CAAC;CACD;AAED,MAAM,OAAO,gBAAuB,SAAQ,SAAe;IAC1D,MAAM;QACL,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,kBAAkB,EAAE,CAAC,CAAC;IAC9D,CAAC;CACD;AAED;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,SAAyB;IAC3D,MAAM;QACL,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC,CAAC;IAC3D,CAAC;CACD;AAED;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAY,EAAE,KAAa;IAC9D,OAAO,IAAI,aAAa,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AACvC,CAAC;AAED;;GAEG;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,mBAAmB,CAAC,IAAY;IAC/C,MAAM,IAAI,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;IAClC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,YAAY,eAAe,CAAC,CAAC,CAAC,IAAI,GAAG,GAAG,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC5G,OAAO,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AACxB,CAAC","sourcesContent":["\n/**\n * a normal attribute with its source value without any binding.\n */\nexport class Attribute<N, V> {\n\tconstructor(public name: N, public value: V) { }\n\ttoJSON() {\n\t\treturn Object.assign({}, this, { type: 'Attribute' });\n\t}\n}\n\nexport class ElementAttribute<N, V> extends Attribute<N, V> {\n\ttoJSON() {\n\t\treturn Object.assign({}, this, { type: 'ElementAttribute' });\n\t}\n}\n\n/**\n * an attribute with its source value for binding\n */\nexport class LiveAttribute extends Attribute<string, string> {\n\ttoJSON() {\n\t\treturn Object.assign({}, this, { type: 'LiveAttribute' });\n\t}\n}\n\n/**\n * \n * @param name \n * @param value \n * @returns LiveAttribute\n */\nexport function createLiveAttribute(name: string, value: string) {\n\treturn new LiveAttribute(name, value);\n}\n\n/**\n * a normal text\n */\nexport class TextContent extends Attribute<'textContent', string> {\n\tstatic propName: 'textContent' = 'textContent';\n\tconstructor(text: string) {\n\t\tsuper(TextContent.propName, text);\n\t}\n\ttoJSON() {\n\t\treturn Object.assign({}, this, { type: 'TextContent' });\n\t}\n}\n\n/**\n * a text that its content is binding to variable from the component model.\n */\nexport class LiveTextContent extends TextContent {\n\ttoJSON() {\n\t\treturn Object.assign({}, this, { type: 'LiveTextContent' });\n\t}\n}\n\nexport function isLiveTextContent(text: object): text is LiveTextContent {\n\treturn text instanceof LiveTextContent;\n}\n\n/**\n * to comment in dom\n */\nexport class CommentNode {\n\tconstructor(public comment: string) { }\n\ttoJSON() {\n\t\treturn Object.assign({}, this, { type: 'CommentNode' });\n\t}\n}\n\n\nexport class BaseNode {\n\n\t/**\n\t * hold static attr and event that will resolve normally from the global window.\n\t */\n\tattributes?: ElementAttribute<string, string | number | boolean | object>[];\n\n\t/**\n\t * hold the attrs/inputs name marked as one way binding\n\t */\n\tinputs?: LiveAttribute[];\n\n\t/**\n\t * hold the name of events that should be connected to a listener\n\t */\n\toutputs?: ElementAttribute<string, string>[];\n\n\t/**\n\t * hold the name of attributes marked for 2 way data binding\n\t */\n\ttwoWayBinding?: LiveAttribute[];\n\n\t/**\n\t * directive attribute\n\t */\n\ttemplateAttrs?: LiveAttribute[];\n\n\t/**\n\t * attributes directive\n\t */\n\tattributeDirectives?: DomAttributeDirectiveNode[];\n\n\taddAttribute(attrName: string, value?: string | number | boolean | object) {\n\t\tif (this.attributes) {\n\t\t\tthis.attributes.push(new ElementAttribute(attrName, value ?? true));\n\t\t} else {\n\t\t\tthis.attributes = [new ElementAttribute(attrName, value ?? true)];\n\t\t}\n\t}\n\n\taddInput(attrName: string, valueSource: string) {\n\t\tif (this.inputs) {\n\t\t\tthis.inputs.push(new LiveAttribute(attrName, valueSource));\n\t\t} else {\n\t\t\tthis.inputs = [new LiveAttribute(attrName, valueSource)];\n\t\t}\n\t}\n\n\taddOutput(eventName: string, handlerSource: string) {\n\t\tif (this.outputs) {\n\t\t\tthis.outputs.push(new LiveAttribute(eventName, handlerSource));\n\t\t} else {\n\t\t\tthis.outputs = [new LiveAttribute(eventName, handlerSource)];\n\t\t}\n\t}\n\n\taddTwoWayBinding(eventName: string, handlerSource: string) {\n\t\tif (this.twoWayBinding) {\n\t\t\tthis.twoWayBinding.push(new LiveAttribute(eventName, handlerSource));\n\t\t} else {\n\t\t\tthis.twoWayBinding = [new LiveAttribute(eventName, handlerSource)];\n\t\t}\n\t}\n\n\taddTemplateAttr(attrName: string, valueSource: string) {\n\t\tvalueSource = valueSource.trim();\n\t\tif (/^\\{\\{(.+)\\}\\}$/g.test(valueSource)) {\n\t\t\t// as one way binding\n\t\t\tconst substring = valueSource.substring(2, valueSource.length - 2);\n\t\t\tif (!(/\\{\\{(.+)\\}\\}/g).test(substring)) {\n\t\t\t\tthis.addInput(attrName, substring);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t// as string \n\t\tvalueSource = parseStringTemplate(valueSource);\n\t\tif (this.templateAttrs) {\n\t\t\tthis.templateAttrs.push(new LiveAttribute(attrName, valueSource));\n\t\t} else {\n\t\t\tthis.templateAttrs = [new LiveAttribute(attrName, valueSource)];\n\t\t}\n\t}\n\n\ttoJSON() {\n\t\treturn Object.assign({}, this, { type: 'BaseNode' });\n\t}\n\n}\n\nexport class DomAttributeDirectiveNode extends BaseNode {\n\n\t/**\n\t * name of the directive \n\t */\n\tname: string;\n\n\n\t/**\n\t * set to `undefined` stop, loop\n\t */\n\tdeclare attributeDirectives: undefined;\n\n\tconstructor(name: string) {\n\t\tsuper();\n\t\tthis.name = name;\n\t}\n\n\ttoJSON() {\n\t\treturn Object.assign({}, this, { type: 'DomAttributeDirectiveNode' });\n\t}\n}\n\nexport class DomParentNode extends BaseNode {\n\t/**\n\t * element children list\n\t */\n\tchildren?: DomChild[];\n\n\taddChild(child: DomChild) {\n\t\tif (this.children) {\n\t\t\tthis.children.push(child);\n\t\t} else {\n\t\t\tthis.children = [child];\n\t\t}\n\t}\n\n\taddTextChild(text: string) {\n\t\tconst children = (this.children ??= []);\n\t\tparseTextChild(text).forEach(childText => children.push(childText));\n\t}\n\n\ttoJSON() {\n\t\treturn Object.assign({}, this, { type: 'DomParentNode' });\n\t}\n}\n\n/**\n * parent for a list of elements \n */\nexport class DomFragmentNode extends DomParentNode {\n\tconstructor(children?: DomChild[]) {\n\t\tsuper();\n\t\tif (children) {\n\t\t\tthis.children = children;\n\t\t}\n\t}\n\ttoJSON() {\n\t\treturn Object.assign({}, this, { type: 'DomFragmentNode' });\n\t}\n}\nexport class DomElementNode extends DomParentNode {\n\n\t/**\n\t * the tag name of the element \n\t */\n\ttagName: string;\n\n\t/**\n\t * used to upgrade an element to another custom-element name\n\t */\n\tis?: string;\n\n\t/**\n\t * a given name for element\n\t */\n\ttemplateRefName?: Attribute<string, string | undefined>;\n\n\tconstructor(tagName: string, is?: string) {\n\t\tsuper();\n\t\tthis.tagName = tagName;\n\t\tif (is) {\n\t\t\tthis.is = is;\n\t\t}\n\t}\n\n\tsetTagName(tagName: string) {\n\t\tthis.tagName = tagName;\n\t}\n\n\tsetTemplateRefName(name: string, value?: string) {\n\t\tthis.templateRefName = new Attribute(name, value);\n\t}\n\n\ttoJSON() {\n\t\treturn Object.assign({}, this, { type: 'DomElementNode' });\n\t}\n}\n\n/**\n * structural directive \n */\nexport class DomStructuralDirectiveNode extends BaseNode {\n\n\t/**\n\t * name of the directive \n\t */\n\tname: string;\n\n\t/**\n\t * value of the directive \n\t */\n\tvalue?: string;\n\n\t/**\n\t * the value of the template node, that this directive going to host-on \n\t */\n\tnode: DomNode;\n\n\tconstructor(name: string, node: DomNode, value?: string) {\n\t\tsuper();\n\t\tthis.name = name;\n\t\tthis.node = node;\n\t\tthis.value = value;\n\t}\n\n\ttoJSON() {\n\t\treturn Object.assign({}, this, { type: 'DomStructuralDirectiveNode' });\n\t}\n}\n\nexport function isDOMDirectiveNode(node: object): node is DomStructuralDirectiveNode {\n\treturn node instanceof DomStructuralDirectiveNode;\n}\nexport type DomChild = DomElementNode | DomStructuralDirectiveNode | CommentNode | TextContent | LiveTextContent;\n\nexport type DomNode = DomFragmentNode | DomElementNode | DomStructuralDirectiveNode | CommentNode | TextContent | LiveTextContent;\n\nexport type DomRenderNode<T> = (model: T) => DomNode;\n\nexport function parseTextChild(text: string): Array<TextContent | LiveTextContent> {\n\t// split from end with '}}', then search for the first '{{'\n\tlet all: (TextContent | LiveTextContent)[] = [];\n\tlet temp = text;\n\tlet last = temp.lastIndexOf('}}');\n\tlet first: number;\n\twhile (last > -1) {\n\t\tfirst = text.lastIndexOf('{{', last);\n\t\tif (first > -1) {\n\t\t\tlet lastPart = temp.substring(last + 2);\n\t\t\tif (lastPart) {\n\t\t\t\tall.push(new TextContent(lastPart));\n\t\t\t}\n\t\t\tconst liveText = new LiveTextContent(temp.substring(first + 2, last));\n\t\t\tall.push(liveText);\n\t\t\ttemp = temp.substring(0, first);\n\t\t\tlast = temp.lastIndexOf('}}');\n\t\t} else {\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (temp) {\n\t\tall.push(new TextContent(temp));\n\t}\n\treturn all.reverse();\n}\n\nexport function parseStringTemplate(text: string): string {\n\tconst node = parseTextChild(text);\n\tconst map = node.map(str => (str instanceof LiveTextContent ? '${' + str.value + '}' : str.value)).join('');\n\treturn '`' + map + '`';\n}\n"]}
@@ -141,7 +141,6 @@ export const Attrs = {
141
141
  var: GlobalAttributes,
142
142
  video: [...GlobalAttributes, 'src', 'crossorigin', 'poster', 'preload', 'autoplay', 'playsinline', 'loop', 'muted', 'controls', 'width', 'height'],
143
143
  wbr: GlobalAttributes,
144
- 'virtual-scroller': GlobalAttributes
145
144
  };
146
145
  export function hasNativeAttr(element, attr) {
147
146
  if (typeof element === 'string') {
@@ -1 +1 @@
1
- {"version":3,"file":"attributes.js","sourceRoot":"","sources":["../../../src/elements/attributes/attributes.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC/B,OAAO;IACP,IAAI;IACJ,MAAM;IACN,WAAW;IACX,gBAAgB;IAChB,WAAW;IACX,iBAAiB;IACjB,KAAK;IACL,WAAW;IACX,cAAc;IACd,QAAQ;IACR,WAAW;IACX,IAAI;IACJ,QAAQ;IACR,UAAU;IACV,SAAS;IACT,WAAW;IACX,UAAU;IACV,MAAM;IACN,OAAO;IACP,YAAY;IACZ,OAAO;IACP,UAAU;IACV,OAAO;IACP,WAAW;CACX,CAAC;AAEF,MAAM,CAAC,MAAM,KAAK,GAAY;IAC7B,CAAC,EAAE,CAAC,G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OAAO,gBAAgB,CAAC,KAAK,EAAE,CAAC;AACjC,CAAC","sourcesContent":["export interface AttrRef {\n\treadonly [attr: string]: string[];\n}\n\n/**\n * @see https://html.spec.whatwg.org/multipage/indices.html#elements-3\n */\nexport const GlobalAttributes = [\n\t'class',\n\t'id',\n\t'slot',\n\t'accesskey',\n\t'autocapitalize',\n\t'autofocus',\n\t'contenteditable',\n\t'dir',\n\t'draggable',\n\t'enterkeyhint',\n\t'hidden',\n\t'inputmode',\n\t'is',\n\t'itemid',\n\t'itemprop',\n\t'itemref',\n\t'itemscope',\n\t'itemtype',\n\t'lang',\n\t'nonce',\n\t'spellcheck',\n\t'style',\n\t'tabindex',\n\t'title',\n\t'translate'\n];\n\nexport const Attrs: AttrRef = {\n\ta: [...GlobalAttributes, 'href', 'target', 'download', 'ping', 'rel', 'hreflang', 'type', 'referrerpolicy'],\n\tabbr: GlobalAttributes,\n\taddress: GlobalAttributes,\n\tarea: [...GlobalAttributes, 'alt', 'coords', 'shape', 'href', 'target', 'download', 'ping', 'rel', 'referrerpolicy'],\n\tarticle: GlobalAttributes,\n\taside: GlobalAttributes,\n\taudio: [...GlobalAttributes, 'src', 'crossorigin', 'preload', 'autoplay', 'loop', 'muted', 'controls'],\n\tb: GlobalAttributes,\n\tbase: [...GlobalAttributes, 'href', 'targetreferrerpolicy'],\n\tbdi: GlobalAttributes,\n\tbdo: GlobalAttributes,\n\tblockquote: [...GlobalAttributes, 'cite'],\n\tbody: [...GlobalAttributes, 'onafterprint; onbeforeprint; onbeforeunload; onhashchange; onlanguagechange; onmessage; onmessageerror; onoffline; ononline; onpagehide; onpageshow; onpopstate; onrejectionhandled; onstorage; onunhandledrejection; onunload'],\n\tbr: GlobalAttributes,\n\tbutton: [...GlobalAttributes, 'disabled', 'form', 'formaction', 'formenctype', 'formmethod', 'formnovalidate', 'formtarget', 'name', 'type', 'value'],\n\tcanvas: [...GlobalAttributes, 'width', 'height'],\n\tcaption: GlobalAttributes,\n\tcite: GlobalAttributes,\n\tcode: GlobalAttributes,\n\tcol: [...GlobalAttributes, 'span'],\n\tcolgroup: [...GlobalAttributes, 'span'],\n\tdata: [...GlobalAttributes, 'value'],\n\tdatalist: GlobalAttributes,\n\tdd: GlobalAttributes,\n\tdel: [...GlobalAttributes, 'cite', 'datetime'],\n\tdetails: [...GlobalAttributes, 'open'],\n\tdfn: GlobalAttributes,\n\tdialog: [...GlobalAttributes, 'open'],\n\tdiv: GlobalAttributes,\n\tdl: GlobalAttributes,\n\tdt: GlobalAttributes,\n\tem: GlobalAttributes,\n\tembed: [...GlobalAttributes, 'src', 'type', 'width', 'height', 'any*'],\n\tfieldset: [...GlobalAttributes, 'disabled', 'form', 'name'],\n\tfigcaption: GlobalAttributes,\n\tfigure: GlobalAttributes,\n\tfooter: GlobalAttributes,\n\tform: [...GlobalAttributes, 'accept-charset', 'action', 'autocomplete', 'enctype', 'method', 'name', 'novalidate', 'target'],\n\th1: GlobalAttributes,\n\th2: GlobalAttributes,\n\th3: GlobalAttributes,\n\th4: GlobalAttributes,\n\th5: GlobalAttributes,\n\th6: GlobalAttributes,\n\thead: GlobalAttributes,\n\theader: GlobalAttributes,\n\thgroup: GlobalAttributes,\n\thr: GlobalAttributes,\n\thtml: [...GlobalAttributes, 'manifest'],\n\ti: GlobalAttributes,\n\tiframe: [...GlobalAttributes, 'src', 'srcdoc', 'name', 'sandbox', 'allow', 'allowfullscreen', 'allowpaymentrequest', 'width', 'height', 'referrerpolicy', 'loading'],\n\timg: [...GlobalAttributes, 'alt', 'src', 'srcset', 'sizes', 'crossorigin', 'usemap', 'ismap', 'width', 'height', 'referrerpolicy', 'decoding', 'loading'],\n\tinput: [...GlobalAttributes, 'accept', 'alt', 'autocomplete', 'checked', 'dirname', 'disabled', 'form', 'formaction', 'formenctype', 'formmethod', 'formnovalidate', 'formtarget', 'height', 'list', 'max', 'maxlength', 'min', 'minlength', 'multiple', 'name', 'pattern', 'placeholder', 'readonly', 'required', 'size', 'src', 'step', 'type', 'value', 'width'],\n\tins: [...GlobalAttributes, 'cite', 'datetime'],\n\tkbd: GlobalAttributes,\n\tlabel: [...GlobalAttributes, 'for'],\n\tlegend: GlobalAttributes,\n\tli: [...GlobalAttributes, 'value'],\n\tlink: [...GlobalAttributes, 'href', 'crossorigin', 'rel', 'as', 'media', 'hreflang', 'type', 'sizes', 'imagesrcset', 'imagesizes', 'referrerpolicy', 'integrity', 'color', 'disabled'],\n\tmain: GlobalAttributes,\n\tmap: [...GlobalAttributes, 'name'],\n\tmark: GlobalAttributes,\n\tmenu: GlobalAttributes,\n\tmeta: [...GlobalAttributes, 'name', 'http-equiv', 'content', 'charset'],\n\tmeter: [...GlobalAttributes, 'value', 'min', 'max', 'low', 'high', 'optimum'],\n\tnav: GlobalAttributes,\n\tnoscript: GlobalAttributes,\n\tobject: [...GlobalAttributes, 'data', 'type', 'name', 'usemap', 'form', 'width', 'height'],\n\tol: [...GlobalAttributes, 'reversed', 'start', 'type'],\n\toptgroup: [...GlobalAttributes, 'disabled', 'label'],\n\toption: [...GlobalAttributes, 'disabled', 'label', 'selected', 'value'],\n\toutput: [...GlobalAttributes, 'for', 'form', 'name'],\n\tp: GlobalAttributes,\n\tparam: [...GlobalAttributes, 'name', 'value'],\n\tpicture: GlobalAttributes,\n\tpre: GlobalAttributes,\n\tprogress: [...GlobalAttributes, 'value', 'max'],\n\tq: [...GlobalAttributes, 'cite'],\n\trp: GlobalAttributes,\n\trt: GlobalAttributes,\n\truby: GlobalAttributes,\n\ts: GlobalAttributes,\n\tsamp: GlobalAttributes,\n\tscript: [...GlobalAttributes, 'src', 'type', 'async', 'defer', 'crossorigin', 'integrity', 'referrerpolicy'],\n\tsection: GlobalAttributes,\n\tselect: [...GlobalAttributes, 'autocomplete', 'disabled', 'form', 'multiple', 'name', 'required', 'size'],\n\tslot: [...GlobalAttributes, 'name'],\n\tsmall: GlobalAttributes,\n\tsource: [...GlobalAttributes, 'src', 'type', 'srcset', 'sizes', 'media'],\n\tspan: GlobalAttributes,\n\tstrong: GlobalAttributes,\n\tstyle: [...GlobalAttributes, 'media'],\n\tsub: GlobalAttributes,\n\tsummary: GlobalAttributes,\n\tsup: GlobalAttributes,\n\ttable: GlobalAttributes,\n\ttbody: GlobalAttributes,\n\ttd: [...GlobalAttributes, 'colspan', 'rowspan', 'headers'],\n\ttemplate: GlobalAttributes,\n\ttextarea: [...GlobalAttributes, 'cols', 'dirname', 'disabled', 'form', 'maxlength', 'minlength', 'name', 'placeholder', 'readonly', 'required', 'rows', 'wrap'],\n\ttfoot: GlobalAttributes,\n\tth: [...GlobalAttributes, 'colspan', 'rowspan', 'headers', 'scope', 'abbr'],\n\tthead: GlobalAttributes,\n\ttime: [...GlobalAttributes, 'datetime'],\n\ttitle: GlobalAttributes,\n\ttr: GlobalAttributes,\n\ttrack: [...GlobalAttributes, 'default', 'kind', 'label', 'src', 'srclang'],\n\tu: GlobalAttributes,\n\tul: GlobalAttributes,\n\tvar: GlobalAttributes,\n\tvideo: [...GlobalAttributes, 'src', 'crossorigin', 'poster', 'preload', 'autoplay', 'playsinline', 'loop', 'muted', 'controls', 'width', 'height'],\n\twbr: GlobalAttributes,\n\t'virtual-scroller': GlobalAttributes\n};\n\n\nexport function hasNativeAttr(element: string | HTMLElement, attr: string): boolean {\n\tif (typeof element === 'string') {\n\t\treturn Attrs[element.toLowerCase()]?.includes(attr);\n\t} else if (element instanceof HTMLElement) {\n\t\tconst tagName = element.tagName.toLowerCase();\n\t\treturn Attrs[tagName]?.includes(attr);\n\t}\n\treturn false;\n}\n\nexport function getTagsForAttr(attr: string): string[] {\n\treturn Object.keys(Attrs).filter(tag => Attrs[tag].includes(attr));\n}\n\nexport function getAllAttributes(tag?: string): string[] {\n\tif (tag) {\n\t\treturn Attrs[tag];\n\t}\n\treturn GlobalAttributes.slice();\n}"]}
1
+ {"version":3,"file":"attributes.js","sourceRoot":"","sources":["../../../src/elements/attributes/attributes.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,CAAC,MAAM,gB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KAAK,CAAC;AACd,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,IAAY;IAC1C,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;AACpE,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,GAAY;IAC5C,IAAI,GAAG,EAAE;QACR,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC;KAClB;IACD,OAAO,gBAAgB,CAAC,KAAK,EAAE,CAAC;AACjC,CAAC","sourcesContent":["export interface AttrRef {\n\treadonly [attr: string]: string[];\n}\n\n/**\n * @see https://html.spec.whatwg.org/multipage/indices.html#elements-3\n */\nexport const GlobalAttributes = [\n\t'class',\n\t'id',\n\t'slot',\n\t'accesskey',\n\t'autocapitalize',\n\t'autofocus',\n\t'contenteditable',\n\t'dir',\n\t'draggable',\n\t'enterkeyhint',\n\t'hidden',\n\t'inputmode',\n\t'is',\n\t'itemid',\n\t'itemprop',\n\t'itemref',\n\t'itemscope',\n\t'itemtype',\n\t'lang',\n\t'nonce',\n\t'spellcheck',\n\t'style',\n\t'tabindex',\n\t'title',\n\t'translate'\n];\n\nexport const Attrs: AttrRef = {\n\ta: [...GlobalAttributes, 'href', 'target', 'download', 'ping', 'rel', 'hreflang', 'type', 'referrerpolicy'],\n\tabbr: GlobalAttributes,\n\taddress: GlobalAttributes,\n\tarea: [...GlobalAttributes, 'alt', 'coords', 'shape', 'href', 'target', 'download', 'ping', 'rel', 'referrerpolicy'],\n\tarticle: GlobalAttributes,\n\taside: GlobalAttributes,\n\taudio: [...GlobalAttributes, 'src', 'crossorigin', 'preload', 'autoplay', 'loop', 'muted', 'controls'],\n\tb: GlobalAttributes,\n\tbase: [...GlobalAttributes, 'href', 'targetreferrerpolicy'],\n\tbdi: GlobalAttributes,\n\tbdo: GlobalAttributes,\n\tblockquote: [...GlobalAttributes, 'cite'],\n\tbody: [...GlobalAttributes, 'onafterprint; onbeforeprint; onbeforeunload; onhashchange; onlanguagechange; onmessage; onmessageerror; onoffline; ononline; onpagehide; onpageshow; onpopstate; onrejectionhandled; onstorage; onunhandledrejection; onunload'],\n\tbr: GlobalAttributes,\n\tbutton: [...GlobalAttributes, 'disabled', 'form', 'formaction', 'formenctype', 'formmethod', 'formnovalidate', 'formtarget', 'name', 'type', 'value'],\n\tcanvas: [...GlobalAttributes, 'width', 'height'],\n\tcaption: GlobalAttributes,\n\tcite: GlobalAttributes,\n\tcode: GlobalAttributes,\n\tcol: [...GlobalAttributes, 'span'],\n\tcolgroup: [...GlobalAttributes, 'span'],\n\tdata: [...GlobalAttributes, 'value'],\n\tdatalist: GlobalAttributes,\n\tdd: GlobalAttributes,\n\tdel: [...GlobalAttributes, 'cite', 'datetime'],\n\tdetails: [...GlobalAttributes, 'open'],\n\tdfn: GlobalAttributes,\n\tdialog: [...GlobalAttributes, 'open'],\n\tdiv: GlobalAttributes,\n\tdl: GlobalAttributes,\n\tdt: GlobalAttributes,\n\tem: GlobalAttributes,\n\tembed: [...GlobalAttributes, 'src', 'type', 'width', 'height', 'any*'],\n\tfieldset: [...GlobalAttributes, 'disabled', 'form', 'name'],\n\tfigcaption: GlobalAttributes,\n\tfigure: GlobalAttributes,\n\tfooter: GlobalAttributes,\n\tform: [...GlobalAttributes, 'accept-charset', 'action', 'autocomplete', 'enctype', 'method', 'name', 'novalidate', 'target'],\n\th1: GlobalAttributes,\n\th2: GlobalAttributes,\n\th3: GlobalAttributes,\n\th4: GlobalAttributes,\n\th5: GlobalAttributes,\n\th6: GlobalAttributes,\n\thead: GlobalAttributes,\n\theader: GlobalAttributes,\n\thgroup: GlobalAttributes,\n\thr: GlobalAttributes,\n\thtml: [...GlobalAttributes, 'manifest'],\n\ti: GlobalAttributes,\n\tiframe: [...GlobalAttributes, 'src', 'srcdoc', 'name', 'sandbox', 'allow', 'allowfullscreen', 'allowpaymentrequest', 'width', 'height', 'referrerpolicy', 'loading'],\n\timg: [...GlobalAttributes, 'alt', 'src', 'srcset', 'sizes', 'crossorigin', 'usemap', 'ismap', 'width', 'height', 'referrerpolicy', 'decoding', 'loading'],\n\tinput: [...GlobalAttributes, 'accept', 'alt', 'autocomplete', 'checked', 'dirname', 'disabled', 'form', 'formaction', 'formenctype', 'formmethod', 'formnovalidate', 'formtarget', 'height', 'list', 'max', 'maxlength', 'min', 'minlength', 'multiple', 'name', 'pattern', 'placeholder', 'readonly', 'required', 'size', 'src', 'step', 'type', 'value', 'width'],\n\tins: [...GlobalAttributes, 'cite', 'datetime'],\n\tkbd: GlobalAttributes,\n\tlabel: [...GlobalAttributes, 'for'],\n\tlegend: GlobalAttributes,\n\tli: [...GlobalAttributes, 'value'],\n\tlink: [...GlobalAttributes, 'href', 'crossorigin', 'rel', 'as', 'media', 'hreflang', 'type', 'sizes', 'imagesrcset', 'imagesizes', 'referrerpolicy', 'integrity', 'color', 'disabled'],\n\tmain: GlobalAttributes,\n\tmap: [...GlobalAttributes, 'name'],\n\tmark: GlobalAttributes,\n\tmenu: GlobalAttributes,\n\tmeta: [...GlobalAttributes, 'name', 'http-equiv', 'content', 'charset'],\n\tmeter: [...GlobalAttributes, 'value', 'min', 'max', 'low', 'high', 'optimum'],\n\tnav: GlobalAttributes,\n\tnoscript: GlobalAttributes,\n\tobject: [...GlobalAttributes, 'data', 'type', 'name', 'usemap', 'form', 'width', 'height'],\n\tol: [...GlobalAttributes, 'reversed', 'start', 'type'],\n\toptgroup: [...GlobalAttributes, 'disabled', 'label'],\n\toption: [...GlobalAttributes, 'disabled', 'label', 'selected', 'value'],\n\toutput: [...GlobalAttributes, 'for', 'form', 'name'],\n\tp: GlobalAttributes,\n\tparam: [...GlobalAttributes, 'name', 'value'],\n\tpicture: GlobalAttributes,\n\tpre: GlobalAttributes,\n\tprogress: [...GlobalAttributes, 'value', 'max'],\n\tq: [...GlobalAttributes, 'cite'],\n\trp: GlobalAttributes,\n\trt: GlobalAttributes,\n\truby: GlobalAttributes,\n\ts: GlobalAttributes,\n\tsamp: GlobalAttributes,\n\tscript: [...GlobalAttributes, 'src', 'type', 'async', 'defer', 'crossorigin', 'integrity', 'referrerpolicy'],\n\tsection: GlobalAttributes,\n\tselect: [...GlobalAttributes, 'autocomplete', 'disabled', 'form', 'multiple', 'name', 'required', 'size'],\n\tslot: [...GlobalAttributes, 'name'],\n\tsmall: GlobalAttributes,\n\tsource: [...GlobalAttributes, 'src', 'type', 'srcset', 'sizes', 'media'],\n\tspan: GlobalAttributes,\n\tstrong: GlobalAttributes,\n\tstyle: [...GlobalAttributes, 'media'],\n\tsub: GlobalAttributes,\n\tsummary: GlobalAttributes,\n\tsup: GlobalAttributes,\n\ttable: GlobalAttributes,\n\ttbody: GlobalAttributes,\n\ttd: [...GlobalAttributes, 'colspan', 'rowspan', 'headers'],\n\ttemplate: GlobalAttributes,\n\ttextarea: [...GlobalAttributes, 'cols', 'dirname', 'disabled', 'form', 'maxlength', 'minlength', 'name', 'placeholder', 'readonly', 'required', 'rows', 'wrap'],\n\ttfoot: GlobalAttributes,\n\tth: [...GlobalAttributes, 'colspan', 'rowspan', 'headers', 'scope', 'abbr'],\n\tthead: GlobalAttributes,\n\ttime: [...GlobalAttributes, 'datetime'],\n\ttitle: GlobalAttributes,\n\ttr: GlobalAttributes,\n\ttrack: [...GlobalAttributes, 'default', 'kind', 'label', 'src', 'srclang'],\n\tu: GlobalAttributes,\n\tul: GlobalAttributes,\n\tvar: GlobalAttributes,\n\tvideo: [...GlobalAttributes, 'src', 'crossorigin', 'poster', 'preload', 'autoplay', 'playsinline', 'loop', 'muted', 'controls', 'width', 'height'],\n\twbr: GlobalAttributes,\n};\n\n\nexport function hasNativeAttr(element: string | HTMLElement, attr: string): boolean {\n\tif (typeof element === 'string') {\n\t\treturn Attrs[element.toLowerCase()]?.includes(attr);\n\t} else if (element instanceof HTMLElement) {\n\t\tconst tagName = element.tagName.toLowerCase();\n\t\treturn Attrs[tagName]?.includes(attr);\n\t}\n\treturn false;\n}\n\nexport function getTagsForAttr(attr: string): string[] {\n\treturn Object.keys(Attrs).filter(tag => Attrs[tag].includes(attr));\n}\n\nexport function getAllAttributes(tag?: string): string[] {\n\tif (tag) {\n\t\treturn Attrs[tag];\n\t}\n\treturn GlobalAttributes.slice();\n}"]}
@@ -0,0 +1,11 @@
1
+ export declare const EmptyElements: readonly string[];
2
+ export declare function isEmptyElement(tagName: string): boolean;
3
+ export declare const VoidElements: readonly string[];
4
+ export declare const isVoidElement: typeof isEmptyElement;
5
+ /**
6
+ * see https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name
7
+ * see https://github.com/mathiasbynens/mothereff.in/blob/master/custom-element-name/vendor/is-potential-custom-element-name.js
8
+ * @param tagName
9
+ */
10
+ export declare const CustomElementRegex: RegExp;
11
+ export declare function isValidCustomElementName(tagName: string): boolean;
@@ -0,0 +1,16 @@
1
+ export const EmptyElements = Object.freeze(['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'link', 'meta', 'param', 'source', 'track', 'wbr']);
2
+ export function isEmptyElement(tagName) {
3
+ return EmptyElements.includes(tagName);
4
+ }
5
+ export const VoidElements = EmptyElements;
6
+ export const isVoidElement = isEmptyElement;
7
+ /**
8
+ * see https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name
9
+ * see https://github.com/mathiasbynens/mothereff.in/blob/master/custom-element-name/vendor/is-potential-custom-element-name.js
10
+ * @param tagName
11
+ */
12
+ export const CustomElementRegex = /^[a-z](?:[\-\.0-9_a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*-(?:[\-\.0-9_a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*$/;
13
+ export function isValidCustomElementName(tagName) {
14
+ return CustomElementRegex.test(tagName);
15
+ }
16
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/elements/attributes/common.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;AAC5J,MAAM,UAAU,cAAc,CAAC,OAAe;IAC7C,OAAO,aAAa,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AACxC,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,aAAa,CAAC;AAC1C,MAAM,CAAC,MAAM,aAAa,GAAG,cAAc,CAAC;AAG5C;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,0XAA0X,CAAC;AAE7Z,MAAM,UAAU,wBAAwB,CAAC,OAAe;IACvD,OAAO,kBAAkB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AACzC,CAAC","sourcesContent":["export const EmptyElements = Object.freeze(['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'link', 'meta', 'param', 'source', 'track', 'wbr']);\nexport function isEmptyElement(tagName: string) {\n\treturn EmptyElements.includes(tagName);\n}\n\nexport const VoidElements = EmptyElements;\nexport const isVoidElement = isEmptyElement;\n\n\n/**\n * see https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name\n * see https://github.com/mathiasbynens/mothereff.in/blob/master/custom-element-name/vendor/is-potential-custom-element-name.js\n * @param tagName\n */\nexport const CustomElementRegex = /^[a-z](?:[\\-\\.0-9_a-z\\xB7\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u037D\\u037F-\\u1FFF\\u200C\\u200D\\u203F\\u2040\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]|[\\uD800-\\uDB7F][\\uDC00-\\uDFFF])*-(?:[\\-\\.0-9_a-z\\xB7\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u037D\\u037F-\\u1FFF\\u200C\\u200D\\u203F\\u2040\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]|[\\uD800-\\uDB7F][\\uDC00-\\uDFFF])*$/;\n\nexport function isValidCustomElementName(tagName: string): boolean {\n\treturn CustomElementRegex.test(tagName);\n}\n\n"]}
@@ -1,9 +1,38 @@
1
+ /**
2
+ * https://html.spec.whatwg.org/multipage/forms.html
3
+ */
4
+ /**
5
+ * check the formAssociated property on the associated constructor.
6
+ * @param tagName tag name of the defined custom element
7
+ * @returns boolean
8
+ */
9
+ export declare function isFormAssociatedCustomElementByTag(tagName: string): boolean;
10
+ /**
11
+ * check the formAssociated property on the associated constructor.
12
+ * @param constructor the associated constructor
13
+ * @returns boolean
14
+ */
15
+ export declare function isFormAssociatedCustomElementByConstructor(constructor: CustomElementConstructor): boolean;
16
+ /**
17
+ * check the formAssociated property on the associated constructor on already created element.
18
+ * @param el the element
19
+ * @returns boolean
20
+ */
21
+ export declare function isFormAssociatedCustomElementByElement(el: HTMLElement): boolean;
22
+ export declare function isFormAssociatedCustomElement(item: string | CustomElementConstructor | HTMLElement): boolean;
1
23
  /**
2
24
  * form-associated elements
3
25
  * A number of the elements are form-associated elements, which means they can have a form owner.
4
26
  * @param tagName
5
27
  */
6
28
  export declare function isFormElement(tagName: string): boolean;
29
+ /**
30
+ * Denotes elements that are listed in the form.elements and fieldset.elements APIs.
31
+ * These elements also have a form content attribute, and a matching form IDL attribute,
32
+ * that allow authors to specify an explicit form owner.
33
+ * @param tagName
34
+ */
35
+ export declare function isListedFormElement(tagName: string): boolean;
7
36
  /**
8
37
  * submittable elements
9
38
  * Denotes elements that can be used for constructing the entry list when a form element is submitted.
@@ -12,7 +41,9 @@ export declare function isFormElement(tagName: string): boolean;
12
41
  export declare function isSubmittableElement(tagName: string): boolean;
13
42
  /**
14
43
  * Resettable elements
44
+ * Denotes elements that can be affected when a form element is reset.
15
45
  * @param tagName
46
+ * @returns
16
47
  */
17
48
  export declare function isResettableElement(tagName: string): boolean;
18
49
  /**
@@ -22,11 +53,11 @@ export declare function isResettableElement(tagName: string): boolean;
22
53
  */
23
54
  export declare function isAutocapitalizeInheritingElement(tagName: string): boolean;
24
55
  /**
25
- * Labelable Elements
26
- * Some elements, not all of them form-associated, are categorized as labelable elements.
56
+ * Label-able Elements
57
+ * Some elements, not all of them form-associated, are categorized as label-able elements.
27
58
  * These are elements that can be associated with a label element.
28
59
  *
29
- * this function ignore the 'type' attribute of 'input' tage as '<input type="hidden" />' is consdered as not labled element
60
+ * this function ignore the 'type' attribute of 'input' tag as '<input type="hidden" />' is considered as not labeled element
30
61
  * @param tagName the tested tag name
31
62
  */
32
63
  export declare function isFormLabelableElement(tagName: string): boolean;
@@ -1,3 +1,38 @@
1
+ /**
2
+ * https://html.spec.whatwg.org/multipage/forms.html
3
+ */
4
+ import { isValidCustomElementName } from './common.js';
5
+ /**
6
+ * check the formAssociated property on the associated constructor.
7
+ * @param tagName tag name of the defined custom element
8
+ * @returns boolean
9
+ */
10
+ export function isFormAssociatedCustomElementByTag(tagName) {
11
+ return isValidCustomElementName(tagName) && !!customElements.get(tagName)?.formAssociated;
12
+ }
13
+ /**
14
+ * check the formAssociated property on the associated constructor.
15
+ * @param constructor the associated constructor
16
+ * @returns boolean
17
+ */
18
+ export function isFormAssociatedCustomElementByConstructor(constructor) {
19
+ return !!constructor?.formAssociated;
20
+ }
21
+ /**
22
+ * check the formAssociated property on the associated constructor on already created element.
23
+ * @param el the element
24
+ * @returns boolean
25
+ */
26
+ export function isFormAssociatedCustomElementByElement(el) {
27
+ return el?.constructor && el instanceof HTMLElement && isFormAssociatedCustomElementByConstructor(el.constructor);
28
+ }
29
+ export function isFormAssociatedCustomElement(item) {
30
+ return typeof item === 'string'
31
+ ? isFormAssociatedCustomElementByTag(item)
32
+ : typeof item === 'function'
33
+ ? isFormAssociatedCustomElementByConstructor(item)
34
+ : isFormAssociatedCustomElementByElement(item);
35
+ }
1
36
  /**
2
37
  * form-associated elements
3
38
  * A number of the elements are form-associated elements, which means they can have a form owner.
@@ -19,8 +54,37 @@ export function isFormElement(tagName) {
19
54
  case 'select':
20
55
  case 'textarea':
21
56
  return true;
22
- default: return false;
57
+ default:
58
+ break;
59
+ }
60
+ if (isValidCustomElementName(tagName)) {
61
+ return isFormAssociatedCustomElementByTag(tagName);
23
62
  }
63
+ return false;
64
+ }
65
+ /**
66
+ * Denotes elements that are listed in the form.elements and fieldset.elements APIs.
67
+ * These elements also have a form content attribute, and a matching form IDL attribute,
68
+ * that allow authors to specify an explicit form owner.
69
+ * @param tagName
70
+ */
71
+ export function isListedFormElement(tagName) {
72
+ switch (tagName) {
73
+ case 'button':
74
+ case 'fieldset':
75
+ case 'input':
76
+ case 'object':
77
+ case 'output':
78
+ case 'select':
79
+ case 'textarea':
80
+ return true;
81
+ default:
82
+ break;
83
+ }
84
+ if (isValidCustomElementName(tagName)) {
85
+ return isFormAssociatedCustomElementByTag(tagName);
86
+ }
87
+ return false;
24
88
  }
25
89
  /**
26
90
  * submittable elements
@@ -35,12 +99,19 @@ export function isSubmittableElement(tagName) {
35
99
  case 'select':
36
100
  case 'textarea':
37
101
  return true;
38
- default: return false;
102
+ default:
103
+ break;
104
+ }
105
+ if (isValidCustomElementName(tagName)) {
106
+ return isFormAssociatedCustomElementByTag(tagName);
39
107
  }
108
+ return false;
40
109
  }
41
110
  /**
42
111
  * Resettable elements
112
+ * Denotes elements that can be affected when a form element is reset.
43
113
  * @param tagName
114
+ * @returns
44
115
  */
45
116
  export function isResettableElement(tagName) {
46
117
  switch (tagName) {
@@ -49,8 +120,13 @@ export function isResettableElement(tagName) {
49
120
  case 'select':
50
121
  case 'textarea':
51
122
  return true;
52
- default: return false;
123
+ default:
124
+ break;
125
+ }
126
+ if (isValidCustomElementName(tagName)) {
127
+ return isFormAssociatedCustomElementByTag(tagName);
53
128
  }
129
+ return false;
54
130
  }
55
131
  /**
56
132
  * Autocapitalize-inheriting elements
@@ -70,11 +146,11 @@ export function isAutocapitalizeInheritingElement(tagName) {
70
146
  }
71
147
  }
72
148
  /**
73
- * Labelable Elements
74
- * Some elements, not all of them form-associated, are categorized as labelable elements.
149
+ * Label-able Elements
150
+ * Some elements, not all of them form-associated, are categorized as label-able elements.
75
151
  * These are elements that can be associated with a label element.
76
152
  *
77
- * this function ignore the 'type' attribute of 'input' tage as '<input type="hidden" />' is consdered as not labled element
153
+ * this function ignore the 'type' attribute of 'input' tag as '<input type="hidden" />' is considered as not labeled element
78
154
  * @param tagName the tested tag name
79
155
  */
80
156
  export function isFormLabelableElement(tagName) {
@@ -87,7 +163,12 @@ export function isFormLabelableElement(tagName) {
87
163
  case 'select':
88
164
  case 'textarea':
89
165
  return true;
90
- default: return false;
166
+ default:
167
+ break;
168
+ }
169
+ if (isValidCustomElementName(tagName)) {
170
+ return isFormAssociatedCustomElementByTag(tagName);
91
171
  }
172
+ return false;
92
173
  }
93
174
  //# sourceMappingURL=form.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"form.js","sourceRoot":"","sources":["../../../src/elements/attributes/form.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,OAAe;IAC5C,QAAQ,OAAO,EAAE;QAChB,KAAK,QAAQ,CAAC;QACd,KAAK,UAAU,CAAC;QAChB,KAAK,UAAU,CAAC;QAChB,KAAK,OAAO,CAAC;QACb,KAAK,OAAO,CAAC;QACb,KAAK,Q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,CAAC;QACd,KAAK,UAAU,CAAC;QAChB,KAAK,QAAQ,CAAC;QACd,KAAK,UAAU;YACd,OAAO,IAAI,CAAC;QACb,OAAO,CAAC,CAAC,OAAO,KAAK,CAAC;KACtB;AACF,CAAC","sourcesContent":["/**\n * form-associated elements\n * A number of the elements are form-associated elements, which means they can have a form owner.\n * @param tagName \n */\nexport function isFormElement(tagName: string): boolean {\n\tswitch (tagName) {\n\t\tcase 'button':\n\t\tcase 'datalist':\n\t\tcase 'fieldset':\n\t\tcase 'input':\n\t\tcase 'label':\n\t\tcase 'legend':\n\t\tcase 'meter':\n\t\tcase 'optgroup':\n\t\tcase 'option':\n\t\tcase 'output':\n\t\tcase 'progress':\n\t\tcase 'select':\n\t\tcase 'textarea':\n\t\t\treturn true;\n\t\tdefault: return false;\n\t}\n}\n\n/**\n * submittable elements\n * Denotes elements that can be used for constructing the entry list when a form element is submitted.\n * @param tagName \n */\nexport function isSubmittableElement(tagName: string): boolean {\n\tswitch (tagName) {\n\t\tcase 'button':\n\t\tcase 'input':\n\t\tcase 'object':\n\t\tcase 'select':\n\t\tcase 'textarea':\n\t\t\treturn true;\n\t\tdefault: return false;\n\t}\n}\n\n/**\n * Resettable elements\n * @param tagName \n */\nexport function isResettableElement(tagName: string): boolean {\n\tswitch (tagName) {\n\t\tcase 'input':\n\t\tcase 'output':\n\t\tcase 'select':\n\t\tcase 'textarea':\n\t\t\treturn true;\n\t\tdefault: return false;\n\t}\n}\n\n\n/**\n * Autocapitalize-inheriting elements\n * Denotes elements that inherit the autocapitalize attribute from their form owner.\n * @param tagName \n */\nexport function isAutocapitalizeInheritingElement(tagName: string): boolean {\n\tswitch (tagName) {\n\t\tcase 'button':\n\t\tcase 'fieldset':\n\t\tcase 'input':\n\t\tcase 'output':\n\t\tcase 'select':\n\t\tcase 'textarea':\n\t\t\treturn true;\n\t\tdefault: return false;\n\t}\n}\n\n/**\n * Labelable Elements\n * Some elements, not all of them form-associated, are categorized as labelable elements.\n * These are elements that can be associated with a label element.\n * \n * this function ignore the 'type' attribute of 'input' tage as '<input type=\"hidden\" />' is consdered as not labled element \n * @param tagName the tested tag name\n */\nexport function isFormLabelableElement(tagName: string): boolean {\n\tswitch (tagName) {\n\t\tcase 'button':\n\t\tcase 'input':\n\t\tcase 'meter':\n\t\tcase 'output':\n\t\tcase 'progress':\n\t\tcase 'select':\n\t\tcase 'textarea':\n\t\t\treturn true;\n\t\tdefault: return false;\n\t}\n}\n"]}
1
+ {"version":3,"file":"form.js","sourceRoot":"","sources":["../../../src/elements/attributes/form.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAGvD;;;;GAIG;AACH,MAAM,UAAU,kCAAkC,CAAC,OAAe;IACjE,OAAO,wBAAwB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAE,cAAc,CAAC,GAAG,CAAC,OAAO,CAA0E,EAAE,cAAc,CAAC;AACrK,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,0CAA0C,CAAC,WAAqC;IAC/F,OAAO,CAAC,CAAE,WAAoF,EAAE,cAAc,CAAC;AAChH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,sCAAsC,CAAC,EAAe;IACrE,OAAO,EAAE,EAAE,WAAW,IAAI,EAAE,YAAY,WAAW,IAAI,0CAA0C,CAAC,EAAE,CAAC,WAAuC,CAAC,CAAC;AAC/I,CAAC;AAED,MAAM,UAAU,6BAA6B,CAAC,IAAqD;IAClG,OAAO,OAAO,IAAI,KAAK,QAAQ;QAC9B,CAAC,CAAC,kCAAkC,CAAC,IAAI,CAAC;QAC1C,CAAC,CAAC,OAAO,IAAI,KAAK,UAAU;YAC3B,CAAC,CAAC,0CAA0C,CAAC,IAAI,CAAC;YAClD,CAAC,CAAC,sCAAsC,CAAC,IAAI,CAAC,CAAC;AAClD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,OAAe;IAC5C,QAAQ,OAAO,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K,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAAe;IAClD,QAAQ,OAAO,EAAE;QAChB,KAAK,OAAO,CAAC;QACb,KAAK,QAAQ,CAAC;QACd,KAAK,QAAQ,CAAC;QACd,KAAK,UAAU;YACd,OAAO,IAAI,CAAC;QACb;YACC,MAAM;KACP;IACD,IAAI,wBAAwB,CAAC,OAAO,CAAC,EAAE;QACtC,OAAO,kCAAkC,CAAC,OAAO,CAAC,CAAC;KACnD;IACD,OAAO,KAAK,CAAC;AACd,CAAC;AAGD;;;;GAIG;AACH,MAAM,UAAU,iCAAiC,CAAC,OAAe;IAChE,QAAQ,OAAO,EAAE;QAChB,KAAK,QAAQ,CAAC;QACd,KAAK,UAAU,CAAC;QAChB,KAAK,OAAO,CAAC;QACb,KAAK,QAAQ,CAAC;QACd,KAAK,QAAQ,CAAC;QACd,KAAK,UAAU;YACd,OAAO,IAAI,CAAC;QACb,OAAO,CAAC,CAAC,OAAO,KAAK,CAAC;KACtB;AACF,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,sBAAsB,CAAC,OAAe;IACrD,QAAQ,OAAO,EAAE;QAChB,KAAK,QAAQ,CAAC;QACd,KAAK,OAAO,CAAC;QACb,KAAK,OAAO,CAAC;QACb,KAAK,QAAQ,CAAC;QACd,KAAK,UAAU,CAAC;QAChB,KAAK,QAAQ,CAAC;QACd,KAAK,UAAU;YACd,OAAO,IAAI,CAAC;QACb;YACC,MAAM;KACP;IACD,IAAI,wBAAwB,CAAC,OAAO,CAAC,EAAE;QACtC,OAAO,kCAAkC,CAAC,OAAO,CAAC,CAAC;KACnD;IACD,OAAO,KAAK,CAAC;AACd,CAAC","sourcesContent":["/**\n * https://html.spec.whatwg.org/multipage/forms.html\n */\n\nimport { isValidCustomElementName } from './common.js';\n\n\n/**\n * check the formAssociated property on the associated constructor. \n * @param tagName tag name of the defined custom element\n * @returns boolean\n */\nexport function isFormAssociatedCustomElementByTag(tagName: string) {\n\treturn isValidCustomElementName(tagName) && !!(customElements.get(tagName) as (CustomElementConstructor & { formAssociated: boolean }) | undefined)?.formAssociated;\n}\n\n/**\n * check the formAssociated property on the associated constructor. \n * @param constructor the associated constructor\n * @returns boolean\n */\nexport function isFormAssociatedCustomElementByConstructor(constructor: CustomElementConstructor) {\n\treturn !!(constructor as (CustomElementConstructor & { formAssociated: boolean }) | undefined)?.formAssociated;\n}\n\n/**\n * check the formAssociated property on the associated constructor on already created element. \n * @param el the element\n * @returns boolean\n */\nexport function isFormAssociatedCustomElementByElement(el: HTMLElement) {\n\treturn el?.constructor && el instanceof HTMLElement && isFormAssociatedCustomElementByConstructor(el.constructor as CustomElementConstructor);\n}\n\nexport function isFormAssociatedCustomElement(item: string | CustomElementConstructor | HTMLElement) {\n\treturn typeof item === 'string'\n\t\t? isFormAssociatedCustomElementByTag(item)\n\t\t: typeof item === 'function'\n\t\t\t? isFormAssociatedCustomElementByConstructor(item)\n\t\t\t: isFormAssociatedCustomElementByElement(item);\n}\n\n/**\n * form-associated elements\n * A number of the elements are form-associated elements, which means they can have a form owner.\n * @param tagName \n */\nexport function isFormElement(tagName: string): boolean {\n\tswitch (tagName) {\n\t\tcase 'button':\n\t\tcase 'datalist':\n\t\tcase 'fieldset':\n\t\tcase 'input':\n\t\tcase 'label':\n\t\tcase 'legend':\n\t\tcase 'meter':\n\t\tcase 'optgroup':\n\t\tcase 'option':\n\t\tcase 'output':\n\t\tcase 'progress':\n\t\tcase 'select':\n\t\tcase 'textarea':\n\t\t\treturn true;\n\t\tdefault:\n\t\t\tbreak;\n\t}\n\tif (isValidCustomElementName(tagName)) {\n\t\treturn isFormAssociatedCustomElementByTag(tagName);\n\t}\n\treturn false;\n}\n\n/**\n * Denotes elements that are listed in the form.elements and fieldset.elements APIs.\n * These elements also have a form content attribute, and a matching form IDL attribute,\n * that allow authors to specify an explicit form owner.\n * @param tagName \n */\nexport function isListedFormElement(tagName: string): boolean {\n\tswitch (tagName) {\n\t\tcase 'button':\n\t\tcase 'fieldset':\n\t\tcase 'input':\n\t\tcase 'object':\n\t\tcase 'output':\n\t\tcase 'select':\n\t\tcase 'textarea':\n\t\t\treturn true;\n\t\tdefault:\n\t\t\tbreak;\n\t}\n\tif (isValidCustomElementName(tagName)) {\n\t\treturn isFormAssociatedCustomElementByTag(tagName);\n\t}\n\treturn false;\n}\n\n/**\n * submittable elements\n * Denotes elements that can be used for constructing the entry list when a form element is submitted.\n * @param tagName \n */\nexport function isSubmittableElement(tagName: string): boolean {\n\tswitch (tagName) {\n\t\tcase 'button':\n\t\tcase 'input':\n\t\tcase 'object':\n\t\tcase 'select':\n\t\tcase 'textarea':\n\t\t\treturn true;\n\t\tdefault:\n\t\t\tbreak;\n\t}\n\tif (isValidCustomElementName(tagName)) {\n\t\treturn isFormAssociatedCustomElementByTag(tagName);\n\t}\n\treturn false;\n}\n\n/**\n * Resettable elements\n * Denotes elements that can be affected when a form element is reset.\n * @param tagName \n * @returns \n */\nexport function isResettableElement(tagName: string): boolean {\n\tswitch (tagName) {\n\t\tcase 'input':\n\t\tcase 'output':\n\t\tcase 'select':\n\t\tcase 'textarea':\n\t\t\treturn true;\n\t\tdefault:\n\t\t\tbreak;\n\t}\n\tif (isValidCustomElementName(tagName)) {\n\t\treturn isFormAssociatedCustomElementByTag(tagName);\n\t}\n\treturn false;\n}\n\n\n/**\n * Autocapitalize-inheriting elements\n * Denotes elements that inherit the autocapitalize attribute from their form owner.\n * @param tagName \n */\nexport function isAutocapitalizeInheritingElement(tagName: string): boolean {\n\tswitch (tagName) {\n\t\tcase 'button':\n\t\tcase 'fieldset':\n\t\tcase 'input':\n\t\tcase 'output':\n\t\tcase 'select':\n\t\tcase 'textarea':\n\t\t\treturn true;\n\t\tdefault: return false;\n\t}\n}\n\n/**\n * Label-able Elements\n * Some elements, not all of them form-associated, are categorized as label-able elements.\n * These are elements that can be associated with a label element.\n * \n * this function ignore the 'type' attribute of 'input' tag as '<input type=\"hidden\" />' is considered as not labeled element \n * @param tagName the tested tag name\n */\nexport function isFormLabelableElement(tagName: string): boolean {\n\tswitch (tagName) {\n\t\tcase 'button':\n\t\tcase 'input':\n\t\tcase 'meter':\n\t\tcase 'output':\n\t\tcase 'progress':\n\t\tcase 'select':\n\t\tcase 'textarea':\n\t\t\treturn true;\n\t\tdefault:\n\t\t\tbreak;\n\t}\n\tif (isValidCustomElementName(tagName)) {\n\t\treturn isFormAssociatedCustomElementByTag(tagName);\n\t}\n\treturn false;\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { isValidCustomElementName } from './tags.js';
1
+ import { isValidCustomElementName } from './common.js';
2
2
  export const ShadowElements = [
3
3
  'article',
4
4
  'aside',
@@ -1 +1 @@
1
- {"version":3,"file":"shadow.js","sourceRoot":"","sources":["../../../src/elements/attributes/shadow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAErD,MAAM,CAAC,MAAM,cAAc,GAAG;IAC7B,SAAS;IACT,OAAO;IACP,YAAY;IACZ,MAAM;IACN,KAAK;IACL,QAAQ;IACR,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,QAAQ;IACR,MAAM;IACN,KAAK;IACL,GAAG;IACH,SAAS;IACT,MAAM;CACN,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,eAAe,CAAC,OAAe;IAC9C,IAAI,wBAAwB,CAAC,OAAO,CAAC,EAAE;QACtC,OAAO,IAAI,CAAC;KACZ;IACD,OAAO,cAAc,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AACzC,CAAC","sourcesContent":["import { isValidCustomElementName } from './tags.js';\n\nexport const ShadowElements = [\n\t'article',\n\t'aside',\n\t'blockquote',\n\t'body',\n\t'div',\n\t'footer',\n\t'h1',\n\t'h2',\n\t'h3',\n\t'h4',\n\t'h5',\n\t'h6',\n\t'header',\n\t'main',\n\t'nav',\n\t'p',\n\t'section',\n\t'span',\n];\n\n/**\n * Note that you can't attach a shadow root to every type of element.\n * \n * There are some that can't have a shadow DOM for security reasons (for example <a>), and more besides.\n * \n * The following is a list of elements you can attach a shadow root to:\n * Any autonomous custom element with a valid name,\n * and [\n * article, aside, blockquote, body, div,footer,\n * h1, h2, h3, h4, h5, h6,\n * header, main, nav, p, section, span\n * ]\n * \n * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/attachShadow#elements_you_can_attach_a_shadow_to\n * @param tagName \n * @returns \n */\nexport function canAttachShadow(tagName: string) {\n\tif (isValidCustomElementName(tagName)) {\n\t\treturn true;\n\t}\n\treturn ShadowElements.includes(tagName);\n}\n\n\n"]}
1
+ {"version":3,"file":"shadow.js","sourceRoot":"","sources":["../../../src/elements/attributes/shadow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAEvD,MAAM,CAAC,MAAM,cAAc,GAAG;IAC7B,SAAS;IACT,OAAO;IACP,YAAY;IACZ,MAAM;IACN,KAAK;IACL,QAAQ;IACR,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,QAAQ;IACR,MAAM;IACN,KAAK;IACL,GAAG;IACH,SAAS;IACT,MAAM;CACN,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,eAAe,CAAC,OAAe;IAC9C,IAAI,wBAAwB,CAAC,OAAO,CAAC,EAAE;QACtC,OAAO,IAAI,CAAC;KACZ;IACD,OAAO,cAAc,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AACzC,CAAC","sourcesContent":["import { isValidCustomElementName } from './common.js';\n\nexport const ShadowElements = [\n\t'article',\n\t'aside',\n\t'blockquote',\n\t'body',\n\t'div',\n\t'footer',\n\t'h1',\n\t'h2',\n\t'h3',\n\t'h4',\n\t'h5',\n\t'h6',\n\t'header',\n\t'main',\n\t'nav',\n\t'p',\n\t'section',\n\t'span',\n];\n\n/**\n * Note that you can't attach a shadow root to every type of element.\n * \n * There are some that can't have a shadow DOM for security reasons (for example <a>), and more besides.\n * \n * The following is a list of elements you can attach a shadow root to:\n * Any autonomous custom element with a valid name,\n * and [\n * article, aside, blockquote, body, div,footer,\n * h1, h2, h3, h4, h5, h6,\n * header, main, nav, p, section, span\n * ]\n * \n * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/attachShadow#elements_you_can_attach_a_shadow_to\n * @param tagName \n * @returns \n */\nexport function canAttachShadow(tagName: string) {\n\tif (isValidCustomElementName(tagName)) {\n\t\treturn true;\n\t}\n\treturn ShadowElements.includes(tagName);\n}\n\n\n"]}
@@ -11,16 +11,5 @@ export declare const DefaultTag: Tag;
11
11
  export declare const NativeTags: Tag[];
12
12
  export declare function findByTagName(tagName: string | undefined): Tag;
13
13
  export declare function isTagNameNative(tagName: string): boolean;
14
- /**
15
- * see https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name
16
- * see https://github.com/mathiasbynens/mothereff.in/blob/master/custom-element-name/vendor/is-potential-custom-element-name.js
17
- * @param tagName
18
- */
19
- export declare const CustomElementRegex: RegExp;
20
- export declare function isValidCustomElementName(tagName: string): boolean;
21
14
  export declare function isHTMLUnknownElementTagName(tagName: string): boolean;
22
15
  export declare function getTagName(classRef: TagClassRef): string | undefined;
23
- export declare const EmptyElements: string[];
24
- export declare function isEmptyElement(tagName: string): boolean;
25
- export declare const VoidElements: string[];
26
- export declare const isVoidElement: typeof isEmptyElement;
@@ -1,3 +1,4 @@
1
+ import { isValidCustomElementName } from './common.js';
1
2
  export function getClassRef(htmlElementName) {
2
3
  if (Reflect.has(window, htmlElementName)) {
3
4
  return Reflect.get(window, htmlElementName);
@@ -330,15 +331,6 @@ export function findByTagName(tagName) {
330
331
  export function isTagNameNative(tagName) {
331
332
  return (tagName in HTMLElementTagNameMap) || (tagName in SVGElementTagNameMap);
332
333
  }
333
- /**
334
- * see https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name
335
- * see https://github.com/mathiasbynens/mothereff.in/blob/master/custom-element-name/vendor/is-potential-custom-element-name.js
336
- * @param tagName
337
- */
338
- export const CustomElementRegex = /^[a-z](?:[\-\.0-9_a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*-(?:[\-\.0-9_a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*$/;
339
- export function isValidCustomElementName(tagName) {
340
- return CustomElementRegex.test(tagName);
341
- }
342
334
  export function isHTMLUnknownElementTagName(tagName) {
343
335
  for (const tag of NativeTags) {
344
336
  if (tag.name === tagName) {
@@ -358,10 +350,4 @@ export function getTagName(classRef) {
358
350
  }
359
351
  return undefined;
360
352
  }
361
- export const EmptyElements = ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'link', 'meta', 'param', 'source', 'track', 'wbr'];
362
- export function isEmptyElement(tagName) {
363
- return EmptyElements.includes(tagName);
364
- }
365
- export const VoidElements = EmptyElements;
366
- export const isVoidElement = isEmptyElement;
367
353
  //# sourceMappingURL=tags.js.map