amateras 0.7.4 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +76 -85
- package/package.json +29 -33
- package/tsconfig.json +4 -3
- package/packages/core/package.json +0 -32
- package/packages/core/src/env.browser.ts +0 -21
- package/packages/core/src/env.node.ts +0 -21
- package/packages/core/src/global.ts +0 -18
- package/packages/core/src/index.ts +0 -96
- package/packages/core/src/lib/assignNodeProperties.ts +0 -11
- package/packages/core/src/lib/assignProperties.ts +0 -57
- package/packages/core/src/lib/chain.ts +0 -17
- package/packages/core/src/lib/dom.ts +0 -20
- package/packages/core/src/main.ts +0 -4
- package/packages/core/src/node/$Element.ts +0 -366
- package/packages/core/src/node/$EventTarget.ts +0 -48
- package/packages/core/src/node/$HTMLElement.ts +0 -99
- package/packages/core/src/node/$Node.ts +0 -201
- package/packages/core/src/node/$Virtual.ts +0 -65
- package/packages/css/README.md +0 -128
- package/packages/css/package.json +0 -17
- package/packages/css/src/ext/colors/amber.ts +0 -25
- package/packages/css/src/ext/colors/blackwhite.ts +0 -13
- package/packages/css/src/ext/colors/blue.ts +0 -25
- package/packages/css/src/ext/colors/cyan.ts +0 -25
- package/packages/css/src/ext/colors/emerald.ts +0 -25
- package/packages/css/src/ext/colors/fuchsia.ts +0 -25
- package/packages/css/src/ext/colors/gray.ts +0 -25
- package/packages/css/src/ext/colors/green.ts +0 -25
- package/packages/css/src/ext/colors/indigo.ts +0 -25
- package/packages/css/src/ext/colors/lime.ts +0 -25
- package/packages/css/src/ext/colors/neutral.ts +0 -25
- package/packages/css/src/ext/colors/orange.ts +0 -25
- package/packages/css/src/ext/colors/pink.ts +0 -25
- package/packages/css/src/ext/colors/purple.ts +0 -25
- package/packages/css/src/ext/colors/red.ts +0 -25
- package/packages/css/src/ext/colors/rose.ts +0 -25
- package/packages/css/src/ext/colors/sky.ts +0 -25
- package/packages/css/src/ext/colors/slate.ts +0 -25
- package/packages/css/src/ext/colors/stone.ts +0 -25
- package/packages/css/src/ext/colors/teal.ts +0 -25
- package/packages/css/src/ext/colors/violet.ts +0 -25
- package/packages/css/src/ext/colors/yellow.ts +0 -25
- package/packages/css/src/ext/colors/zinc.ts +0 -25
- package/packages/css/src/ext/colors.ts +0 -23
- package/packages/css/src/ext/container.ts +0 -32
- package/packages/css/src/ext/keyframes.ts +0 -54
- package/packages/css/src/ext/media.ts +0 -32
- package/packages/css/src/ext/property.ts +0 -48
- package/packages/css/src/ext/variable.ts +0 -51
- package/packages/css/src/index.ts +0 -436
- package/packages/css/src/lib/colorAssign.ts +0 -6
- package/packages/css/src/lib/utils.ts +0 -11
- package/packages/css/src/structure/$CSSContainerRule.ts +0 -13
- package/packages/css/src/structure/$CSSDeclaration.ts +0 -16
- package/packages/css/src/structure/$CSSKeyframesRule.ts +0 -13
- package/packages/css/src/structure/$CSSMediaRule.ts +0 -10
- package/packages/css/src/structure/$CSSProperty.ts +0 -19
- package/packages/css/src/structure/$CSSRule.ts +0 -13
- package/packages/css/src/structure/$CSSStyleRule.ts +0 -14
- package/packages/css/src/structure/$CSSVariable.ts +0 -30
- package/packages/dom/package.json +0 -20
- package/packages/dom/src/lib/HTMLElementMap.ts +0 -213
- package/packages/dom/src/lib/assignAttributes.ts +0 -16
- package/packages/dom/src/structure/CSS.ts +0 -7
- package/packages/dom/src/structure/CSSStyleSheet.ts +0 -10
- package/packages/dom/src/structure/DOMTokenList.ts +0 -19
- package/packages/dom/src/structure/Document.ts +0 -36
- package/packages/dom/src/structure/Element.ts +0 -106
- package/packages/dom/src/structure/HTMLElement.ts +0 -34
- package/packages/dom/src/structure/History.ts +0 -11
- package/packages/dom/src/structure/Location.ts +0 -9
- package/packages/dom/src/structure/Node.ts +0 -51
- package/packages/dom/src/structure/NodeList.ts +0 -10
- package/packages/dom/src/structure/Storage.ts +0 -8
- package/packages/dom/src/structure/Text.ts +0 -20
- package/packages/dom/src/structure/Window.ts +0 -14
- package/packages/dom/src/structure/html/HTMLAbbrElement.ts +0 -16
- package/packages/dom/src/structure/html/HTMLAddressElement.ts +0 -16
- package/packages/dom/src/structure/html/HTMLAnchorElement.ts +0 -25
- package/packages/dom/src/structure/html/HTMLAreaElement.ts +0 -26
- package/packages/dom/src/structure/html/HTMLArticleElement.ts +0 -16
- package/packages/dom/src/structure/html/HTMLAsideElement.ts +0 -16
- package/packages/dom/src/structure/html/HTMLAudioElement.ts +0 -16
- package/packages/dom/src/structure/html/HTMLBDIElement.ts +0 -16
- package/packages/dom/src/structure/html/HTMLBDOElement.ts +0 -16
- package/packages/dom/src/structure/html/HTMLBElement.ts +0 -16
- package/packages/dom/src/structure/html/HTMLBRElement.ts +0 -17
- package/packages/dom/src/structure/html/HTMLBaseElement.ts +0 -18
- package/packages/dom/src/structure/html/HTMLBodyElement.ts +0 -22
- package/packages/dom/src/structure/html/HTMLButtonElement.ts +0 -26
- package/packages/dom/src/structure/html/HTMLCanvasElement.ts +0 -18
- package/packages/dom/src/structure/html/HTMLCiteElement.ts +0 -16
- package/packages/dom/src/structure/html/HTMLCodeElement.ts +0 -16
- package/packages/dom/src/structure/html/HTMLDDElement.ts +0 -16
- package/packages/dom/src/structure/html/HTMLDFNElement.ts +0 -16
- package/packages/dom/src/structure/html/HTMLDListElement.ts +0 -17
- package/packages/dom/src/structure/html/HTMLDTElement.ts +0 -16
- package/packages/dom/src/structure/html/HTMLDataElement.ts +0 -17
- package/packages/dom/src/structure/html/HTMLDataListElement.ts +0 -16
- package/packages/dom/src/structure/html/HTMLDetailsElement.ts +0 -17
- package/packages/dom/src/structure/html/HTMLDialogElement.ts +0 -18
- package/packages/dom/src/structure/html/HTMLDivElement.ts +0 -17
- package/packages/dom/src/structure/html/HTMLEMElement.ts +0 -16
- package/packages/dom/src/structure/html/HTMLEmbedElement.ts +0 -20
- package/packages/dom/src/structure/html/HTMLFieldSetElement.ts +0 -19
- package/packages/dom/src/structure/html/HTMLFigCaptionElement.ts +0 -16
- package/packages/dom/src/structure/html/HTMLFigureElement.ts +0 -16
- package/packages/dom/src/structure/html/HTMLFooterElement.ts +0 -16
- package/packages/dom/src/structure/html/HTMLFormElement.ts +0 -24
- package/packages/dom/src/structure/html/HTMLHGroupElement.ts +0 -16
- package/packages/dom/src/structure/html/HTMLHRElement.ts +0 -21
- package/packages/dom/src/structure/html/HTMLHeadElement.ts +0 -16
- package/packages/dom/src/structure/html/HTMLHeaderElement.ts +0 -16
- package/packages/dom/src/structure/html/HTMLHeadingElement.ts +0 -17
- package/packages/dom/src/structure/html/HTMLHtmlElement.ts +0 -18
- package/packages/dom/src/structure/html/HTMLIElement.ts +0 -16
- package/packages/dom/src/structure/html/HTMLIFrameElement.ts +0 -31
- package/packages/dom/src/structure/html/HTMLImageElement.ts +0 -38
- package/packages/dom/src/structure/html/HTMLInputElement.ts +0 -55
- package/packages/dom/src/structure/html/HTMLKBDElement.ts +0 -16
- package/packages/dom/src/structure/html/HTMLLIElement.ts +0 -18
- package/packages/dom/src/structure/html/HTMLLabelElement.ts +0 -18
- package/packages/dom/src/structure/html/HTMLLegendElement.ts +0 -17
- package/packages/dom/src/structure/html/HTMLLinkElement.ts +0 -31
- package/packages/dom/src/structure/html/HTMLMainElement.ts +0 -16
- package/packages/dom/src/structure/html/HTMLMapElement.ts +0 -17
- package/packages/dom/src/structure/html/HTMLMarkElement.ts +0 -16
- package/packages/dom/src/structure/html/HTMLMediaElement.ts +0 -48
- package/packages/dom/src/structure/html/HTMLMenuElement.ts +0 -18
- package/packages/dom/src/structure/html/HTMLMetaElement.ts +0 -22
- package/packages/dom/src/structure/html/HTMLMeterElement.ts +0 -23
- package/packages/dom/src/structure/html/HTMLModElement.ts +0 -18
- package/packages/dom/src/structure/html/HTMLNavElement.ts +0 -16
- package/packages/dom/src/structure/html/HTMLNoscriptElement.ts +0 -16
- package/packages/dom/src/structure/html/HTMLOListElement.ts +0 -20
- package/packages/dom/src/structure/html/HTMLObjectElement.ts +0 -34
- package/packages/dom/src/structure/html/HTMLOptGroupElement.ts +0 -18
- package/packages/dom/src/structure/html/HTMLOptionElement.ts +0 -20
- package/packages/dom/src/structure/html/HTMLOutputElement.ts +0 -20
- package/packages/dom/src/structure/html/HTMLParagraphElement.ts +0 -17
- package/packages/dom/src/structure/html/HTMLPictureElement.ts +0 -16
- package/packages/dom/src/structure/html/HTMLPreElement.ts +0 -17
- package/packages/dom/src/structure/html/HTMLProgressElement.ts +0 -19
- package/packages/dom/src/structure/html/HTMLQuoteElement.ts +0 -17
- package/packages/dom/src/structure/html/HTMLRPElement.ts +0 -16
- package/packages/dom/src/structure/html/HTMLRTElement.ts +0 -16
- package/packages/dom/src/structure/html/HTMLRubyElement.ts +0 -16
- package/packages/dom/src/structure/html/HTMLSElement.ts +0 -16
- package/packages/dom/src/structure/html/HTMLSampElement.ts +0 -16
- package/packages/dom/src/structure/html/HTMLScriptElement.ts +0 -27
- package/packages/dom/src/structure/html/HTMLSectionElement.ts +0 -16
- package/packages/dom/src/structure/html/HTMLSelectElement.ts +0 -27
- package/packages/dom/src/structure/html/HTMLSlotElement.ts +0 -17
- package/packages/dom/src/structure/html/HTMLSmallElement.ts +0 -16
- package/packages/dom/src/structure/html/HTMLSourceElement.ts +0 -21
- package/packages/dom/src/structure/html/HTMLSpanElement.ts +0 -16
- package/packages/dom/src/structure/html/HTMLStrongElement.ts +0 -16
- package/packages/dom/src/structure/html/HTMLStyleElement.ts +0 -18
- package/packages/dom/src/structure/html/HTMLSubElement.ts +0 -16
- package/packages/dom/src/structure/html/HTMLSummaryElement.ts +0 -16
- package/packages/dom/src/structure/html/HTMLSupElement.ts +0 -16
- package/packages/dom/src/structure/html/HTMLTableCaptionElement.ts +0 -17
- package/packages/dom/src/structure/html/HTMLTableCellElement.ts +0 -31
- package/packages/dom/src/structure/html/HTMLTableColElement.ts +0 -23
- package/packages/dom/src/structure/html/HTMLTableElement.ts +0 -26
- package/packages/dom/src/structure/html/HTMLTableRowElement.ts +0 -23
- package/packages/dom/src/structure/html/HTMLTableSectionElement.ts +0 -20
- package/packages/dom/src/structure/html/HTMLTemplateElement.ts +0 -17
- package/packages/dom/src/structure/html/HTMLTextAreaElement.ts +0 -33
- package/packages/dom/src/structure/html/HTMLTimeElement.ts +0 -17
- package/packages/dom/src/structure/html/HTMLTitleElement.ts +0 -17
- package/packages/dom/src/structure/html/HTMLTrackElement.ts +0 -21
- package/packages/dom/src/structure/html/HTMLUElement.ts +0 -16
- package/packages/dom/src/structure/html/HTMLUListElement.ts +0 -18
- package/packages/dom/src/structure/html/HTMLVarElement.ts +0 -16
- package/packages/dom/src/structure/html/HTMLVideoElement.ts +0 -22
- package/packages/dom/src/structure/html/HTMLWBRElement.ts +0 -16
- package/packages/html/package.json +0 -18
- package/packages/html/src/index.ts +0 -13
- package/packages/html/src/node/$Anchor.ts +0 -49
- package/packages/html/src/node/$Canvas.ts +0 -38
- package/packages/html/src/node/$Dialog.ts +0 -16
- package/packages/html/src/node/$Form.ts +0 -16
- package/packages/html/src/node/$Image.ts +0 -72
- package/packages/html/src/node/$Input.ts +0 -193
- package/packages/html/src/node/$Label.ts +0 -25
- package/packages/html/src/node/$Media.ts +0 -16
- package/packages/html/src/node/$OptGroup.ts +0 -23
- package/packages/html/src/node/$Option.ts +0 -40
- package/packages/html/src/node/$Select.ts +0 -76
- package/packages/html/src/node/$TextArea.ts +0 -16
- package/packages/i18n/README.md +0 -73
- package/packages/i18n/package.json +0 -19
- package/packages/i18n/src/index.ts +0 -140
- package/packages/i18n/src/structure/I18n.ts +0 -44
- package/packages/i18n/src/structure/I18nDictionary.ts +0 -31
- package/packages/i18n/src/structure/I18nTranslation.ts +0 -41
- package/packages/idb/README.md +0 -127
- package/packages/idb/package.json +0 -19
- package/packages/idb/src/core.ts +0 -6
- package/packages/idb/src/index.ts +0 -17
- package/packages/idb/src/lib/$IDBRequest.ts +0 -8
- package/packages/idb/src/structure/$IDB.ts +0 -63
- package/packages/idb/src/structure/$IDBCursor.ts +0 -34
- package/packages/idb/src/structure/$IDBIndex.ts +0 -48
- package/packages/idb/src/structure/$IDBStore.ts +0 -103
- package/packages/idb/src/structure/$IDBStoreBase.ts +0 -30
- package/packages/idb/src/structure/$IDBTransaction.ts +0 -38
- package/packages/idb/src/structure/builder/$IDBBuilder.ts +0 -229
- package/packages/idb/src/structure/builder/$IDBStoreBuilder.ts +0 -100
- package/packages/markdown/README.md +0 -53
- package/packages/markdown/package.json +0 -19
- package/packages/markdown/src/index.ts +0 -3
- package/packages/markdown/src/lib/type.ts +0 -26
- package/packages/markdown/src/lib/util.ts +0 -21
- package/packages/markdown/src/structure/Markdown.ts +0 -54
- package/packages/markdown/src/structure/MarkdownLexer.ts +0 -111
- package/packages/markdown/src/structure/MarkdownParser.ts +0 -34
- package/packages/markdown/src/syntax/alert.ts +0 -46
- package/packages/markdown/src/syntax/blockquote.ts +0 -35
- package/packages/markdown/src/syntax/bold.ts +0 -11
- package/packages/markdown/src/syntax/code.ts +0 -11
- package/packages/markdown/src/syntax/codeblock.ts +0 -44
- package/packages/markdown/src/syntax/heading.ts +0 -14
- package/packages/markdown/src/syntax/horizontalRule.ts +0 -11
- package/packages/markdown/src/syntax/image.ts +0 -23
- package/packages/markdown/src/syntax/italic.ts +0 -11
- package/packages/markdown/src/syntax/link.ts +0 -46
- package/packages/markdown/src/syntax/list.ts +0 -121
- package/packages/markdown/src/syntax/table.ts +0 -67
- package/packages/markdown/src/syntax/text.ts +0 -19
- package/packages/router/README.md +0 -175
- package/packages/router/package.json +0 -19
- package/packages/router/src/index.ts +0 -68
- package/packages/router/src/node/Page.ts +0 -38
- package/packages/router/src/node/Router.ts +0 -212
- package/packages/router/src/node/RouterAnchor.ts +0 -24
- package/packages/router/src/structure/PageBuilder.ts +0 -24
- package/packages/router/src/structure/Route.ts +0 -105
- package/packages/signal/README.md +0 -93
- package/packages/signal/package.json +0 -18
- package/packages/signal/src/index.ts +0 -221
- package/packages/signal/src/structure/Signal.ts +0 -38
- package/packages/ui/lib/VirtualScroll.ts +0 -25
- package/packages/ui/node/Accordian.ts +0 -97
- package/packages/ui/node/Carousel.ts +0 -20
- package/packages/ui/node/Form.ts +0 -54
- package/packages/ui/node/Grid.ts +0 -0
- package/packages/ui/node/Modal.ts +0 -45
- package/packages/ui/node/Table.ts +0 -43
- package/packages/ui/node/Tabs.ts +0 -129
- package/packages/ui/node/Toast.ts +0 -16
- package/packages/ui/node/Waterfall.ts +0 -94
- package/packages/ui/package.json +0 -21
- package/packages/utils/package.json +0 -17
- package/packages/utils/src/global.ts +0 -25
- package/packages/utils/src/index.ts +0 -90
|
@@ -1,436 +0,0 @@
|
|
|
1
|
-
import { _Array_from, _instanceof, _JSON_stringify, _Object_assign, _Object_entries, _Object_fromEntries, forEach, isObject, isUndefined, startsWith } from "@amateras/utils";
|
|
2
|
-
import { $Element } from "@amateras/core/node/$Element";
|
|
3
|
-
import { $CSSDeclaration } from "#structure/$CSSDeclaration";
|
|
4
|
-
import { $CSSRule } from "#structure/$CSSRule";
|
|
5
|
-
import { $CSSStyleRule } from "#structure/$CSSStyleRule";
|
|
6
|
-
import { generateId } from "./lib/utils";
|
|
7
|
-
|
|
8
|
-
declare module '@amateras/core' {
|
|
9
|
-
export namespace $ {
|
|
10
|
-
export function css(options: $CSSMap | $CSSStyleRule): $CSSStyleRule
|
|
11
|
-
export function CSS(options: $CSSSelectors | $CSSGlobalDeclarationExtends): void
|
|
12
|
-
|
|
13
|
-
export interface $CSSValueTypeExtendsMap {}
|
|
14
|
-
export type $CSSValueTypeExtends = $CSSValueTypeExtendsMap[keyof $CSSValueTypeExtendsMap]
|
|
15
|
-
|
|
16
|
-
export interface $CSSGlobalDeclarationExtendsMap {}
|
|
17
|
-
export type $CSSGlobalDeclarationExtends = $CSSGlobalDeclarationExtendsMap[keyof $CSSGlobalDeclarationExtendsMap];
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
declare module '@amateras/core/node/$Element' {
|
|
22
|
-
export interface $Element {
|
|
23
|
-
css(...options: ($CSSMap | $CSSStyleRule)[]): this;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
export namespace $CSS {
|
|
29
|
-
|
|
30
|
-
const stylesheet = $.stylesheet;
|
|
31
|
-
const cssTextMap = new Map<string, $CSSStyleRule>();
|
|
32
|
-
|
|
33
|
-
export const valueInstances = new Set<any>();
|
|
34
|
-
export const cssTextProcessors = new Set<$TextProcessor>();
|
|
35
|
-
export type $TextProcessor = (rule: $CSSRule, context: string, data?: {mediaContext?: string[], containerContext?: string[]}) => string[] | undefined;
|
|
36
|
-
export const createRuleProcessors = new Set<$CreateRuleProcessor>();
|
|
37
|
-
export type $CreateRuleProcessor = (selector: string, options: $CSSMap, context?: string) => $CSSRule | undefined;
|
|
38
|
-
|
|
39
|
-
export const CSSOptions = <T extends $CSSStyleRule>(
|
|
40
|
-
rule: T,
|
|
41
|
-
options: $CSSMap,
|
|
42
|
-
): T => {
|
|
43
|
-
for (const [key, value] of _Object_entries(options)) {
|
|
44
|
-
if (isUndefined(value)) continue;
|
|
45
|
-
else if (_instanceof(value, $CSSDeclaration)) rule.declarations.set(value.key, value);
|
|
46
|
-
else if (isObject(value) && !_instanceof(value, ...valueInstances))
|
|
47
|
-
rule.rules.add( createRule(key, value, rule.selector) );
|
|
48
|
-
else {
|
|
49
|
-
const declaration = new $CSSDeclaration(key, `${value}`);
|
|
50
|
-
rule.declarations.set(declaration.key, declaration);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
return rule;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/** Create rule with several type depend on selector content.
|
|
57
|
-
* @param context - for media rule creation, it should be style rule selector same as nested parent of media rule.
|
|
58
|
-
*/
|
|
59
|
-
export const createRule = (selector: string, options: $CSSMap, context?: string) => {
|
|
60
|
-
for (const processor of createRuleProcessors) {
|
|
61
|
-
const result = processor(selector, options, context);
|
|
62
|
-
if (!isUndefined(result)) return result;
|
|
63
|
-
}
|
|
64
|
-
return createStyleRule(selector, options);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const createStyleRule = <T extends $CSSMap>(selector: string, options: T) => CSSOptions(new $CSSStyleRule(selector), options);
|
|
68
|
-
|
|
69
|
-
export const insertRule = (rule: $CSSRule) => {
|
|
70
|
-
cssText(rule).forEach(text => {
|
|
71
|
-
const selector = text.match(/^(.+?) {/)?.[1];
|
|
72
|
-
if (!selector) return;
|
|
73
|
-
if (!startsWith(selector, '@') && selector.split(',').find(str => !CSS.supports(`selector(${str})`))) return;
|
|
74
|
-
$.style(text, stylesheet.cssRules.length);
|
|
75
|
-
})
|
|
76
|
-
return rule
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export const cssText = (rule: $CSSRule, context: string = '', data?: {mediaContext?: string[], containerContext?: string[]}): string[] => {
|
|
80
|
-
if (_instanceof(rule, $CSSStyleRule)) {
|
|
81
|
-
const split = (str: string) => str.split(',');
|
|
82
|
-
const relation = (str: string, ctx: string): string => {
|
|
83
|
-
if (str.includes('&')) return str.replaceAll('&', ctx);
|
|
84
|
-
else return `${ctx ? ctx + ' ': ''}${str}`
|
|
85
|
-
}
|
|
86
|
-
const selectors = split(rule.selector);
|
|
87
|
-
const selector = split(context).map(ctx => selectors.map(selector => relation(selector, ctx))).join(', ');
|
|
88
|
-
const text = `${selector} { ${_Array_from(rule.declarations).map(([_, dec]) => `${dec}`).join(' ')} }`
|
|
89
|
-
return [text, ..._Array_from(rule.rules).map(childRule => cssText(childRule, selector, data)).flat()]
|
|
90
|
-
}
|
|
91
|
-
for (const processor of cssTextProcessors) {
|
|
92
|
-
const result = processor(rule, context, data);
|
|
93
|
-
if (!isUndefined(result)) return result;
|
|
94
|
-
}
|
|
95
|
-
throw '$CSS RULE TYPE ERROR'
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// Add $.css and $.CSS methods
|
|
99
|
-
_Object_assign($, {
|
|
100
|
-
css(options: $CSSMap | $CSSStyleRule) {
|
|
101
|
-
if (_instanceof(options, $CSSRule)) return options;
|
|
102
|
-
const cssText = _JSON_stringify(options);
|
|
103
|
-
const cacheRule = cssTextMap.get(cssText);
|
|
104
|
-
if (cacheRule) return cacheRule;
|
|
105
|
-
const className = `.${generateId()}`;
|
|
106
|
-
const rule = createStyleRule(className, options);
|
|
107
|
-
cssTextMap.set(_JSON_stringify(options), rule);
|
|
108
|
-
return insertRule( rule );
|
|
109
|
-
},
|
|
110
|
-
CSS(options: $CSSSelectors) {
|
|
111
|
-
return _Object_entries(options).map(([selector, declarations]) => {
|
|
112
|
-
return insertRule( createRule(selector, declarations) );
|
|
113
|
-
})
|
|
114
|
-
}
|
|
115
|
-
})
|
|
116
|
-
|
|
117
|
-
// Add $Element.css method
|
|
118
|
-
_Object_assign($Element.prototype, {
|
|
119
|
-
css(this: $Element, ...options: ($CSSMap | $CSSStyleRule)[]) {
|
|
120
|
-
forEach(options, options => {
|
|
121
|
-
const rule = $.css(options);
|
|
122
|
-
this.addClass(rule.selector.replace(/^./, ''));
|
|
123
|
-
})
|
|
124
|
-
return this;
|
|
125
|
-
}
|
|
126
|
-
})
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
export * from "#structure/$CSSDeclaration";
|
|
130
|
-
export * from "#structure/$CSSRule";
|
|
131
|
-
export * from "#structure/$CSSStyleRule";
|
|
132
|
-
|
|
133
|
-
export type $CSSMap = $CSSDeclarations | $CSSSelectors;
|
|
134
|
-
export type $CSSValueType = '' | 'unset' | 'initial' | 'inherit' | string & {} | number | $.$CSSValueTypeExtends
|
|
135
|
-
export type $CSSDeclarations = { [key in keyof $CSSDeclarationMap]?: $CSSDeclarationMap[key] | $CSSValueType } | { [key: string]: $CSSValueType }
|
|
136
|
-
export type $CSSSelectors = { [key: string & {}]: $CSSMap }
|
|
137
|
-
|
|
138
|
-
interface $CSSDeclarationMap {
|
|
139
|
-
alignContent: 'flex-start' | 'flex-end' | 'center' | 'space-between' | 'space-around' | 'space-evenly' | 'stretch' | 'normal';
|
|
140
|
-
alignItems: 'normal' | 'stretch' | 'center' | 'flex-start' | 'flex-end' | 'baseline';
|
|
141
|
-
alignSelf: 'auto' | 'normal' | 'stretch' | 'center' | 'flex-start' | 'flex-end' | 'baseline';
|
|
142
|
-
all: 'initial' | 'inherit' | 'unset';
|
|
143
|
-
animation: string;
|
|
144
|
-
animationDelay: string;
|
|
145
|
-
animationDirection: 'normal' | 'reverse' | 'alternate' | 'alternate-reverse';
|
|
146
|
-
animationDuration: string;
|
|
147
|
-
animationFillMode: 'none' | 'forwards' | 'backwards' | 'both';
|
|
148
|
-
animationIterationCount: 'infinite' | number;
|
|
149
|
-
animationName: string;
|
|
150
|
-
animationPlayState: 'running' | 'paused';
|
|
151
|
-
animationTimingFunction: 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear' | 'step-start' | 'step-end';
|
|
152
|
-
animationComposition: 'replace' | 'add' | 'accumulate';
|
|
153
|
-
aspectRatio: string;
|
|
154
|
-
appearance: 'none' | 'auto' | 'menulist-button' | 'textfield' | 'base-select' | 'button' | 'checkbox';
|
|
155
|
-
backdropFilter: string;
|
|
156
|
-
backfaceVisibility: 'visible' | 'hidden';
|
|
157
|
-
background: string;
|
|
158
|
-
backgroundAttachment: 'scroll' | 'fixed' | 'local';
|
|
159
|
-
backgroundBlendMode: 'normal' | 'multiply' | 'screen' | 'overlay' | 'darken' | 'lighten' | 'color-dodge' | 'color-burn' | 'hard-light' | 'soft-light' | 'difference' | 'exclusion' | 'hue' | 'saturation' | 'color' | 'luminosity';
|
|
160
|
-
backgroundClip: 'border-box' | 'padding-box' | 'content-box' | 'text';
|
|
161
|
-
backgroundColor: string;
|
|
162
|
-
backgroundImage: string;
|
|
163
|
-
backgroundOrigin: 'border-box' | 'padding-box' | 'content-box';
|
|
164
|
-
backgroundPosition: string;
|
|
165
|
-
backgroundRepeat: 'repeat' | 'repeat-x' | 'repeat-y' | 'no-repeat' | 'space' | 'round';
|
|
166
|
-
backgroundSize: 'auto' | 'cover' | 'contain';
|
|
167
|
-
border: string;
|
|
168
|
-
borderBottom: string;
|
|
169
|
-
borderBottomColor: string;
|
|
170
|
-
borderBottomLeftRadius: string;
|
|
171
|
-
borderBottomRightRadius: string;
|
|
172
|
-
borderBottomStyle: 'none' | 'hidden' | 'dotted' | 'dashed' | 'solid' | 'double' | 'groove' | 'ridge' | 'inset' | 'outset';
|
|
173
|
-
borderBottomWidth: string;
|
|
174
|
-
borderCollapse: 'collapse' | 'separate';
|
|
175
|
-
borderColor: string;
|
|
176
|
-
borderImage: string;
|
|
177
|
-
borderImageOutset: string;
|
|
178
|
-
borderImageRepeat: 'stretch' | 'repeat' | 'round' | 'space';
|
|
179
|
-
borderImageSlice: string;
|
|
180
|
-
borderImageSource: string;
|
|
181
|
-
borderImageWidth: string;
|
|
182
|
-
borderLeft: string;
|
|
183
|
-
borderLeftColor: string;
|
|
184
|
-
borderLeftStyle: 'none' | 'hidden' | 'dotted' | 'dashed' | 'solid' | 'double' | 'groove' | 'ridge' | 'inset' | 'outset';
|
|
185
|
-
borderLeftWidth: string;
|
|
186
|
-
borderRadius: string;
|
|
187
|
-
borderRight: string;
|
|
188
|
-
borderRightColor: string;
|
|
189
|
-
borderRightStyle: 'none' | 'hidden' | 'dotted' | 'dashed' | 'solid' | 'double' | 'groove' | 'ridge' | 'inset' | 'outset';
|
|
190
|
-
borderRightWidth: string;
|
|
191
|
-
borderSpacing: string;
|
|
192
|
-
borderStyle: 'none' | 'hidden' | 'dotted' | 'dashed' | 'solid' | 'double' | 'groove' | 'ridge' | 'inset' | 'outset';
|
|
193
|
-
borderTop: string;
|
|
194
|
-
borderTopColor: string;
|
|
195
|
-
borderTopLeftRadius: string;
|
|
196
|
-
borderTopRightRadius: string;
|
|
197
|
-
borderTopStyle: 'none' | 'hidden' | 'dotted' | 'dashed' | 'solid' | 'double' | 'groove' | 'ridge' | 'inset' | 'outset';
|
|
198
|
-
borderTopWidth: string;
|
|
199
|
-
borderWidth: string;
|
|
200
|
-
bottom: string;
|
|
201
|
-
boxShadow: string;
|
|
202
|
-
boxSizing: 'content-box' | 'border-box';
|
|
203
|
-
breakAfter: 'auto' | 'avoid' | 'always' | 'all' | 'avoid-page' | 'page' | 'left' | 'right' | 'recto' | 'verso' | 'column' | 'avoid-column';
|
|
204
|
-
breakBefore: 'auto' | 'avoid' | 'always' | 'all' | 'avoid-page' | 'page' | 'left' | 'right' | 'recto' | 'verso' | 'column' | 'avoid-column';
|
|
205
|
-
breakInside: 'auto' | 'avoid' | 'avoid-page' | 'avoid-column';
|
|
206
|
-
captionSide: 'top' | 'bottom';
|
|
207
|
-
caretColor: string;
|
|
208
|
-
clear: 'none' | 'left' | 'right' | 'both';
|
|
209
|
-
clip: string;
|
|
210
|
-
clipPath: string;
|
|
211
|
-
color: string;
|
|
212
|
-
columnCount: 'auto' | number;
|
|
213
|
-
columnFill: 'balance' | 'auto';
|
|
214
|
-
columnGap: string;
|
|
215
|
-
columnRule: string;
|
|
216
|
-
columnRuleColor: string;
|
|
217
|
-
columnRuleStyle: 'none' | 'hidden' | 'dotted' | 'dashed' | 'solid' | 'double' | 'groove' | 'ridge' | 'inset' | 'outset';
|
|
218
|
-
columnRuleWidth: string;
|
|
219
|
-
columnSpan: 'none' | 'all';
|
|
220
|
-
columnWidth: string;
|
|
221
|
-
columns: string;
|
|
222
|
-
content: string;
|
|
223
|
-
counterIncrement: string;
|
|
224
|
-
counterReset: string;
|
|
225
|
-
containerName: string;
|
|
226
|
-
containerType: 'inline-size' | 'size' | 'normal' | 'scroll-state';
|
|
227
|
-
cursor: 'auto' | 'default' | 'none' | 'context-menu' | 'help' | 'pointer' | 'progress' | 'wait' | 'cell' | 'crosshair' | 'text' | 'vertical-text' | 'alias' | 'copy' | 'move' | 'no-drop' | 'not-allowed' | 'e-resize' | 'n-resize' | 'ne-resize' | 'nw-resize' | 's-resize' | 'se-resize' | 'sw-resize' | 'w-resize' | 'ew-resize' | 'ns-resize' | 'nesw-resize' | 'nwse-resize' | 'col-resize' | 'row-resize' | 'all-scroll' | 'zoom-in' | 'zoom-out' | 'grab' | 'grabbing';
|
|
228
|
-
direction: 'ltr' | 'rtl';
|
|
229
|
-
display: 'block' | 'inline' | 'inline-block' | 'flex' | 'inline-flex' | 'grid' | 'inline-grid' | 'flow-root' | 'none' | 'contents' | 'table' | 'table-row' | 'table-cell' | 'table-column' | 'table-column-group' | 'table-header-group' | 'table-footer-group' | 'table-row-group' | 'list-item';
|
|
230
|
-
emptyCells: 'show' | 'hide';
|
|
231
|
-
filter: string;
|
|
232
|
-
flex: string;
|
|
233
|
-
flexBasis: string;
|
|
234
|
-
flexDirection: 'row' | 'row-reverse' | 'column' | 'column-reverse';
|
|
235
|
-
flexFlow: string;
|
|
236
|
-
flexGrow: number;
|
|
237
|
-
flexShrink: number;
|
|
238
|
-
flexWrap: 'nowrap' | 'wrap' | 'wrap-reverse';
|
|
239
|
-
float: 'left' | 'right' | 'none';
|
|
240
|
-
font: string;
|
|
241
|
-
fontFamily: string;
|
|
242
|
-
fontFeatureSettings: string;
|
|
243
|
-
fontKerning: 'auto' | 'normal' | 'none';
|
|
244
|
-
fontLanguageOverride: string;
|
|
245
|
-
fontOpticalSizing: 'auto' | 'none';
|
|
246
|
-
fontSize: string;
|
|
247
|
-
fontSizeAdjust: string;
|
|
248
|
-
fontStretch: 'normal' | 'ultra-condensed' | 'extra-condensed' | 'condensed' | 'semi-condensed' | 'semi-expanded' | 'expanded' | 'extra-expanded' | 'ultra-expanded';
|
|
249
|
-
fontStyle: 'normal' | 'italic' | 'oblique';
|
|
250
|
-
fontSynthesis: string;
|
|
251
|
-
fontVariant: 'normal' | 'small-caps';
|
|
252
|
-
fontVariantCaps: 'normal' | 'small-caps' | 'all-small-caps' | 'petite-caps' | 'all-petite-caps' | 'unicase' | 'titling-caps';
|
|
253
|
-
fontVariantEastAsian: string;
|
|
254
|
-
fontVariantLigatures: string;
|
|
255
|
-
fontVariantNumeric: string;
|
|
256
|
-
fontVariantPosition: 'normal' | 'sub' | 'super';
|
|
257
|
-
fontWeight: 'normal' | 'bold' | 'bolder' | 'lighter' | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;
|
|
258
|
-
gap: string;
|
|
259
|
-
grid: string;
|
|
260
|
-
gridArea: string;
|
|
261
|
-
gridAutoColumns: string;
|
|
262
|
-
gridAutoFlow: 'row' | 'column' | 'dense' | 'row dense' | 'column dense';
|
|
263
|
-
gridAutoRows: string;
|
|
264
|
-
gridColumn: string;
|
|
265
|
-
gridColumnEnd: string;
|
|
266
|
-
gridColumnGap: string;
|
|
267
|
-
gridColumnStart: string;
|
|
268
|
-
gridGap: string;
|
|
269
|
-
gridRow: string;
|
|
270
|
-
gridRowEnd: string;
|
|
271
|
-
gridRowGap: string;
|
|
272
|
-
gridRowStart: string;
|
|
273
|
-
gridTemplate: string;
|
|
274
|
-
gridTemplateAreas: string;
|
|
275
|
-
gridTemplateColumns: string;
|
|
276
|
-
gridTemplateRows: string;
|
|
277
|
-
height: string;
|
|
278
|
-
hyphens: 'none' | 'manual' | 'auto';
|
|
279
|
-
imageRendering: 'auto' | 'crisp-edges' | 'pixelated';
|
|
280
|
-
isolation: 'auto' | 'isolate';
|
|
281
|
-
justifyContent: 'flex-start' | 'flex-end' | 'center' | 'space-between' | 'space-around' | 'space-evenly';
|
|
282
|
-
justifyItems: 'normal' | 'stretch' | 'center' | 'start' | 'end' | 'flex-start' | 'flex-end' | 'self-start' | 'self-end' | 'left' | 'right';
|
|
283
|
-
justifySelf: 'auto' | 'normal' | 'stretch' | 'center' | 'start' | 'end' | 'flex-start' | 'flex-end' | 'self-start' | 'self-end' | 'left' | 'right';
|
|
284
|
-
left: string;
|
|
285
|
-
letterSpacing: 'normal';
|
|
286
|
-
lineHeight: 'normal' | number;
|
|
287
|
-
listStyle: string;
|
|
288
|
-
listStyleImage: string;
|
|
289
|
-
listStylePosition: 'inside' | 'outside';
|
|
290
|
-
listStyleType: 'disc' | 'circle' | 'square' | 'decimal' | 'georgian' | 'trad-chinese-informal' | 'none';
|
|
291
|
-
margin: string;
|
|
292
|
-
marginBottom: string;
|
|
293
|
-
marginLeft: string;
|
|
294
|
-
marginRight: string;
|
|
295
|
-
marginTop: string;
|
|
296
|
-
marginBlock: string;
|
|
297
|
-
marginBlockStart: string;
|
|
298
|
-
marginBlockEnd: string;
|
|
299
|
-
marginInline: string;
|
|
300
|
-
marginInlineStart: string;
|
|
301
|
-
marginInlineEnd: string;
|
|
302
|
-
mask: string;
|
|
303
|
-
maskClip: string;
|
|
304
|
-
maskComposite: string;
|
|
305
|
-
maskImage: string;
|
|
306
|
-
maskMode: string;
|
|
307
|
-
maskOrigin: string;
|
|
308
|
-
maskPosition: string;
|
|
309
|
-
maskRepeat: string;
|
|
310
|
-
maskSize: string;
|
|
311
|
-
maskType: string;
|
|
312
|
-
maxHeight: string;
|
|
313
|
-
maxWidth: string;
|
|
314
|
-
minHeight: string;
|
|
315
|
-
minWidth: string;
|
|
316
|
-
mixBlendMode: 'normal' | 'multiply' | 'screen' | 'overlay' | 'darken' | 'lighten' | 'color-dodge' | 'color-burn' | 'hard-light' | 'soft-light' | 'difference' | 'exclusion' | 'hue' | 'saturation' | 'color' | 'luminosity';
|
|
317
|
-
objectFit: 'fill' | 'contain' | 'cover' | 'none' | 'scale-down';
|
|
318
|
-
objectPosition: string;
|
|
319
|
-
opacity: number;
|
|
320
|
-
order: number;
|
|
321
|
-
outline: string;
|
|
322
|
-
outlineColor: string;
|
|
323
|
-
outlineOffset: string;
|
|
324
|
-
outlineStyle: 'none' | 'hidden' | 'dotted' | 'dashed' | 'solid' | 'double' | 'groove' | 'ridge' | 'inset' | 'outset';
|
|
325
|
-
outlineWidth: string;
|
|
326
|
-
overflow: 'visible' | 'hidden' | 'scroll' | 'auto';
|
|
327
|
-
overflowWrap: 'normal' | 'break-word' | 'anywhere';
|
|
328
|
-
overflowX: 'visible' | 'hidden' | 'scroll' | 'auto';
|
|
329
|
-
overflowY: 'visible' | 'hidden' | 'scroll' | 'auto';
|
|
330
|
-
overscrollBehavior: 'auto' | 'contain' | 'none';
|
|
331
|
-
overscrollBehaviorX: 'auto' | 'contain' | 'none';
|
|
332
|
-
overscrollBehaviorY: 'auto' | 'contain' | 'none';
|
|
333
|
-
padding: string;
|
|
334
|
-
paddingBottom: string;
|
|
335
|
-
paddingLeft: string;
|
|
336
|
-
paddingRight: string;
|
|
337
|
-
paddingTop: string;
|
|
338
|
-
paddingBlock: string;
|
|
339
|
-
paddingBlockStart: string;
|
|
340
|
-
paddingBlockEnd: string;
|
|
341
|
-
paddingInline: string;
|
|
342
|
-
paddingInlineStart: string;
|
|
343
|
-
paddingInlineEnd: string;
|
|
344
|
-
pageBreakAfter: 'auto' | 'always' | 'avoid' | 'left' | 'right';
|
|
345
|
-
pageBreakBefore: 'auto' | 'always' | 'avoid' | 'left' | 'right';
|
|
346
|
-
pageBreakInside: 'auto' | 'avoid';
|
|
347
|
-
paintOrder: string;
|
|
348
|
-
perspective: string;
|
|
349
|
-
perspectiveOrigin: string;
|
|
350
|
-
placeContent: string;
|
|
351
|
-
placeItems: string;
|
|
352
|
-
placeSelf: string;
|
|
353
|
-
pointerEvents: 'auto' | 'none';
|
|
354
|
-
position: 'static' | 'relative' | 'absolute' | 'fixed' | 'sticky';
|
|
355
|
-
quotes: string;
|
|
356
|
-
resize: 'none' | 'both' | 'horizontal' | 'vertical' | 'block' | 'inline';
|
|
357
|
-
right: string;
|
|
358
|
-
rotate: string;
|
|
359
|
-
rowGap: string;
|
|
360
|
-
scale: string;
|
|
361
|
-
scrollBehavior: 'auto' | 'smooth';
|
|
362
|
-
scrollMargin: string;
|
|
363
|
-
scrollMarginBottom: string;
|
|
364
|
-
scrollMarginLeft: string;
|
|
365
|
-
scrollMarginRight: string;
|
|
366
|
-
scrollMarginTop: string;
|
|
367
|
-
scrollMarginBlock: string;
|
|
368
|
-
scrollMarginBlockStart: string;
|
|
369
|
-
scrollMarginBlockEnd: string;
|
|
370
|
-
scrollMarginInline: string;
|
|
371
|
-
scrollMarginInlineStart: string;
|
|
372
|
-
scrollMarginInlineEnd: string;
|
|
373
|
-
shapeRendering: 'auto' | 'optimizeSpeed' | 'crispEdges' | 'geometricPrecision';
|
|
374
|
-
stopColor: string;
|
|
375
|
-
stopOpacity: string;
|
|
376
|
-
stroke: string;
|
|
377
|
-
strokeDasharray: string;
|
|
378
|
-
strokeDashoffset: string;
|
|
379
|
-
strokeLinecap: 'butt' | 'round' | 'square';
|
|
380
|
-
strokeLinejoin: 'miter' | 'round' | 'bevel';
|
|
381
|
-
strokeMiterlimit: string;
|
|
382
|
-
strokeOpacity: string;
|
|
383
|
-
strokeWidth: string;
|
|
384
|
-
tabSize: string;
|
|
385
|
-
tableLayout: 'auto' | 'fixed';
|
|
386
|
-
textAlign: 'left' | 'right' | 'center' | 'justify' | 'start' | 'end';
|
|
387
|
-
textAlignLast: 'auto' | 'left' | 'right' | 'center' | 'justify' | 'start' | 'end';
|
|
388
|
-
textAnchor: 'start' | 'middle' | 'end';
|
|
389
|
-
textCombineUpright: 'none' | 'all';
|
|
390
|
-
textDecoration: 'none' | 'underline' | 'overline' | 'line-through' | 'grammar-error' | 'spelling-error' | 'solid' | 'double' | 'dotted' | 'dashed' | 'wavy';
|
|
391
|
-
textDecorationColor: string;
|
|
392
|
-
textDecorationLine: 'none' | 'underline' | 'overline' | 'line-through' | 'grammar-error' | 'spelling-error';
|
|
393
|
-
textDecorationStyle: 'solid' | 'double' | 'dotted' | 'dashed' | 'wavy';
|
|
394
|
-
textDecorationThickness: string;
|
|
395
|
-
textDecorationSkipInk: 'auto' | 'none';
|
|
396
|
-
textEmphasis: string;
|
|
397
|
-
textIndent: string;
|
|
398
|
-
textJustify: 'auto' | 'inter-word' | 'inter-character' | 'none';
|
|
399
|
-
textOrientation: 'mixed' | 'upright' | 'sideways';
|
|
400
|
-
textOverflow: 'clip' | 'ellipsis';
|
|
401
|
-
textRendering: 'auto' | 'optimizeSpeed' | 'optimizeLegibility' | 'geometricPrecision';
|
|
402
|
-
textShadow: string;
|
|
403
|
-
textTransform: 'none' | 'capitalize' | 'uppercase' | 'lowercase';
|
|
404
|
-
textUnderlineOffset: string;
|
|
405
|
-
textUnderlinePosition: 'auto' | 'under' | 'left' | 'right';
|
|
406
|
-
top: string;
|
|
407
|
-
touchAction: 'auto' | 'none' | 'pan-x' | 'pan-y' | 'manipulation';
|
|
408
|
-
transform: string;
|
|
409
|
-
transformBox: 'border-box' | 'fill-box' | 'view-box';
|
|
410
|
-
transformOrigin: string;
|
|
411
|
-
transformStyle: 'flat' | 'preserve-3d';
|
|
412
|
-
transition: string;
|
|
413
|
-
transitionDelay: string;
|
|
414
|
-
transitionDuration: string;
|
|
415
|
-
transitionProperty: string;
|
|
416
|
-
transitionTimingFunction: 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear' | 'step-start' | 'step-end';
|
|
417
|
-
translate: string;
|
|
418
|
-
unicodeBidi: 'normal' | 'embed' | 'isolate' | 'bidi-override' | 'isolate-override' | 'plaintext';
|
|
419
|
-
userSelect: 'auto' | 'none' | 'text' | 'contain' | 'all';
|
|
420
|
-
verticalAlign: 'baseline' | 'sub' | 'super' | 'text-top' | 'text-bottom' | 'middle' | 'top' | 'bottom';
|
|
421
|
-
viewTimeline: string;
|
|
422
|
-
viewTimelineAxis: string;
|
|
423
|
-
viewTimelineInset: string;
|
|
424
|
-
viewTimelineName: string;
|
|
425
|
-
viewTransitionName: string;
|
|
426
|
-
viewTransitionClass: string;
|
|
427
|
-
visibility: 'visible' | 'hidden' | 'collapse';
|
|
428
|
-
whiteSpace: 'normal' | 'nowrap' | 'pre' | 'pre-wrap' | 'pre-line' | 'break-spaces';
|
|
429
|
-
width: string;
|
|
430
|
-
willChange: string;
|
|
431
|
-
wordBreak: 'normal' | 'break-all' | 'keep-all' | 'break-word';
|
|
432
|
-
wordSpacing: string;
|
|
433
|
-
wordWrap: 'normal' | 'break-word';
|
|
434
|
-
writingMode: 'horizontal-tb' | 'vertical-rl' | 'vertical-lr';
|
|
435
|
-
zIndex: 'auto' | number;
|
|
436
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { randomId } from "@amateras/utils";
|
|
2
|
-
|
|
3
|
-
const generatedIds = new Set<string>();
|
|
4
|
-
export const generateId = (lettercase: 'any' | 'lower' | 'upper' = 'any'): string => {
|
|
5
|
-
const id = randomId({lettercase: lettercase});
|
|
6
|
-
if (generatedIds.has(id)) return generateId(lettercase);
|
|
7
|
-
generatedIds.add(id);
|
|
8
|
-
return id;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const camelCaseToDash = (str: string) => str.replaceAll(/([A-Z])/g, ((_, $1: string) => `-${$1.toLowerCase()}`))
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { _Array_from, _instanceof } from "@amateras/utils";
|
|
2
|
-
import { $CSSRule } from "#structure/$CSSRule";
|
|
3
|
-
|
|
4
|
-
export class $CSSContainerRule extends $CSSRule {
|
|
5
|
-
condition: string;
|
|
6
|
-
name: string;
|
|
7
|
-
constructor(selector: string) {
|
|
8
|
-
super(selector);
|
|
9
|
-
const [_, name, condition] = selector.match(/@container (.+?) (.+)/) as [string, string, string]
|
|
10
|
-
this.name = name;
|
|
11
|
-
this.condition = condition;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export class $CSSDeclaration {
|
|
2
|
-
key: string;
|
|
3
|
-
value: string;
|
|
4
|
-
constructor(key: string, value: string) {
|
|
5
|
-
this.key = key;
|
|
6
|
-
this.value = value;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
get property() {
|
|
10
|
-
return this.key.replaceAll(/([A-Z])/g, (_, s1) => `-${s1}`).toLowerCase();
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
toString() {
|
|
14
|
-
return `${this.property}: ${this.value};`
|
|
15
|
-
}
|
|
16
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { $CSSRule } from "#structure/$CSSRule";
|
|
2
|
-
|
|
3
|
-
export class $CSSKeyframesRule extends $CSSRule {
|
|
4
|
-
name: string;
|
|
5
|
-
constructor(name: string) {
|
|
6
|
-
super(`@keyframes ${name}`);
|
|
7
|
-
this.name = name;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
toString(): string {
|
|
11
|
-
return this.name;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { _Array_from, _instanceof } from "@amateras/utils";
|
|
2
|
-
import { $CSSRule } from "#structure/$CSSRule";
|
|
3
|
-
|
|
4
|
-
export class $CSSMediaRule extends $CSSRule {
|
|
5
|
-
condition: string;
|
|
6
|
-
constructor(selector: string) {
|
|
7
|
-
super(selector);
|
|
8
|
-
this.condition = selector.replace('@media ', '');
|
|
9
|
-
}
|
|
10
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { _Object_assign } from "@amateras/utils";
|
|
2
|
-
|
|
3
|
-
export interface $CSSPropertyOptions {
|
|
4
|
-
name: string;
|
|
5
|
-
syntax: string;
|
|
6
|
-
initialValue: string;
|
|
7
|
-
inherits: boolean;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export interface $CSSProperty extends $CSSPropertyOptions {}
|
|
11
|
-
export class $CSSProperty {
|
|
12
|
-
constructor(options: $CSSPropertyOptions) {
|
|
13
|
-
_Object_assign(this, options);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
toString() {
|
|
17
|
-
return `var(${this.name})`
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { _Array_from, _instanceof, _Object_fromEntries } from "@amateras/utils";
|
|
2
|
-
|
|
3
|
-
export abstract class $CSSRule {
|
|
4
|
-
rules = new Set<$CSSRule>();
|
|
5
|
-
selector: string;
|
|
6
|
-
constructor(selector: string) {
|
|
7
|
-
this.selector = selector;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
get options(): {[key: string]: any} {
|
|
11
|
-
return _Object_fromEntries(_Array_from(this.rules).map(rule => [rule.selector, rule.options]))
|
|
12
|
-
}
|
|
13
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { $CSSDeclaration } from "#structure/$CSSDeclaration";
|
|
2
|
-
import { $CSSRule } from "#structure/$CSSRule";
|
|
3
|
-
import { _Array_from, _instanceof, _Object_fromEntries } from "@amateras/utils";
|
|
4
|
-
|
|
5
|
-
export class $CSSStyleRule extends $CSSRule {
|
|
6
|
-
declarations = new Map<string, $CSSDeclaration>();
|
|
7
|
-
constructor(selector: string) {
|
|
8
|
-
super(selector);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
get options(): {[key: string]: any} {
|
|
12
|
-
return {..._Object_fromEntries(_Array_from(this.declarations).map(([_, dec]) => [dec.key, dec])), ...super.options}
|
|
13
|
-
}
|
|
14
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { _document } from "@amateras/core/env";
|
|
2
|
-
|
|
3
|
-
const documentElementStyle = _document.documentElement.style;
|
|
4
|
-
|
|
5
|
-
export class $CSSVariable<V = string> {
|
|
6
|
-
name: string;
|
|
7
|
-
value: V;
|
|
8
|
-
constructor(key: string, value: V) {
|
|
9
|
-
this.name = key;
|
|
10
|
-
this.value = value;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
set(value: string) {
|
|
14
|
-
documentElementStyle.setProperty(`${this.name}`, value);
|
|
15
|
-
return this;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
reset() {
|
|
19
|
-
documentElementStyle.removeProperty(`${this.name}`);
|
|
20
|
-
return this;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
default(value: string | $CSSVariable) {
|
|
24
|
-
return `var(${this.name}, ${value})`
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
toString() {
|
|
28
|
-
return `var(${this.name})`
|
|
29
|
-
}
|
|
30
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@amateras/dom",
|
|
3
|
-
"peerDependencies": {
|
|
4
|
-
"@amateras/core": "workspace:*",
|
|
5
|
-
"@amateras/utils": "workspace:*"
|
|
6
|
-
},
|
|
7
|
-
"dependencies": {
|
|
8
|
-
"node-html-parser": "^7.0.1"
|
|
9
|
-
},
|
|
10
|
-
"imports": {
|
|
11
|
-
"#structure/*": "./src/structure/*.ts",
|
|
12
|
-
"#lib/*": "./src/lib/*.ts",
|
|
13
|
-
"#node/*": "./src/node/*.ts"
|
|
14
|
-
},
|
|
15
|
-
"exports": {
|
|
16
|
-
"./structure/*": "./src/structure/*.ts",
|
|
17
|
-
"./lib/*": "./src/lib/*.ts",
|
|
18
|
-
"./node/*": "./src/node/*.ts"
|
|
19
|
-
}
|
|
20
|
-
}
|