tetrons 2.3.73 → 2.3.74

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.mts CHANGED
@@ -8,6 +8,5 @@ declare function EditorContent({ apiKey }: EditorContentProps): React.JSX.Elemen
8
8
  declare function initializeTetrons(apiKey: string): Promise<void>;
9
9
  declare function getTetronsVersion(): "" | "free" | "pro" | "premium" | "platinum";
10
10
  declare function isApiKeyValid(): boolean;
11
- declare function getTetronsRemainingDays(): Promise<number | null>;
12
11
 
13
- export { EditorContent, EditorContent as default, getTetronsRemainingDays, getTetronsVersion, initializeTetrons, isApiKeyValid };
12
+ export { EditorContent, EditorContent as default, getTetronsVersion, initializeTetrons, isApiKeyValid };
package/dist/index.d.ts CHANGED
@@ -8,6 +8,5 @@ declare function EditorContent({ apiKey }: EditorContentProps): React.JSX.Elemen
8
8
  declare function initializeTetrons(apiKey: string): Promise<void>;
9
9
  declare function getTetronsVersion(): "" | "free" | "pro" | "premium" | "platinum";
10
10
  declare function isApiKeyValid(): boolean;
11
- declare function getTetronsRemainingDays(): Promise<number | null>;
12
11
 
