@viewfly/platform-browser 2.2.1 → 3.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  export * from './create-app';
2
- export * from './create-portal';
3
2
  export * from './html-renderer';
4
3
  export * from './dom-renderer';
5
4
  export * from './html-idl-reflection';
package/dist/index.esm.js CHANGED
@@ -560,44 +560,6 @@ function createApp(root, config = true) {
560
560
  });
561
561
  }
562
562
  //#endregion
563
- //#region src/create-portal.ts
564
- /**
565
- * 用于创建脱离当前 DOM 树的子节点,常用于弹窗等
566
- * @deprecated 即将弃用,请使用 @viewfly/core 模块的 Portal 组件实现
567
- * @param childRender
568
- * @param host
569
- * @example
570
- * ```tsx
571
- * function App() {
572
- * const number = createSignal(0)
573
- *
574
- * setInterval(() => {
575
- * number.set(number() + 1)
576
- * }, 1000)
577
- *
578
- * const ModalPortal = function (props) {
579
- * return createPortal(() => {
580
- * return <div class="modal">parent data is {props.text}</div>
581
- * }, document.body)
582
- * }
583
- * return () => {
584
- * return (
585
- * <div>
586
- * <div>data is {number()}</div>
587
- * <ModalPortal text={number()}/>
588
- * </div>
589
- * )
590
- * }
591
- * }
592
- * ```
593
- */
594
- function createPortal(childRender, host) {
595
- return {
596
- $portalHost: host,
597
- $render: childRender
598
- };
599
- }
600
- //#endregion
601
563
  //#region src/html-renderer.ts
602
564
  /** JSX style 对象键 → CSS 属性名(含 webkit / moz / ms / o 前缀) */
603
565
  function styleKeyToCssPropertyName(key) {
@@ -782,4 +744,4 @@ var OutputTranslator = class OutputTranslator {
782
744
  }
783
745
  };
784
746
  //#endregion
785
- export { DomRenderer, HTMLRenderer, IDL_FALSY_OR_NONFINITE_REMOVES, IDL_TO_CONTENT_ATTR, OutputTranslator, VDOMElement, VDOMNode, VDOMText, XML_JSX_NAME_TO_ATTR, createApp, createPortal, getContentAttrNameForIdl, getXmlPresentationAttributeName, isUnsetLikeReflectedIdlValue };
747
+ export { DomRenderer, HTMLRenderer, IDL_FALSY_OR_NONFINITE_REMOVES, IDL_TO_CONTENT_ATTR, OutputTranslator, VDOMElement, VDOMNode, VDOMText, XML_JSX_NAME_TO_ATTR, createApp, getContentAttrNameForIdl, getXmlPresentationAttributeName, isUnsetLikeReflectedIdlValue };
package/dist/index.js CHANGED
@@ -561,44 +561,6 @@ function createApp(root, config = true) {
561
561
  });
562
562
  }
563
563
  //#endregion
564
- //#region src/create-portal.ts
565
- /**
566
- * 用于创建脱离当前 DOM 树的子节点,常用于弹窗等
567
- * @deprecated 即将弃用,请使用 @viewfly/core 模块的 Portal 组件实现
568
- * @param childRender
569
- * @param host
570
- * @example
571
- * ```tsx
572
- * function App() {
573
- * const number = createSignal(0)
574
- *
575
- * setInterval(() => {
576
- * number.set(number() + 1)
577
- * }, 1000)
578
- *
579
- * const ModalPortal = function (props) {
580
- * return createPortal(() => {
581
- * return <div class="modal">parent data is {props.text}</div>
582
- * }, document.body)
583
- * }
584
- * return () => {
585
- * return (
586
- * <div>
587
- * <div>data is {number()}</div>
588
- * <ModalPortal text={number()}/>
589
- * </div>
590
- * )
591
- * }
592
- * }
593
- * ```
594
- */
595
- function createPortal(childRender, host) {
596
- return {
597
- $portalHost: host,
598
- $render: childRender
599
- };
600
- }
601
- //#endregion
602
564
  //#region src/html-renderer.ts
603
565
  /** JSX style 对象键 → CSS 属性名(含 webkit / moz / ms / o 前缀) */
