amateras 0.10.0 → 0.10.2

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 (174) hide show
  1. package/README.md +29 -25
  2. package/build/core.js +1 -0
  3. package/build/css.js +1 -0
  4. package/build/for.js +1 -0
  5. package/build/i18n.js +1 -0
  6. package/build/idb.js +1 -0
  7. package/build/if.js +1 -0
  8. package/build/import-map.js +1 -0
  9. package/build/markdown.js +1 -0
  10. package/build/match.js +1 -0
  11. package/build/meta.js +1 -0
  12. package/build/prefetch.js +1 -0
  13. package/build/router.js +1 -0
  14. package/build/signal.js +1 -0
  15. package/build/ui.js +1 -0
  16. package/build/widget.js +1 -0
  17. package/package.json +7 -5
  18. package/packages/core/package.json +19 -0
  19. package/packages/core/src/env.browser.ts +21 -0
  20. package/packages/core/src/env.node.ts +21 -0
  21. package/packages/core/src/global.ts +5 -0
  22. package/packages/core/src/index.ts +184 -0
  23. package/packages/core/src/lib/hmr.ts +145 -0
  24. package/packages/core/src/lib/symbols.ts +2 -0
  25. package/packages/core/src/structure/ElementProto.ts +95 -0
  26. package/packages/core/src/structure/GlobalState.ts +9 -0
  27. package/packages/core/src/structure/NodeProto.ts +18 -0
  28. package/packages/core/src/structure/Proto.ts +90 -0
  29. package/packages/core/src/structure/ProxyProto.ts +20 -0
  30. package/packages/core/src/structure/TextProto.ts +22 -0
  31. package/packages/core/src/structure/WidgetEvent.ts +17 -0
  32. package/packages/css/README.md +128 -0
  33. package/packages/css/package.json +15 -0
  34. package/packages/css/src/ext/colors/amber.ts +25 -0
  35. package/packages/css/src/ext/colors/blackwhite.ts +13 -0
  36. package/packages/css/src/ext/colors/blue.ts +25 -0
  37. package/packages/css/src/ext/colors/cyan.ts +25 -0
  38. package/packages/css/src/ext/colors/emerald.ts +25 -0
  39. package/packages/css/src/ext/colors/fuchsia.ts +25 -0
  40. package/packages/css/src/ext/colors/gray.ts +25 -0
  41. package/packages/css/src/ext/colors/green.ts +25 -0
  42. package/packages/css/src/ext/colors/indigo.ts +25 -0
  43. package/packages/css/src/ext/colors/lime.ts +25 -0
  44. package/packages/css/src/ext/colors/neutral.ts +25 -0
  45. package/packages/css/src/ext/colors/orange.ts +25 -0
  46. package/packages/css/src/ext/colors/pink.ts +25 -0
  47. package/packages/css/src/ext/colors/purple.ts +25 -0
  48. package/packages/css/src/ext/colors/red.ts +25 -0
  49. package/packages/css/src/ext/colors/rose.ts +25 -0
  50. package/packages/css/src/ext/colors/sky.ts +25 -0
  51. package/packages/css/src/ext/colors/slate.ts +25 -0
  52. package/packages/css/src/ext/colors/stone.ts +25 -0
  53. package/packages/css/src/ext/colors/teal.ts +25 -0
  54. package/packages/css/src/ext/colors/violet.ts +25 -0
  55. package/packages/css/src/ext/colors/yellow.ts +25 -0
  56. package/packages/css/src/ext/colors/zinc.ts +25 -0
  57. package/packages/css/src/ext/colors.ts +23 -0
  58. package/packages/css/src/ext/keyframes.ts +37 -0
  59. package/packages/css/src/ext/property.ts +68 -0
  60. package/packages/css/src/ext/variable.ts +51 -0
  61. package/packages/css/src/index.ts +103 -0
  62. package/packages/css/src/lib/cache.ts +27 -0
  63. package/packages/css/src/lib/colorAssign.ts +6 -0
  64. package/packages/css/src/lib/createRule.ts +31 -0
  65. package/packages/css/src/lib/utils.ts +1 -0
  66. package/packages/css/src/structure/$CSS.ts +4 -0
  67. package/packages/css/src/structure/$CSSKeyframes.ts +13 -0
  68. package/packages/css/src/structure/$CSSProperty.ts +21 -0
  69. package/packages/css/src/structure/$CSSRule.ts +39 -0
  70. package/packages/css/src/structure/$CSSVariable.ts +34 -0
  71. package/packages/css/src/types.ts +300 -0
  72. package/packages/for/package.json +15 -0
  73. package/packages/for/src/global.ts +7 -0
  74. package/packages/for/src/index.ts +15 -0
  75. package/packages/for/src/structure/For.ts +74 -0
  76. package/packages/hmr/package.json +13 -0
  77. package/packages/hmr/src/index.ts +27 -0
  78. package/packages/i18n/README.md +73 -0
  79. package/packages/i18n/package.json +15 -0
  80. package/packages/i18n/src/index.ts +78 -0
  81. package/packages/i18n/src/structure/I18n.ts +51 -0
  82. package/packages/i18n/src/structure/I18nDictionary.ts +31 -0
  83. package/packages/i18n/src/structure/I18nTranslation.ts +51 -0
  84. package/packages/i18n/src/types.ts +77 -0
  85. package/packages/idb/README.md +127 -0
  86. package/packages/idb/package.json +16 -0
  87. package/packages/idb/src/core.ts +6 -0
  88. package/packages/idb/src/index.ts +17 -0
  89. package/packages/idb/src/lib/$IDBRequest.ts +8 -0
  90. package/packages/idb/src/structure/$IDB.ts +63 -0
  91. package/packages/idb/src/structure/$IDBCursor.ts +34 -0
  92. package/packages/idb/src/structure/$IDBIndex.ts +48 -0
  93. package/packages/idb/src/structure/$IDBStore.ts +103 -0
  94. package/packages/idb/src/structure/$IDBStoreBase.ts +30 -0
  95. package/packages/idb/src/structure/$IDBTransaction.ts +38 -0
  96. package/packages/idb/src/structure/builder/$IDBBuilder.ts +229 -0
  97. package/packages/idb/src/structure/builder/$IDBStoreBuilder.ts +100 -0
  98. package/packages/if/package.json +15 -0
  99. package/packages/if/src/global.ts +15 -0
  100. package/packages/if/src/index.ts +51 -0
  101. package/packages/if/src/structure/Condition.ts +44 -0
  102. package/packages/if/src/structure/ConditionStatement.ts +25 -0
  103. package/packages/if/src/structure/Else.ts +6 -0
  104. package/packages/if/src/structure/ElseIf.ts +6 -0
  105. package/packages/if/src/structure/If.ts +6 -0
  106. package/packages/markdown/README.md +53 -0
  107. package/packages/markdown/package.json +15 -0
  108. package/packages/markdown/src/index.ts +3 -0
  109. package/packages/markdown/src/lib/type.ts +26 -0
  110. package/packages/markdown/src/lib/util.ts +21 -0
  111. package/packages/markdown/src/structure/Markdown.ts +57 -0
  112. package/packages/markdown/src/structure/MarkdownLexer.ts +111 -0
  113. package/packages/markdown/src/structure/MarkdownParser.ts +34 -0
  114. package/packages/markdown/src/syntax/alert.ts +46 -0
  115. package/packages/markdown/src/syntax/blockquote.ts +35 -0
  116. package/packages/markdown/src/syntax/bold.ts +11 -0
  117. package/packages/markdown/src/syntax/code.ts +11 -0
  118. package/packages/markdown/src/syntax/codeblock.ts +44 -0
  119. package/packages/markdown/src/syntax/heading.ts +14 -0
  120. package/packages/markdown/src/syntax/horizontalRule.ts +11 -0
  121. package/packages/markdown/src/syntax/image.ts +23 -0
  122. package/packages/markdown/src/syntax/italic.ts +11 -0
  123. package/packages/markdown/src/syntax/link.ts +46 -0
  124. package/packages/markdown/src/syntax/list.ts +121 -0
  125. package/packages/markdown/src/syntax/table.ts +67 -0
  126. package/packages/markdown/src/syntax/text.ts +19 -0
  127. package/packages/match/package.json +15 -0
  128. package/packages/match/src/global.ts +14 -0
  129. package/packages/match/src/index.ts +33 -0
  130. package/packages/match/src/structure/Case.ts +15 -0
  131. package/packages/match/src/structure/Default.ts +12 -0
  132. package/packages/match/src/structure/Match.ts +78 -0
  133. package/packages/meta/package.json +14 -0
  134. package/packages/meta/src/index.ts +36 -0
  135. package/packages/meta/src/lib/resolveMeta.ts +27 -0
  136. package/packages/meta/src/types.ts +36 -0
  137. package/packages/prefetch/package.json +14 -0
  138. package/packages/prefetch/src/index.ts +70 -0
  139. package/packages/router/README.md +18 -0
  140. package/packages/router/package.json +16 -0
  141. package/packages/router/src/global.ts +22 -0
  142. package/packages/router/src/index.ts +106 -0
  143. package/packages/router/src/structure/Link.ts +17 -0
  144. package/packages/router/src/structure/NavLink.ts +19 -0
  145. package/packages/router/src/structure/Page.ts +30 -0
  146. package/packages/router/src/structure/Route.ts +123 -0
  147. package/packages/router/src/structure/RouteGroup.ts +24 -0
  148. package/packages/router/src/structure/RouteNode.ts +54 -0
  149. package/packages/router/src/structure/RouteSlot.ts +34 -0
  150. package/packages/router/src/structure/Router.ts +192 -0
  151. package/packages/router/src/structure/RouterConstructor.ts +18 -0
  152. package/packages/router/src/types.ts +41 -0
  153. package/packages/signal/README.md +93 -0
  154. package/packages/signal/package.json +15 -0
  155. package/packages/signal/src/index.ts +97 -0
  156. package/packages/signal/src/lib/track.ts +18 -0
  157. package/packages/signal/src/structure/Signal.ts +59 -0
  158. package/packages/ui/package.json +14 -0
  159. package/packages/ui/src/index.ts +4 -0
  160. package/packages/ui/src/lib/slideshowAnimations.ts +39 -0
  161. package/packages/ui/src/structure/Radio.ts +77 -0
  162. package/packages/ui/src/structure/Slide.ts +11 -0
  163. package/packages/ui/src/structure/Slideshow.ts +99 -0
  164. package/packages/utils/package.json +18 -0
  165. package/packages/utils/src/global.ts +39 -0
  166. package/packages/utils/src/index.bun.ts +3 -0
  167. package/packages/utils/src/index.ts +2 -0
  168. package/packages/utils/src/lib/debugger.ts +14 -0
  169. package/packages/utils/src/lib/utils.ts +119 -0
  170. package/packages/utils/src/structure/UID.ts +18 -0
  171. package/packages/widget/README.md +29 -0
  172. package/packages/widget/package.json +14 -0
  173. package/packages/widget/src/index.ts +82 -0
  174. package/packages/widget/src/structure/Widget.ts +42 -0