13
- export { EditorContent, EditorContent as default, getTetronsRemainingDays, getTetronsVersion, initializeTetrons, isApiKeyValid };
12
+ export { EditorContent, EditorContent as default, getTetronsVersion, initializeTetrons, isApiKeyValid };
package/dist/index.mjs CHANGED
@@ -503,7 +503,7 @@ var Fragment = class _Fragment {
503
503
  position in this fragment. The result object will be reused
504
504
  (overwritten) the next time the function is called. @internal
505
505
  */
506
- findIndex(pos, round = -1) {
506
+ findIndex(pos) {
507
507
  if (pos == 0)
508
508
  return retIndex(0, pos);
509
509
  if (pos == this.size)
@@ -513,7 +513,7 @@ var Fragment = class _Fragment {
513
513
  for (let i = 0, curPos = 0; ; i++) {
514
514
  let cur = this.child(i), end = curPos + cur.nodeSize;
515
515
  if (end >= pos) {
516
- if (end == pos || round > 0)
516
+ if (end == pos)
517
517
  return retIndex(i + 1, end);
518
518
  return retIndex(i, curPos);
519
519
  }
@@ -1356,7 +1356,7 @@ var Node4 = class _Node {
1356
1356
  `blockSeparator` is given, it will be inserted to separate text
1357
1357
  from different block nodes. If `leafText` is given, it'll be
1358
1358
  inserted for every non-text leaf node encountered, otherwise
1359
- [`leafText`](https://prosemirror.net/docs/ref/#model.NodeSpec^leafText) will be used.
1359
+ [`leafText`](https://prosemirror.net/docs/ref/#model.NodeSpec.leafText) will be used.
1360
1360
  */
1361
1361
  textBetween(from2, to, blockSeparator, leafText) {
1362
1362
  return this.content.textBetween(from2, to, blockSeparator, leafText);
@@ -2336,7 +2336,7 @@ var DOMParser = class _DOMParser {
2336
2336
  /**
2337
2337
  Construct a DOM parser using the parsing rules listed in a
2338
2338
  schema's [node specs](https://prosemirror.net/docs/ref/#model.NodeSpec.parseDOM), reordered by
2339
- [priority](https://prosemirror.net/docs/ref/#model.ParseRule.priority).
2339
+ [priority](https://prosemirror.net/docs/ref/#model.GenericParseRule.priority).
2340
2340
  */
2341
2341
  static fromSchema(schema) {
2342
2342
  return schema.cached.domParser || (schema.cached.domParser = new _DOMParser(schema, _DOMParser.schemaRules(schema)));
@@ -3055,6 +3055,8 @@ function renderSpec(doc3, structure, xmlNS, blockArraysIn) {
3055
3055
  let space2 = name.indexOf(" ");
3056
3056
  if (space2 > 0)
3057
3057
  dom.setAttributeNS(name.slice(0, space2), name.slice(space2 + 1), attrs[name]);
3058
+ else if (name == "style" && dom.style)
3059
+ dom.style.cssText = attrs[name];
3058
3060
  else
3059
3061
  dom.setAttribute(name, attrs[name]);
3060
3062
  }
@@ -8516,7 +8518,7 @@ function posFromCaret(view, node, offset, coords) {
8516
8518
  return null;
8517
8519
  if (desc.dom.nodeType == 1 && (desc.node.isBlock && desc.parent || !desc.contentDOM) && // Ignore elements with zero-size bounding rectangles
8518
8520
  ((rect = desc.dom.getBoundingClientRect()).width || rect.height)) {
8519
- if (desc.node.isBlock && desc.parent) {
8521
+ if (desc.node.isBlock && desc.parent && !/^T(R|BODY|HEAD|FOOT)$/.test(desc.dom.nodeName)) {
8520
8522
  if (!sawBlock && rect.left > coords.left || rect.top > coords.top)
8521
8523
  outsideBlock = desc.posBefore;
8522
8524
  else if (!sawBlock && rect.right < coords.left || rect.bottom < coords.top)
@@ -11504,16 +11506,16 @@ editHandlers.drop = (view, _event) => {
11504
11506
  tr.deleteSelection();
11505
11507
  }
11506
11508
  let pos = tr.mapping.map(insertPos);
11507
- let isNode2 = slice2.openStart == 0 && slice2.openEnd == 0 && slice2.content.childCount == 1;
11509
+ let isNode = slice2.openStart == 0 && slice2.openEnd == 0 && slice2.content.childCount == 1;
11508
11510
  let beforeInsert = tr.doc;
11509
- if (isNode2)
11511
+ if (isNode)
11510
11512
  tr.replaceRangeWith(pos, pos, slice2.content.firstChild);
11511
11513
  else
11512
11514
  tr.replaceRange(pos, pos, slice2);
11513
11515
  if (tr.doc.eq(beforeInsert))
11514
11516
  return;
11515
11517
  let $pos = tr.doc.resolve(pos);
11516
- if (isNode2 && NodeSelection.isSelectable(slice2.content.firstChild) && $pos.nodeAfter && $pos.nodeAfter.sameMarkup(slice2.content.firstChild)) {
11518
+ if (isNode && NodeSelection.isSelectable(slice2.content.firstChild) && $pos.nodeAfter && $pos.nodeAfter.sameMarkup(slice2.content.firstChild)) {
11517
11519
  tr.setSelection(new NodeSelection($pos));
11518
11520
  } else {
11519
11521
  let end = tr.mapping.map(insertPos);
@@ -12549,7 +12551,7 @@ function ruleFromNode(dom) {
12549
12551
  }
12550
12552
  return null;
12551
12553
  }
12552
- var isInline = /^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;
12554
+ var isInline = /^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;
12553
12555
  function readDOMChange(view, from2, to, typeOver, addedNodes) {
12554
12556
  let compositionID = view.input.compositionPendingChanges || (view.composing ? view.input.compositionID : 0);
12555
12557
  view.input.compositionPendingChanges = 0;
@@ -16987,44 +16989,6 @@ function EditorContent({ apiKey }) {
16987
16989
  // src/index.ts
16988
16990
  var API_VALID = false;
16989
16991
  var API_VERSION = "";
16990
- var isNode = typeof window === "undefined";
16991
- var validityMap = {
16992
- free: 14,
16993
- pro: 30,
16994
- premium: 30,
16995
- platinum: 30
16996
- };
16997
- function getInstallDateKey() {
16998
- return "tetrons_installed_at";
16999
- }
17000
- async function getOrCreateInstallDate() {
17001
- const key = getInstallDateKey();
17002
- if (isNode) {
17003
- const fs = await import("fs");
17004
- const path = await import("path");
17005
- const usagePath = path.join(process.cwd(), ".tetrons-usage.json");
17006
- if (fs.existsSync(usagePath)) {
17007
- const data = JSON.parse(fs.readFileSync(usagePath, "utf-8"));
17008
- return new Date(data.installedAt);
17009
- }
17010
- const now = (/* @__PURE__ */ new Date()).toISOString();
17011
- fs.writeFileSync(usagePath, JSON.stringify({ installedAt: now }));
17012
- return new Date(now);
17013
- } else {
17014
- const saved = localStorage.getItem(key);
17015
- if (saved) return new Date(saved);
17016
- const now = (/* @__PURE__ */ new Date()).toISOString();
17017
- localStorage.setItem(key, now);
17018
- return new Date(now);
17019
- }
17020
- }
17021
- function getRemainingDays(installedAt, validityDays) {
17022
- const now = /* @__PURE__ */ new Date();
17023
- const diff = Math.floor(
17024
- (now.getTime() - installedAt.getTime()) / (1e3 * 60 * 60 * 24)
17025
- );
17026
- return validityDays - diff;
17027
- }
17028
16992
  async function initializeTetrons(apiKey) {
17029
16993
  const res = await fetch("https://staging.tetrons.com/api/validate", {
17030
16994
  method: "POST",
@@ -17040,21 +17004,6 @@ async function initializeTetrons(apiKey) {
17040
17004
  const data = await res.json();
17041
17005
  API_VALID = data.valid;
17042
17006
  API_VERSION = data.version;
17043
- if (!API_VALID) {
17044
- throw new Error("API Key is not valid.");
17045
- }
17046
- if (API_VERSION === "") {
17047
- throw new Error("No license version provided.");
17048
- }
17049
- const validityDays = validityMap[API_VERSION];
17050
- const installedAt = await getOrCreateInstallDate();
17051
- const remainingDays = getRemainingDays(installedAt, validityDays);
17052
- if (remainingDays <= 0) {
17053
- throw new Error(`Your ${API_VERSION} license has expired.`);
17054
- }
17055
- console.log(
17056
- `[TETRONS] Initialized: ${API_VERSION} | Remaining days: ${remainingDays}`
17057
- );
17058
17007
  }
17059
17008
  function getTetronsVersion() {
17060
17009
  return API_VERSION;
@@ -17062,17 +17011,10 @@ function getTetronsVersion() {
17062
17011
  function isApiKeyValid() {
17063
17012
  return API_VALID;
17064
17013
  }
17065
- async function getTetronsRemainingDays() {
17066
- if (!API_VALID || API_VERSION === "") return null;
17067
- const validityDays = validityMap[API_VERSION];
17068
- const installedAt = await getOrCreateInstallDate();
17069
- return getRemainingDays(installedAt, validityDays);
17070
- }
17071
17014
  var index_default = EditorContent;
17072
17015
  export {
17073
17016
  EditorContent,
17074
17017
  index_default as default,
17075
- getTetronsRemainingDays,
17076
17018
  getTetronsVersion,
17077
17019
  initializeTetrons,
17078
17020
  isApiKeyValid
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "tetrons",
3
- "version": "2.3.73",
3
+ "version": "2.3.74",
4
4
  "description": "A Next.js project written in TypeScript",
5
- "main": "dist/index.cjs",
5
+ "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
7
7
  "types": "dist/index.d.ts",
8
8
  "scripts": {
@@ -44,8 +44,8 @@
44
44
  },
45
45
  "peerDependencies": {
46
46
  "next": "15.3.2",
47
- "react": "^18.2.0 || ^19.0.0",
48
- "react-dom": "^18.2.0 || ^19.0.0"
47
+ "react": "^18.2.0",
48
+ "react-dom": "^18.2.0"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@eslint/eslintrc": "3.0.0",
@@ -70,8 +70,7 @@
70
70
  "react",
71
71
  "web"
72
72
  ],
73
- "sideEffects": false,
74
- "author": "Swastik Jha <swastik.jha@finapsys.co.in>",
73
+ "author": "Your Name",
75
74
  "license": "MIT",
76
75
  "exports": {
77
76
  ".": {
@@ -104,9 +103,6 @@
104
103
  "require": "./dist/app/api/validate/route.cjs"
105
104
  }
106
105
  },
107
- "browser": {
108
- "./dist/licenseUtils.server.js": false
109
- },
110
106
  "files": [
111
107
  "dist",
112
108
  "dist/styles/tetrons.css",
@@ -1,36 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }// src/lib/db.js
2
- var _mongoose = require('mongoose'); var _mongoose2 = _interopRequireDefault(_mongoose);
3
- var MONGO_URL = process.env.MONGO_URL;
4
- var connectDB = async () => {
5
- if (_mongoose2.default.connection.readyState >= 1) {
6
- return;
7
- }
8
- try {
9
- await _mongoose2.default.connect(MONGO_URL);
10
- console.log("Connected to MongoDB \u{1F44D}");
11
- } catch (error) {
12
- console.error("MongoDB connection failed \u274C", error);
13
- process.exit(1);
14
- }
15
- };
16
-
17
- // src/models/ApiKey.ts
18
-
19
- var ApiKeySchema = new _mongoose2.default.Schema({
20
- email: { type: String, required: true },
21
- organization: { type: String, required: true },
22
- version: {
23
- type: String,
24
- enum: ["free", "pro", "premium", "platinum"],
25
- required: true
26
- },
27
- apiKey: { type: String, required: true, unique: true },
28
- createdAt: { type: Date, default: Date.now },
29
- expiresAt: { type: Date }
30
- });
31
- var ApiKey = _mongoose2.default.models.ApiKey || _mongoose2.default.model("ApiKey", ApiKeySchema);
32
-
33
-
34
-
35
-
36
- exports.connectDB = connectDB; exports.ApiKey = ApiKey;
@@ -1,36 +0,0 @@
1
- // src/lib/db.js
2
- import mongoose from "mongoose";
3
- var MONGO_URL = process.env.MONGO_URL;
4
- var connectDB = async () => {
5
- if (mongoose.connection.readyState >= 1) {
6
- return;
7
- }
8
- try {
9
- await mongoose.connect(MONGO_URL);
10
- console.log("Connected to MongoDB \u{1F44D}");
11
- } catch (error) {
12
- console.error("MongoDB connection failed \u274C", error);
13
- process.exit(1);
14
- }
15
- };
16
-
17
- // src/models/ApiKey.ts
18
- import mongoose2 from "mongoose";
19
- var ApiKeySchema = new mongoose2.Schema({
20
- email: { type: String, required: true },
21
- organization: { type: String, required: true },
22
- version: {
23
- type: String,
24
- enum: ["free", "pro", "premium", "platinum"],
25
- required: true
26
- },
27
- apiKey: { type: String, required: true, unique: true },
28
- createdAt: { type: Date, default: Date.now },
29
- expiresAt: { type: Date }
30
- });
31
- var ApiKey = mongoose2.models.ApiKey || mongoose2.model("ApiKey", ApiKeySchema);
32
-
33
- export {
34
- connectDB,
35
- ApiKey
36
- };