@triniwiz/nativescript-masonkit 1.0.0-beta.95 → 1.0.0-beta.97

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 (51) hide show
  1. package/DOCS.md +41 -23
  2. package/README.md +15 -0
  3. package/angular/fesm2022/triniwiz-nativescript-masonkit-angular.mjs +30 -1
  4. package/angular/fesm2022/triniwiz-nativescript-masonkit-angular.mjs.map +1 -1
  5. package/common.js +23 -131
  6. package/common.js.map +1 -1
  7. package/framework-registry.d.ts +50 -0
  8. package/framework-registry.js +176 -0
  9. package/framework-registry.js.map +1 -0
  10. package/index.android.d.ts +15 -0
  11. package/index.android.js +18 -0
  12. package/index.android.js.map +1 -1
  13. package/index.d.ts +18 -0
  14. package/index.ios.d.ts +1 -0
  15. package/index.ios.js +1 -0
  16. package/index.ios.js.map +1 -1
  17. package/index.windows.d.ts +1 -0
  18. package/index.windows.js +1 -0
  19. package/index.windows.js.map +1 -1
  20. package/package.json +1 -1
  21. package/platforms/android/masonkit-release.aar +0 -0
  22. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.abi.json +2688 -11414
  23. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.abi.json +2688 -11414
  24. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.abi.json +2688 -11414
  25. package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros.abi.json +2688 -11414
  26. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros-simulator.abi.json +2688 -11414
  27. package/references.d.ts +5 -0
  28. package/style.d.ts +1 -1
  29. package/text-runs.d.ts +23 -0
  30. package/text-runs.js +65 -0
  31. package/text-runs.js.map +1 -0
  32. package/typings/android.d.ts +7324 -0
  33. package/typings/objc!Mason.d.ts +3957 -0
  34. package/typings/objc!ObjectiveC.d.ts +1640 -0
  35. package/typings/windows.d.ts +330 -0
  36. package/vue/README.md +66 -0
  37. package/vue/index.d.ts +4 -0
  38. package/vue/index.d.ts.map +1 -0
  39. package/vue/index.js +3 -0
  40. package/vue/index.js.map +1 -0
  41. package/vue/package.json +39 -0
  42. package/vue/src/element-registry.d.ts +18 -0
  43. package/vue/src/element-registry.d.ts.map +1 -0
  44. package/vue/src/element-registry.js +56 -0
  45. package/vue/src/element-registry.js.map +1 -0
  46. package/vue/src/mason-meta.d.ts +7 -0
  47. package/vue/src/mason-meta.d.ts.map +1 -0
  48. package/vue/src/mason-meta.js +91 -0
  49. package/vue/src/mason-meta.js.map +1 -0
  50. package/web.js +11 -1
  51. package/web.js.map +1 -1