@@ -0,0 +1,103 @@
1
+ import { cssGlobalRuleSet, cssRuleByProtoMap } from "#lib/cache";
2
+ import { createRule } from "#lib/createRule";
3
+ import { $CSSRule } from "#structure/$CSSRule";
4
+ import { ElementProto, type Proto, onserver } from "@amateras/core";
5
+ import { _Array_from, _instanceof, _Object_assign, _Object_entries, forEach, map, UID } from "@amateras/utils";
6
+ import type { $CSSDeclarationMap } from "./types";
7
+
8
+ declare global {
9
+ export namespace $ {
10
+ /** Create CSS rule */
11
+ export function css(cssObject: $.CSSMap | $CSSRule): $CSSRule;
12
+ /** Create global CSS rules */
13
+ export function CSS(cssRootObject: $.CSSRootMap): $CSSRule[];
14
+
15
+ export type CSSValue = '' | 'unset' | 'initial' | 'inherit' | string & {} | number | $.CSSValueExtends;
16
+ export type CSSValueExtends = ValueOf<CSSValueMap>;
17
+ export interface CSSValueMap {}
18
+
19
+ export interface AttrMap {
20
+ css: $.CSSMap
21
+ }
22
+
23
+ export type CSSMap = { [key: string]: $.CSSMap | $.CSSValue } | $.CSSDeclarationMap;
24
+ export type CSSDeclarationMap = { [key in keyof $CSSDeclarationMap]?: $CSSDeclarationMap[key] | $.CSSValue }
25
+ export type CSSRootMap = { [key: string]: $.CSSMap };
26
+
27
+ export namespace CSS {
28
+ export function text(proto: Proto): string;
29
+ export function rules(proto: Proto): $CSSRule[];
30
+ }
31
+ }
32
+ }
33
+
34
+ declare module "@amateras/core" {
35
+ export interface ElementProto {
36
+ css(...cssObject: ($.CSSMap | $CSSRule)[]): this;
37
+ }
38
+ }
39
+
40
+ // Assign methods to $ object
41
+ _Object_assign($, {
42
+
43
+ css(cssMap: $.CSSMap | $CSSRule) {
44
+ // If argument is $CSSRule, return it.
45
+ if (_instanceof(cssMap, $CSSRule)) return cssMap;
46
+ return createRule(() => `.${UID.generate('css')}`, cssMap);
47
+ },
48
+
49
+ CSS(cssRootMap: $.CSSRootMap) {
50
+ // The CSS root object properties value should be $CSSObject,
51
+ // just create rule from for each propperty.
52
+ return map(_Object_entries(cssRootMap), ([key, value]) => {
53
+ let rule = createRule(() => key, {...value, __selector__: key});
54
+ cssGlobalRuleSet.add(rule);
55
+ return rule;
56
+ })
57
+ },
58
+ })
59
+
60
+ _Object_assign(ElementProto.prototype, {
61
+ css(this: ElementProto, ...cssMap: ($.CSSMap | $CSSRule)[]) {
62
+ forEach(cssMap, cmap => assignCSS(this, cmap));
63
+ return this;
64
+ }
65
+ })
66
+
67
+ export const assignCSS = (proto: ElementProto, cssMap: $.CSSMap | $CSSRule) => {
68
+ let rule = $.css(cssMap);
69
+ let selector = rule.selector.slice(1);
70
+ proto.addClass(selector);
71
+ cssRuleByProtoMap.set(proto, rule);
72
+ }
73
+
74
+ // Assign html render methods to $.CSS
75
+ if (onserver()) {
76
+ _Object_assign($.CSS, {
77
+ rules(proto: Proto) {
78
+ let ruleSet = new Set<$CSSRule>();
79
+
80
+ forEach([proto, ...proto.protos], childProto => {
81
+ let rule = cssRuleByProtoMap.get(childProto as any);
82
+ if (rule) ruleSet.add(rule);
83
+ if (proto !== childProto)
84
+ forEach(this.rules(childProto), rule => ruleSet.add(rule));
85
+ })
86
+
87
+ return _Array_from(ruleSet);
88
+ },
89
+
90
+ text(proto: Proto) {
91
+ return [...cssGlobalRuleSet, ...this.rules(proto)].join('\n');
92
+ }
93
+ })
94
+ }
95
+
96
+ // Add processor of css attribute
97
+ $.process.attr.add((key, value, proto) => {
98
+ if (key === 'css') return assignCSS(proto, value), true;
99
+ })
100
+
101
+ export * from "#structure/$CSS";
102
+ export * from "#structure/$CSSRule";
103
+
@@ -0,0 +1,27 @@
1
+ import type { $CSSRule } from "#structure/$CSSRule";
2
+ import type { ElementProto } from "@amateras/core";
3
+
4
+ export const cssRuleByProtoMap = new WeakMap<ElementProto, $CSSRule>();
5
+ export const cssGlobalRuleSet = new Set<$CSSRule>();
6
+
7
+ /** A Map to store ${@link $CSSRule} by JSON string.
8
+ *
9
+ * Since a css rule might be created many times, in order to avoid unnecessary memory waste,
10
+ * we need a rule store to ensure that the same rules can be detected and retrieved.
11
+ *
12
+ * ### Why use JSON string as key of the Map?
13
+ *
14
+ * Theoretically, the structure of a CSS object can be losslessly converted to JSON format,
15
+ * which ensures that the same CSS object structure can be retrieves in the Map.
16
+ *
17
+ * A JavaScript Map can save keys converted into hash values, which makes its retrieves speed very fast.
18
+ * This is very suitable for storing CSS objects in JSON format, as the length of the JSON string will not
19
+ * affect the retrieve efficiency of the Map.
20
+ */
21
+ export const cssRuleByJSONMap: Map<string, $CSSRule> = import.meta.hot?.data.cssMap ?? new Map();
22
+
23
+ if (import.meta.hot) {
24
+ import.meta.hot.dispose(data => {
25
+ data.cssMap = cssRuleByJSONMap;
26
+ })
27
+ }
@@ -0,0 +1,6 @@
1
+ import { _Object_assign } from "@amateras/utils";
2
+
3
+ export const colorAssign = (key: string, colors: {[key: number]: string}) => {
4
+ if (!$.color) _Object_assign($, {color: {}});
5
+ _Object_assign($.color, {[key]: colors})
6
+ }
@@ -0,0 +1,31 @@
1
+ import { $CSSRule } from "#structure/$CSSRule";
2
+ import { _JSON_stringify, _null } from "@amateras/utils";
3
+ import { cssRuleByJSONMap } from "./cache";
4
+
5
+ /** Create and return {@link $CSSRule}, if the rule already exists then return the cached rule.
6
+ *
7
+ * This method will:
8
+ * 1. Check if the css rule is cached, if true return the cached rule.
9
+ * 2. Create a {@link $CSSRule}.
10
+ * 3. Insert the rule into stylesheet.
11
+ * 4. Cache the rule into {@link cssRuleByJSONMap}
12
+ * 5. Return the rule.
13
+ */
14
+ export const createRule = (selector: () => string, cssMap: $.CSSMap, cache = true) => {
15
+ // Convert $CSSObject to JSON,
16
+ // use JSON string as Map key of $CSSRule cache.
17
+ let cssObjectJSON = cache ? _JSON_stringify(cssMap) : '';
18
+ if (cache) {
19
+ let cachedRule = cssRuleByJSONMap.get(cssObjectJSON);
20
+ // If $CSSRule is cached, return it.
21
+ // This avoid the rule duplicated and waste memory.
22
+ if (cachedRule) return cachedRule;
23
+ }
24
+ // If the rule is not cached, create new one.
25
+ let rule = new $CSSRule(selector(), cssMap, _null);
26
+ // Insert rule into stylesheet.
27
+ $.style(_null, `${rule}`);
28
+ // Save the JSON and $CSSRule in cache.
29
+ if (cache) cssRuleByJSONMap.set(cssObjectJSON, rule);
30
+ return rule;
31
+ }
@@ -0,0 +1 @@
1
+ export const camelCaseToDash = (str: string) => str.replaceAll(/([A-Z])/g, ((_, $1: string) => `-${$1.toLowerCase()}`))
@@ -0,0 +1,4 @@
1
+ export abstract class $CSS {
2
+ abstract toString(): string;
3
+
4
+ }
@@ -0,0 +1,13 @@
1
+ import { $CSS } from "./$CSS";
2
+
3
+ export class $CSSKeyframes extends $CSS {
4
+ name: string;
5
+ constructor(name: string) {
6
+ super();
7
+ this.name = name;
8
+ }
9
+
10
+ toString(): string {
11
+ return `${this.name.replace('@keyframes ', '')}`
12
+ }
13
+ }
@@ -0,0 +1,21 @@
1
+ import { _Object_assign } from "@amateras/utils";
2
+ import { $CSS } from "./$CSS";
3
+
4
+ export interface $CSSPropertyOptions {
5
+ name: string;
6
+ syntax: string;
7
+ initialValue?: string;
8
+ inherits?: boolean;
9
+ }
10
+
11
+ export interface $CSSProperty extends $CSSPropertyOptions {}
12
+ export class $CSSProperty extends $CSS {
13
+ constructor(options: $CSSPropertyOptions) {
14
+ super();
15
+ _Object_assign(this, options);
16
+ }
17
+
18
+ toString() {
19
+ return `var(${this.name})`
20
+ }
21
+ }
@@ -0,0 +1,39 @@
1
+ import { _instanceof, _null, _Object_entries, isNumber, isString, map } from "@amateras/utils";
2
+ import { $CSS } from "./$CSS";
3
+
4
+ export class $CSSRule extends $CSS {
5
+ declarations = new Map<string, string>();
6
+ rules = new Map<string, $CSSRule>();
7
+ selector: string;
8
+ parent: $CSSRule | null = _null;
9
+
10
+ readonly css: $.CSSMap;
11
+ constructor(selector: string, cssMap: $.CSSMap, parent: $CSSRule | null) {
12
+ super();
13
+ this.selector = selector;
14
+ this.parent = parent;
15
+ if (cssMap) processCSSMap(this, cssMap);
16
+ this.css = cssMap;
17
+ }
18
+
19
+ toString(): string {
20
+ let declarations = map(this.declarations, ([name, value]) => `${name.replaceAll(/[A-Z]/g, $0 => `-${$0.toLowerCase()}`)}: ${value};`);
21
+ let rules = map(this.rules, ([_, rule]) => `${rule}`);
22
+ return `${this.selector} { ${[...declarations, ...rules].join(' ')} }`
23
+ }
24
+ }
25
+
26
+ const processCSSMap = (rule: $CSSRule, cssMap: $.CSSMap) => {
27
+ for (let [key, value] of _Object_entries(cssMap)) {
28
+ if (isString(value) || isNumber(value) || _instanceof(value, $CSS)) rule.declarations.set(key, `${value}`);
29
+ else {
30
+ // 兼容较旧浏览器不支持无 & 前缀的子规则
31
+ let selector =
32
+ rule.selector.startsWith('@') // 针对 at-rule, 一般 rule 无需判断直接添加 & 前缀给子规则
33
+ && !rule.parent // 如果是 root rule 就不会有 parent
34
+ ? key
35
+ : `${/^[@]|&/.test(key) ? key : `& ${key}`}`;
36
+ rule.rules.set(selector, new $CSSRule(selector, value as $.CSSMap, rule));
37
+ }
38
+ }
39
+ }
@@ -0,0 +1,34 @@
1
+ import { _document, onclient } from "@amateras/core";
2
+ import { $CSS } from "./$CSS";
3
+
4
+ export class $CSSVariable<V = string> extends $CSS {
5
+ name: string;
6
+ value: V;
7
+ constructor(key: string, value: V) {
8
+ super();
9
+ this.name = key;
10
+ this.value = value;
11
+ }
12
+
13
+ set(value: string) {
14
+ if (onclient()) _document.documentElement.style.setProperty(`${this.name}`, value);
15
+ return this;
16
+ }
17
+
18
+ reset() {
19
+ if (onclient()) _document.documentElement.style.removeProperty(`${this.name}`);
20
+ return this;
21
+ }
22
+
23
+ default(value: string | $CSSVariable) {
24
+ return `var(${this.name}, ${value})`
25
+ }
26
+
27
+ declare(value?: V | $CSSVariable) {
28
+ return {[this.name]: `${value ?? this.value}`}
29
+ }
30
+
31
+ toString(): string {
32
+ return `var(${this.name})`
33
+ }
34
+ }
@@ -0,0 +1,300 @@
1
+ export interface $CSSDeclarationMap {
2
+ alignContent: 'flex-start' | 'flex-end' | 'center' | 'space-between' | 'space-around' | 'space-evenly' | 'stretch' | 'normal';
3
+ alignItems: 'normal' | 'stretch' | 'center' | 'flex-start' | 'flex-end' | 'baseline';
4
+ alignSelf: 'auto' | 'normal' | 'stretch' | 'center' | 'flex-start' | 'flex-end' | 'baseline';
5
+ all: 'initial' | 'inherit' | 'unset';
6
+ animation: string;
7
+ animationDelay: string;
8
+ animationDirection: 'normal' | 'reverse' | 'alternate' | 'alternate-reverse';
9
+ animationDuration: string;
10
+ animationFillMode: 'none' | 'forwards' | 'backwards' | 'both';
11
+ animationIterationCount: 'infinite' | number;
12
+ animationName: string;
13
+ animationPlayState: 'running' | 'paused';
14
+ animationTimingFunction: 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear' | 'step-start' | 'step-end';
15
+ animationComposition: 'replace' | 'add' | 'accumulate';
16
+ aspectRatio: string;
17
+ appearance: 'none' | 'auto' | 'menulist-button' | 'textfield' | 'base-select' | 'button' | 'checkbox';
18
+ backdropFilter: string;
19
+ backfaceVisibility: 'visible' | 'hidden';
20
+ background: string;
21
+ backgroundAttachment: 'scroll' | 'fixed' | 'local';
22
+ backgroundBlendMode: 'normal' | 'multiply' | 'screen' | 'overlay' | 'darken' | 'lighten' | 'color-dodge' | 'color-burn' | 'hard-light' | 'soft-light' | 'difference' | 'exclusion' | 'hue' | 'saturation' | 'color' | 'luminosity';
23
+ backgroundClip: 'border-box' | 'padding-box' | 'content-box' | 'text';
24
+ backgroundColor: string;
25
+ backgroundImage: string;
26
+ backgroundOrigin: 'border-box' | 'padding-box' | 'content-box';
27
+ backgroundPosition: string;
28
+ backgroundRepeat: 'repeat' | 'repeat-x' | 'repeat-y' | 'no-repeat' | 'space' | 'round';
29
+ backgroundSize: 'auto' | 'cover' | 'contain';
30
+ border: string;
31
+ borderBottom: string;
32
+ borderBottomColor: string;
33
+ borderBottomLeftRadius: string;
34
+ borderBottomRightRadius: string;
35
+ borderBottomStyle: 'none' | 'hidden' | 'dotted' | 'dashed' | 'solid' | 'double' | 'groove' | 'ridge' | 'inset' | 'outset';
36
+ borderBottomWidth: string;
37
+ borderCollapse: 'collapse' | 'separate';
38
+ borderColor: string;
39
+ borderImage: string;
40
+ borderImageOutset: string;
41
+ borderImageRepeat: 'stretch' | 'repeat' | 'round' | 'space';
42
+ borderImageSlice: string;
43
+ borderImageSource: string;
44
+ borderImageWidth: string;
45
+ borderLeft: string;
46
+ borderLeftColor: string;
47
+ borderLeftStyle: 'none' | 'hidden' | 'dotted' | 'dashed' | 'solid' | 'double' | 'groove' | 'ridge' | 'inset' | 'outset';
48
+ borderLeftWidth: string;
49
+ borderRadius: string;
50
+ borderRight: string;
51
+ borderRightColor: string;
52
+ borderRightStyle: 'none' | 'hidden' | 'dotted' | 'dashed' | 'solid' | 'double' | 'groove' | 'ridge' | 'inset' | 'outset';
53
+ borderRightWidth: string;
54
+ borderSpacing: string;
55
+ borderStyle: 'none' | 'hidden' | 'dotted' | 'dashed' | 'solid' | 'double' | 'groove' | 'ridge' | 'inset' | 'outset';
56
+ borderTop: string;
57
+ borderTopColor: string;
58
+ borderTopLeftRadius: string;
59
+ borderTopRightRadius: string;
60
+ borderTopStyle: 'none' | 'hidden' | 'dotted' | 'dashed' | 'solid' | 'double' | 'groove' | 'ridge' | 'inset' | 'outset';
61
+ borderTopWidth: string;
62
+ borderWidth: string;
63
+ bottom: string;
64
+ boxShadow: string;
65
+ boxSizing: 'content-box' | 'border-box';
66
+ breakAfter: 'auto' | 'avoid' | 'always' | 'all' | 'avoid-page' | 'page' | 'left' | 'right' | 'recto' | 'verso' | 'column' | 'avoid-column';
67
+ breakBefore: 'auto' | 'avoid' | 'always' | 'all' | 'avoid-page' | 'page' | 'left' | 'right' | 'recto' | 'verso' | 'column' | 'avoid-column';
68
+ breakInside: 'auto' | 'avoid' | 'avoid-page' | 'avoid-column';
69
+ captionSide: 'top' | 'bottom';
70
+ caretColor: string;
71
+ clear: 'none' | 'left' | 'right' | 'both';
72
+ clip: string;
73
+ clipPath: string;
74
+ color: string;
75
+ columnCount: 'auto' | number;
76
+ columnFill: 'balance' | 'auto';
77
+ columnGap: string;
78
+ columnRule: string;
79
+ columnRuleColor: string;
80
+ columnRuleStyle: 'none' | 'hidden' | 'dotted' | 'dashed' | 'solid' | 'double' | 'groove' | 'ridge' | 'inset' | 'outset';
81
+ columnRuleWidth: string;
82
+ columnSpan: 'none' | 'all';
83
+ columnWidth: string;
84
+ columns: string;
85
+ content: string;
86
+ counterIncrement: string;
87
+ counterReset: string;
88
+ containerName: string;
89
+ containerType: 'inline-size' | 'size' | 'normal' | 'scroll-state';
90
+ 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';
91
+ direction: 'ltr' | 'rtl';
92
+ 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';
93
+ emptyCells: 'show' | 'hide';
94
+ filter: string;
95
+ flex: string;
96
+ flexBasis: string;
97
+ flexDirection: 'row' | 'row-reverse' | 'column' | 'column-reverse';
98
+ flexFlow: string;
99
+ flexGrow: number;
100
+ flexShrink: number;
101
+ flexWrap: 'nowrap' | 'wrap' | 'wrap-reverse';
102
+ float: 'left' | 'right' | 'none';
103
+ font: string;
104
+ fontFamily: string;
105
+ fontFeatureSettings: string;
106
+ fontKerning: 'auto' | 'normal' | 'none';
107
+ fontLanguageOverride: string;
108
+ fontOpticalSizing: 'auto' | 'none';
109
+ fontSize: string;
110
+ fontSizeAdjust: string;
111
+ fontStretch: 'normal' | 'ultra-condensed' | 'extra-condensed' | 'condensed' | 'semi-condensed' | 'semi-expanded' | 'expanded' | 'extra-expanded' | 'ultra-expanded';
112
+ fontStyle: 'normal' | 'italic' | 'oblique';
113
+ fontSynthesis: string;
114
+ fontVariant: 'normal' | 'small-caps';
115
+ fontVariantCaps: 'normal' | 'small-caps' | 'all-small-caps' | 'petite-caps' | 'all-petite-caps' | 'unicase' | 'titling-caps';
116
+ fontVariantEastAsian: string;
117
+ fontVariantLigatures: string;
118
+ fontVariantNumeric: string;
119
+ fontVariantPosition: 'normal' | 'sub' | 'super';
120
+ fontWeight: 'normal' | 'bold' | 'bolder' | 'lighter' | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;
121
+ gap: string;
122
+ grid: string;
123
+ gridArea: string;
124
+ gridAutoColumns: string;
125
+ gridAutoFlow: 'row' | 'column' | 'dense' | 'row dense' | 'column dense';
126
+ gridAutoRows: string;
127
+ gridColumn: string;
128
+ gridColumnEnd: string;
129
+ gridColumnGap: string;
130
+ gridColumnStart: string;
131
+ gridGap: string;
132
+ gridRow: string;
133
+ gridRowEnd: string;
134
+ gridRowGap: string;
135
+ gridRowStart: string;
136
+ gridTemplate: string;
137
+ gridTemplateAreas: string;
138
+ gridTemplateColumns: string;
139
+ gridTemplateRows: string;
140
+ height: string;
141
+ hyphens: 'none' | 'manual' | 'auto';
142
+ imageRendering: 'auto' | 'crisp-edges' | 'pixelated';
143
+ inset: number | string;
144
+ isolation: 'auto' | 'isolate';
145
+ justifyContent: 'flex-start' | 'flex-end' | 'center' | 'space-between' | 'space-around' | 'space-evenly';
146
+ justifyItems: 'normal' | 'stretch' | 'center' | 'start' | 'end' | 'flex-start' | 'flex-end' | 'self-start' | 'self-end' | 'left' | 'right';
147
+ justifySelf: 'auto' | 'normal' | 'stretch' | 'center' | 'start' | 'end' | 'flex-start' | 'flex-end' | 'self-start' | 'self-end' | 'left' | 'right';
148
+ left: string;
149
+ letterSpacing: 'normal';
150
+ lineHeight: 'normal' | number;
151
+ listStyle: string;
152
+ listStyleImage: string;
153
+ listStylePosition: 'inside' | 'outside';
154
+ listStyleType: 'disc' | 'circle' | 'square' | 'decimal' | 'georgian' | 'trad-chinese-informal' | 'none';
155
+ margin: string;
156
+ marginBottom: string;
157
+ marginLeft: string;
158
+ marginRight: string;
159
+ marginTop: string;
160
+ marginBlock: string;
161
+ marginBlockStart: string;
162
+ marginBlockEnd: string;
163
+ marginInline: string;
164
+ marginInlineStart: string;
165
+ marginInlineEnd: string;
166
+ mask: string;
167
+ maskClip: string;
168
+ maskComposite: string;
169
+ maskImage: string;
170
+ maskMode: string;
171
+ maskOrigin: string;
172
+ maskPosition: string;
173
+ maskRepeat: string;
174
+ maskSize: string;
175
+ maskType: string;
176
+ maxHeight: string;
177
+ maxWidth: string;
178
+ minHeight: string;
179
+ minWidth: string;
180
+ mixBlendMode: 'normal' | 'multiply' | 'screen' | 'overlay' | 'darken' | 'lighten' | 'color-dodge' | 'color-burn' | 'hard-light' | 'soft-light' | 'difference' | 'exclusion' | 'hue' | 'saturation' | 'color' | 'luminosity';
181
+ objectFit: 'fill' | 'contain' | 'cover' | 'none' | 'scale-down';
182
+ objectPosition: string;
183
+ opacity: number;
184
+ order: number;
185
+ outline: string;
186
+ outlineColor: string;
187
+ outlineOffset: string;
188
+ outlineStyle: 'none' | 'hidden' | 'dotted' | 'dashed' | 'solid' | 'double' | 'groove' | 'ridge' | 'inset' | 'outset';
189
+ outlineWidth: string;
190
+ overflow: 'visible' | 'hidden' | 'scroll' | 'auto';
191
+ overflowWrap: 'normal' | 'break-word' | 'anywhere';
192
+ overflowX: 'visible' | 'hidden' | 'scroll' | 'auto';
193
+ overflowY: 'visible' | 'hidden' | 'scroll' | 'auto';
194
+ overscrollBehavior: 'auto' | 'contain' | 'none';
195
+ overscrollBehaviorX: 'auto' | 'contain' | 'none';
196
+ overscrollBehaviorY: 'auto' | 'contain' | 'none';
197
+ padding: string;
198
+ paddingBottom: string;
199
+ paddingLeft: string;
200
+ paddingRight: string;
201
+ paddingTop: string;
202
+ paddingBlock: string;
203
+ paddingBlockStart: string;
204
+ paddingBlockEnd: string;
205
+ paddingInline: string;
206
+ paddingInlineStart: string;
207
+ paddingInlineEnd: string;
208
+ pageBreakAfter: 'auto' | 'always' | 'avoid' | 'left' | 'right';
209
+ pageBreakBefore: 'auto' | 'always' | 'avoid' | 'left' | 'right';
210
+ pageBreakInside: 'auto' | 'avoid';
211
+ paintOrder: string;
212
+ perspective: string;
213
+ perspectiveOrigin: string;
214
+ placeContent: string;
215
+ placeItems: string;
216
+ placeSelf: string;
217
+ pointerEvents: 'auto' | 'none';
218
+ position: 'static' | 'relative' | 'absolute' | 'fixed' | 'sticky';
219
+ quotes: string;
220
+ resize: 'none' | 'both' | 'horizontal' | 'vertical' | 'block' | 'inline';
221
+ right: string;
222
+ rotate: string;
223
+ rowGap: string;
224
+ scale: string;
225
+ scrollBehavior: 'auto' | 'smooth';
226
+ scrollMargin: string;
227
+ scrollMarginBottom: string;
228
+ scrollMarginLeft: string;
229
+ scrollMarginRight: string;
230
+ scrollMarginTop: string;
231
+ scrollMarginBlock: string;
232
+ scrollMarginBlockStart: string;
233
+ scrollMarginBlockEnd: string;
234
+ scrollMarginInline: string;
235
+ scrollMarginInlineStart: string;
236
+ scrollMarginInlineEnd: string;
237
+ shapeRendering: 'auto' | 'optimizeSpeed' | 'crispEdges' | 'geometricPrecision';
238
+ stopColor: string;
239
+ stopOpacity: string;
240
+ stroke: string;
241
+ strokeDasharray: string;
242
+ strokeDashoffset: string;
243
+ strokeLinecap: 'butt' | 'round' | 'square';
244
+ strokeLinejoin: 'miter' | 'round' | 'bevel';
245
+ strokeMiterlimit: string;
246
+ strokeOpacity: string;
247
+ strokeWidth: string;
248
+ tabSize: string;
249
+ tableLayout: 'auto' | 'fixed';
250
+ textAlign: 'left' | 'right' | 'center' | 'justify' | 'start' | 'end';
251
+ textAlignLast: 'auto' | 'left' | 'right' | 'center' | 'justify' | 'start' | 'end';
252
+ textAnchor: 'start' | 'middle' | 'end';
253
+ textCombineUpright: 'none' | 'all';
254
+ textDecoration: 'none' | 'underline' | 'overline' | 'line-through' | 'grammar-error' | 'spelling-error' | 'solid' | 'double' | 'dotted' | 'dashed' | 'wavy';
255
+ textDecorationColor: string;
256
+ textDecorationLine: 'none' | 'underline' | 'overline' | 'line-through' | 'grammar-error' | 'spelling-error';
257
+ textDecorationStyle: 'solid' | 'double' | 'dotted' | 'dashed' | 'wavy';
258
+ textDecorationThickness: string;
259
+ textDecorationSkipInk: 'auto' | 'none';
260
+ textEmphasis: string;
261
+ textIndent: string;
262
+ textJustify: 'auto' | 'inter-word' | 'inter-character' | 'none';
263
+ textOrientation: 'mixed' | 'upright' | 'sideways';
264
+ textOverflow: 'clip' | 'ellipsis';
265
+ textRendering: 'auto' | 'optimizeSpeed' | 'optimizeLegibility' | 'geometricPrecision';
266
+ textShadow: string;
267
+ textTransform: 'none' | 'capitalize' | 'uppercase' | 'lowercase';
268
+ textUnderlineOffset: string;
269
+ textUnderlinePosition: 'auto' | 'under' | 'left' | 'right';
270
+ top: string;
271
+ touchAction: 'auto' | 'none' | 'pan-x' | 'pan-y' | 'manipulation';
272
+ transform: string;
273
+ transformBox: 'border-box' | 'fill-box' | 'view-box';
274
+ transformOrigin: string;
275
+ transformStyle: 'flat' | 'preserve-3d';
276
+ transition: string;
277
+ transitionDelay: string;
278
+ transitionDuration: string;
279
+ transitionProperty: string;
280
+ transitionTimingFunction: 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear' | 'step-start' | 'step-end';
281
+ translate: string;
282
+ unicodeBidi: 'normal' | 'embed' | 'isolate' | 'bidi-override' | 'isolate-override' | 'plaintext';
283
+ userSelect: 'auto' | 'none' | 'text' | 'contain' | 'all';
284
+ verticalAlign: 'baseline' | 'sub' | 'super' | 'text-top' | 'text-bottom' | 'middle' | 'top' | 'bottom';
285
+ viewTimeline: string;
286
+ viewTimelineAxis: string;
287
+ viewTimelineInset: string;
288
+ viewTimelineName: string;
289
+ viewTransitionName: string;
290
+ viewTransitionClass: string;
291
+ visibility: 'visible' | 'hidden' | 'collapse';
292
+ whiteSpace: 'normal' | 'nowrap' | 'pre' | 'pre-wrap' | 'pre-line' | 'break-spaces';
293
+ width: string;
294
+ willChange: string;
295
+ wordBreak: 'normal' | 'break-all' | 'keep-all' | 'break-word';
296
+ wordSpacing: string;
297
+ wordWrap: 'normal' | 'break-word';
298
+ writingMode: 'horizontal-tb' | 'vertical-rl' | 'vertical-lr';
299
+ zIndex: 'auto' | number;
300
+ };
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "@amateras/for",
3
+ "peerDependencies": {
4
+ "@amateras/core": "workspace:*",
5
+ "@amateras/signal": "workspace:*",
6
+ "@amateras/utils": "workspace:*"
7
+ },
8
+ "imports": {
9
+ "#structure/*": "./src/structure/*.ts",
10
+ "#lib/*": "./src/lib/*.ts"
11
+ },
12
+ "exports": {
13
+ ".": "./src/index.ts"
14
+ }
15
+ }
@@ -0,0 +1,7 @@
1
+ import * as proto from "#structure/For";
2
+
3
+ declare global {
4
+ export var For: typeof proto.For
5
+
6
+ export function $<T extends object>(For: typeof proto.For, signal: proto.ForList<T>, layout: proto.ForLayout<T>): proto.For
7
+ }
@@ -0,0 +1,15 @@
1
+ import { For } from "#structure/For";
2
+ import { Proto } from '@amateras/core';
3
+ import './global';
4
+
5
+ globalThis.For = For;
6
+
7
+ $.process.craft.add((value, list, layout) => {
8
+ if (value === For) {
9
+ let forProto = new For(list, layout);
10
+ forProto.parent = Proto.proto;
11
+ return forProto;
12
+ }
13
+ })
14
+
15
+ export * from "#structure/For";