604
566
  function styleKeyToCssPropertyName(key) {
@@ -793,7 +755,6 @@ exports.VDOMNode = VDOMNode;
793
755
  exports.VDOMText = VDOMText;
794
756
  exports.XML_JSX_NAME_TO_ATTR = XML_JSX_NAME_TO_ATTR;
795
757
  exports.createApp = createApp;
796
- exports.createPortal = createPortal;
797
758
  exports.getContentAttrNameForIdl = getContentAttrNameForIdl;
798
759
  exports.getXmlPresentationAttributeName = getXmlPresentationAttributeName;
799
760
  exports.isUnsetLikeReflectedIdlValue = isUnsetLikeReflectedIdlValue;
package/dist/jsx-dom.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { JSX, ClassNames, JSXNode } from '@viewfly/core';
1
+ import { JSX, ClassNames, JSXNode, DynamicRef, Ref, RefProp } from '@viewfly/core';
2
2
  import * as CSS from 'csstype';
3
3
  export interface CSSProperties extends CSS.Properties<string | number>, CSS.PropertiesHyphen<string | number> {
4
4
  /**
@@ -200,7 +200,8 @@ interface AriaAttributes {
200
200
  'aria-valuetext'?: string;
201
201
  }
202
202
  export type StyleValue = string | CSSProperties | null;
203
- export interface HTMLAttributes<T> extends AriaAttributes, EventHandlers<Events>, JSX.RefAttributes<T> {
203
+ export interface HTMLAttributes<T> extends AriaAttributes, EventHandlers<Events>, Omit<JSX.IntrinsicAttributes, 'ref'> {
204
+ ref?: RefProp<T> | RefProp<T>[];
204
205
  children?: JSXNode;
205
206
  innerHTML?: string;
206
207
  /** 支持 ClassNames / 对象解析,走 `setClass`(不经 `setProperty`)。 */
@@ -624,7 +625,8 @@ export interface WebViewHTMLAttributes<T> extends HTMLAttributes<T> {
624
625
  useragent?: string;
625
626
  webpreferences?: string;
626
627
  }
627
- export interface SVGAttributes<T> extends AriaAttributes, EventHandlers<Events>, JSX.RefAttributes<T> {
628
+ export interface SVGAttributes<T> extends AriaAttributes, EventHandlers<Events> {
629
+ ref?: Ref<T | null> | DynamicRef<T | null> | Array<Ref<T | null> | DynamicRef<T | null>>;
628
630
  children?: JSXNode;
629
631
  innerHTML?: string;
630
632
  /**
@@ -1091,7 +1093,8 @@ export interface SVGElements {
1091
1093
  use: SVGAttributes<SVGUseElement>;
1092
1094
  view: SVGAttributes<SVGViewElement>;
1093
1095
  }
1094
- export interface MathMLAttributes extends JSX.RefAttributes<MathMLElement> {
1096
+ export interface MathMLAttributes<T> {
1097
+ ref?: Ref<T | null> | DynamicRef<T | null> | Array<Ref<T | null> | DynamicRef<T | null>>;
1095
1098
  children?: JSXNode;
1096
1099
  scriptlevel?: string;
1097
1100
  /** 同 HTML/SVG:`class` 走 setClass + ClassNames;`className` 仅字符串、不经 classToString。 */
@@ -1103,7 +1106,7 @@ export interface MathMLAttributes extends JSX.RefAttributes<MathMLElement> {
1103
1106
  tabindex?: Numberish;
1104
1107
  tabIndex?: Numberish;
1105
1108
  }
1106
- export interface MathMLMoAttributes extends MathMLAttributes {
1109
+ export interface MathMLMoAttributes<T> extends MathMLAttributes<T> {
1107
1110
  accent?: Booleanish;
1108
1111
  fence?: Booleanish;
1109
1112
  lspace?: string;
@@ -1115,28 +1118,28 @@ export interface MathMLMoAttributes extends MathMLAttributes {
1115
1118
  stretchy?: Booleanish;
1116
1119
  symmetric?: Booleanish;
1117
1120
  }
1118
- export interface MathMLMathAttributes extends MathMLAttributes {
1121
+ export interface MathMLMathAttributes<T> extends MathMLAttributes<T> {
1119
1122
  xmlns?: 'http://www.w3.org/1998/Math/MathML';
1120
1123
  display?: 'block' | 'inline';
1121
1124
  }
1122
- export interface MathMLMfracAttributes extends MathMLAttributes {
1125
+ export interface MathMLMfracAttributes<T> extends MathMLAttributes<T> {
1123
1126
  linethickness?: string;
1124
1127
  }
1125
- export interface MathMLMoverAttributes extends MathMLAttributes {
1128
+ export interface MathMLMoverAttributes<T> extends MathMLAttributes<T> {
1126
1129
  accent?: Booleanish;
1127
1130
  }
1128
- export interface MathMLMpaddedAttributes extends MathMLAttributes {
1131
+ export interface MathMLMpaddedAttributes<T> extends MathMLAttributes<T> {
1129
1132
  depth?: string;
1130
1133
  height?: string;
1131
1134
  lspace?: string;
1132
1135
  voffset?: string;
1133
1136
  width?: string;
1134
1137
  }
1135
- export interface MathMLMspaceAttributes extends MathMLAttributes {
1138
+ export interface MathMLMspaceAttributes<T> extends MathMLAttributes<T> {
1136
1139
  width?: string;
1137
1140
  height?: string;
1138
1141
  }
1139
- export interface MathMLMtableAttribute extends MathMLAttributes {
1142
+ export interface MathMLMtableAttribute<T> extends MathMLAttributes<T> {
1140
1143
  align?: string;
1141
1144
  columnalign?: string;
1142
1145
  columnlines?: Numberish;
@@ -1148,54 +1151,54 @@ export interface MathMLMtableAttribute extends MathMLAttributes {
1148
1151
  rowspacing?: Numberish;
1149
1152
  width?: string;
1150
1153
  }
1151
- export interface MathMLMtdAttributes extends MathMLAttributes {
1154
+ export interface MathMLMtdAttributes<T> extends MathMLAttributes<T> {
1152
1155
  columnalign?: string;
1153
1156
  columnspan?: Numberish;
1154
1157
  rowalign?: string;
1155
1158
  rowspan?: Numberish;
1156
1159
  }
1157
- export interface MathMLMtrAttributes extends MathMLAttributes {
1160
+ export interface MathMLMtrAttributes<T> extends MathMLAttributes<T> {
1158
1161
  columnalign?: string;
1159
1162
  rowalign?: string;
1160
1163
  }
1161
- export interface MathMLMunderAttributes extends MathMLAttributes {
1164
+ export interface MathMLMunderAttributes<T> extends MathMLAttributes<T> {
1162
1165
  accentunder?: Booleanish;
1163
1166
  }
1164
- export interface MathMLMunderoverAttributes extends MathMLAttributes {
1167
+ export interface MathMLMunderoverAttributes<T> extends MathMLAttributes<T> {
1165
1168
  accent?: Booleanish;
1166
1169
  accentunder?: Booleanish;
1167
1170
  }
1168
1171
  export interface MathMLElements {
1169
- annotation: MathMLAttributes;
1170
- 'annotation-xml': MathMLAttributes;
1171
- maction: MathMLAttributes;
1172
- math: MathMLMathAttributes;
1173
- merror: MathMLAttributes;
1174
- mfrac: MathMLMfracAttributes;
1175
- mi: MathMLAttributes;
1176
- mmultiscripts: MathMLAttributes;
1177
- mn: MathMLAttributes;
1178
- mo: MathMLMoAttributes;
1179
- mover: MathMLMoverAttributes;
1180
- mpadded: MathMLMpaddedAttributes;
1181
- mphantom: MathMLAttributes;
1182
- mprescripts: MathMLAttributes;
1183
- mroot: MathMLAttributes;
1184
- mrow: MathMLAttributes;
1185
- ms: MathMLAttributes;
1186
- mspace: MathMLMspaceAttributes;
1187
- msqrt: MathMLAttributes;
1188
- mstyle: MathMLAttributes;
1189
- msub: MathMLAttributes;
1190
- msubsup: MathMLAttributes;
1191
- msup: MathMLAttributes;
1192
- mtable: MathMLMtableAttribute;
1193
- mtd: MathMLMtdAttributes;
1194
- mtext: MathMLAttributes;
1195
- mtr: MathMLMtrAttributes;
1196
- munder: MathMLMunderAttributes;
1197
- semantics: MathMLAttributes;
1198
- munderover: MathMLMunderoverAttributes;
1172
+ annotation: MathMLAttributes<MathMLElement>;
1173
+ 'annotation-xml': MathMLAttributes<MathMLElement>;
1174
+ maction: MathMLAttributes<MathMLElement>;
1175
+ math: MathMLMathAttributes<MathMLElement>;
1176
+ merror: MathMLAttributes<MathMLElement>;
1177
+ mfrac: MathMLMfracAttributes<MathMLElement>;
1178
+ mi: MathMLAttributes<MathMLElement>;
1179
+ mmultiscripts: MathMLAttributes<MathMLElement>;
1180
+ mn: MathMLAttributes<MathMLElement>;
1181
+ mo: MathMLMoAttributes<MathMLElement>;
1182
+ mover: MathMLMoverAttributes<MathMLElement>;
1183
+ mpadded: MathMLMpaddedAttributes<MathMLElement>;
1184
+ mphantom: MathMLAttributes<MathMLElement>;
1185
+ mprescripts: MathMLAttributes<MathMLElement>;
1186
+ mroot: MathMLAttributes<MathMLElement>;
1187
+ mrow: MathMLAttributes<MathMLElement>;
1188
+ ms: MathMLAttributes<MathMLElement>;
1189
+ mspace: MathMLMspaceAttributes<MathMLElement>;
1190
+ msqrt: MathMLAttributes<MathMLElement>;
1191
+ mstyle: MathMLAttributes<MathMLElement>;
1192
+ msub: MathMLAttributes<MathMLElement>;
1193
+ msubsup: MathMLAttributes<MathMLElement>;
1194
+ msup: MathMLAttributes<MathMLElement>;
1195
+ mtable: MathMLMtableAttribute<MathMLElement>;
1196
+ mtd: MathMLMtdAttributes<MathMLElement>;
1197
+ mtext: MathMLAttributes<MathMLElement>;
1198
+ mtr: MathMLMtrAttributes<MathMLElement>;
1199
+ munder: MathMLMunderAttributes<MathMLElement>;
1200
+ semantics: MathMLAttributes<MathMLElement>;
1201
+ munderover: MathMLMunderoverAttributes<MathMLElement>;
1199
1202
  }
1200
1203
  export interface NativeElements extends DOMElements, SVGElements, MathMLElements {
1201
1204
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viewfly/platform-browser",
3
- "version": "2.2.1",
3
+ "version": "3.0.0-alpha.1",
4
4
  "description": "This project is used to enable the Viewfly framework to run in a browser.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.esm.js",
@@ -12,18 +12,13 @@
12
12
  "require": "./dist/index.js"
13
13
  }
14
14
  },
15
- "scripts": {
16
- "build:lib": "rimraf dist && pnpm run build && rimraf dist/platform-browser",
17
- "build": "vite build --config vite.config.ts",
18
- "publish:lib": "npm run build:lib && npm publish --access=public"
19
- },
20
15
  "files": [
21
16
  "dist/**/*"
22
17
  ],
23
18
  "license": "MIT",
24
19
  "keywords": [],
25
20
  "dependencies": {
26
- "@viewfly/core": "^2.2.0",
21
+ "@viewfly/core": "^3.0.0-alpha.1",
27
22
  "csstype": "^3.1.3"
28
23
  },
29
24
  "devDependencies": {
@@ -43,5 +38,10 @@
43
38
  },
44
39
  "bugs": {
45
40
  "url": "https://github.com/viewfly/viewfly/issues"
41
+ },
42
+ "scripts": {
43
+ "build:lib": "rimraf dist && pnpm run build && rimraf dist/platform-browser",
44
+ "build": "vite build --config vite.config.ts",
45
+ "publish:lib": "npm run build:lib && npm publish --access=public"
46
46
  }
47
- }
47
+ }
@@ -1,35 +0,0 @@
1
- import { JSXNode, NativeNode } from '@viewfly/core';
2
- /**
3
- * 用于创建脱离当前 DOM 树的子节点,常用于弹窗等
4
- * @deprecated 即将弃用,请使用 @viewfly/core 模块的 Portal 组件实现
5
- * @param childRender
6
- * @param host
7
- * @example
8
- * ```tsx
9
- * function App() {
10
- * const number = createSignal(0)
11
- *
12
- * setInterval(() => {
13
- * number.set(number() + 1)
14
- * }, 1000)
15
- *
16
- * const ModalPortal = function (props) {
17
- * return createPortal(() => {
18
- * return <div class="modal">parent data is {props.text}</div>
19
- * }, document.body)
20
- * }
21
- * return () => {
22
- * return (
23
- * <div>
24
- * <div>data is {number()}</div>
25
- * <ModalPortal text={number()}/>
26
- * </div>
27
- * )
28
- * }
29
- * }
30
- * ```
31
- */
32
- export declare function createPortal<T extends NativeNode>(childRender: () => JSXNode, host: T): {
33
- $portalHost: T;
34
- $render: () => JSXNode;
35
- };