@@ -0,0 +1,5 @@
1
+ /// <reference path="../../references.d.ts" />
2
+ /// <reference path="./typings/android.d.ts" />
3
+ /// <reference path="./typings/objc!Mason.d.ts" />
4
+ /// <reference path="./typings/objc!ObjectiveC.d.ts" />
5
+ /// <reference path="./typings/windows.d.ts" />
package/style.d.ts CHANGED
@@ -489,7 +489,7 @@ export declare class Style {
489
489
  borderStyle: string;
490
490
  writingMode: "horizontal-tb" | "vertical-rl" | "vertical-lr";
491
491
  unicodeBidi: string;
492
- hyphens: "auto" | "none" | "manual";
492
+ hyphens: "none" | "auto" | "manual";
493
493
  caretColor: string;
494
494
  wordSpacing: string;
495
495
  fontStretch: string;
package/text-runs.d.ts ADDED
@@ -0,0 +1,23 @@
1
+ import type { MasonNodeKind } from './framework-registry';
2
+ export interface TextRunReconcileContext {
3
+ _children: any[];
4
+ _nativeRemoveChildNode(node: any, index: number): void;
5
+ _updateTextNode(node: any, operation: {
6
+ type: 'add' | 'replace' | 'insert';
7
+ index?: number;
8
+ isBreak?: boolean;
9
+ } | null): void;
10
+ }
11
+ /**
12
+ * Reconcile the native text runs in `context._children` with the host
13
+ * framework's child nodes.
14
+ *
15
+ * `_children` holds one slot per box: elements and non-empty text runs. The
16
+ * framework's node list also carries nodes that generate no box on the web,
17
+ * and every framework has them - comment anchors for conditional/list
18
+ * rendering and empty text nodes. Neither gets a native run, so run indices
19
+ * come from counting slots, never from a node's position in the framework
20
+ * list. `classify` maps each framework node to its kind: `text` (a run),
21
+ * `break` (a `<br>` run), `element` (a slot with no run) or `none` (no slot).
22
+ */
23
+ export declare function reconcileTextRuns(context: TextRunReconcileContext, nodes: any[], classify: (node: any) => MasonNodeKind): void;
package/text-runs.js ADDED
@@ -0,0 +1,65 @@
1
+ import { textNode_ } from './symbols';
2
+ /**
3
+ * Reconcile the native text runs in `context._children` with the host
4
+ * framework's child nodes.
5
+ *
6
+ * `_children` holds one slot per box: elements and non-empty text runs. The
7
+ * framework's node list also carries nodes that generate no box on the web,
8
+ * and every framework has them - comment anchors for conditional/list
9
+ * rendering and empty text nodes. Neither gets a native run, so run indices
10
+ * come from counting slots, never from a node's position in the framework
11
+ * list. `classify` maps each framework node to its kind: `text` (a run),
12
+ * `break` (a `<br>` run), `element` (a slot with no run) or `none` (no slot).
13
+ */
14
+ export function reconcileTextRuns(context, nodes, classify) {
15
+ const textOf = (n) => n.text ?? n.data ?? '';
16
+ // A `<br>` that the host already inserted as a `Br` placeholder element
17
+ // (Vue/Angular metas do) is a slot of its own; only synthesise a break run
18
+ // for a framework node MasonKit has no child for.
19
+ const kinds = nodes.map((n) => {
20
+ const kind = classify(n);
21
+ return kind === 'break' && context._children.indexOf(n) > -1 ? 'element' : kind;
22
+ });
23
+ const live = new Set();
24
+ for (let i = 0; i < nodes.length; i++) {
25
+ if (kinds[i] === 'break' || (kinds[i] === 'text' && textOf(nodes[i]) !== '')) {
26
+ live.add(nodes[i]);
27
+ }
28
+ }
29
+ // Drop native runs whose framework node is gone or has become empty.
30
+ for (let i = context._children.length - 1; i >= 0; i--) {
31
+ const child = context._children[i];
32
+ const raw = child?.[textNode_]?.['__raw__'];
33
+ if (raw && !live.has(raw)) {
34
+ context._nativeRemoveChildNode(child[textNode_], i);
35
+ context._children.splice(i, 1);
36
+ }
37
+ }
38
+ let slot = 0;
39
+ for (let i = 0; i < nodes.length; i++) {
40
+ const node = nodes[i];
41
+ const kind = kinds[i];
42
+ if (kind === 'none' || (kind === 'text' && textOf(node) === '')) {
43
+ continue;
44
+ }
45
+ if (kind === 'element') {
46
+ slot++;
47
+ continue;
48
+ }
49
+ const existingIndex = context._children.findIndex((child) => child?.[textNode_]?.['__raw__'] === node);
50
+ if (existingIndex === slot) {
51
+ // Same node in the same slot: update the run's text in place.
52
+ context._updateTextNode(node, null);
53
+ }
54
+ else {
55
+ if (existingIndex > -1) {
56
+ const existing = context._children[existingIndex];
57
+ context._nativeRemoveChildNode(existing[textNode_], existingIndex);
58
+ context._children.splice(existingIndex, 1);
59
+ }
60
+ context._updateTextNode(node, { type: 'insert', index: slot, isBreak: kind === 'break' });
61
+ }
62
+ slot++;
63
+ }
64
+ }
65
+ //# sourceMappingURL=text-runs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text-runs.js","sourceRoot":"","sources":["../../../packages/nativescript-masonkit/text-runs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAgBtC;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAgC,EAAE,KAAY,EAAE,QAAsC;IACtH,MAAM,MAAM,GAAG,CAAC,CAAM,EAAU,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC;IAC1D,wEAAwE;IACxE,2EAA2E;IAC3E,kDAAkD;IAClD,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QAC5B,MAAM,IAAI,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;QACzB,OAAO,IAAI,KAAK,OAAO,IAAI,OAAO,CAAC,SAAS,CAAC,O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