feat: updating how modules are being defined (using new version of DITY)

This commit is contained in:
Kacper Kula 2025-09-18 11:00:51 +01:00
parent 5b60f47e65
commit df1bf46413
34 changed files with 884 additions and 738 deletions

View file

@ -0,0 +1,5 @@
---
"sqlseal": patch
---
internal: updated how modules are being defined

View file

@ -55,8 +55,8 @@
"@codemirror/language": "^6.11.2",
"@codemirror/state": "^6.5.2",
"@codemirror/view": "^6.38.1",
"@hypersphere/dity": "^0.0.10",
"@hypersphere/dity-graph": "^0.0.10",
"@hypersphere/dity": "^0.1.3",
"@hypersphere/dity-graph": "^0.0.11",
"@hypersphere/omnibus": "^0.1.6",
"@jlongster/sql.js": "^1.6.7",
"@types/jsonpath": "^0.2.4",

View file

@ -21,11 +21,11 @@ importers:
specifier: ^6.38.1
version: 6.38.1
'@hypersphere/dity':
specifier: ^0.0.10
version: 0.0.10(@types/node@24.2.1)(sass-embedded@1.89.0)(sass@1.90.0)
specifier: ^0.1.3
version: 0.1.3(@types/node@24.2.1)(sass-embedded@1.89.0)(sass@1.90.0)
'@hypersphere/dity-graph':
specifier: ^0.0.10
version: 0.0.10(@types/node@24.2.1)(graphology-types@0.24.8)(sass-embedded@1.89.0)(sass@1.90.0)
specifier: ^0.0.11
version: 0.0.11(@types/node@24.2.1)(graphology-types@0.24.8)(sass-embedded@1.89.0)(sass@1.90.0)
'@hypersphere/omnibus':
specifier: ^0.1.6
version: 0.1.6
@ -353,8 +353,8 @@ packages:
'@braintree/sanitize-url@7.1.1':
resolution: {integrity: sha512-i1L7noDNxtFyL5DmZafWy1wRVhGehQmzZaz1HiN5e7iylJMSZR7ekOV7NsIqa5qBldlLrsKv4HbgFUVlQrz8Mw==}
'@bufbuild/protobuf@2.6.3':
resolution: {integrity: sha512-w/gJKME9mYN7ZoUAmSMAWXk4hkVpxRKvEJCb3dV5g9wwWdxTJJ0ayOJAVcNxtdqaxDyFuC0uz4RSGVacJ030PQ==}
'@bufbuild/protobuf@2.8.0':
resolution: {integrity: sha512-r1/0w5C9dkbcdjyxY8ZHsC5AOWg4Pnzhm2zu7LO4UHSounp2tMm6Y+oioV9zlGbLveE7YaWRDUk48WLxRDgoqg==}
'@changesets/apply-release-plan@7.0.12':
resolution: {integrity: sha512-EaET7As5CeuhTzvXTQCRZeBUcisoYPDDcXvgTE/2jmmypKp0RC7LxKj/yzqeh/1qFTZI7oDGFcL1PHRuQuketQ==}
@ -612,6 +612,12 @@ packages:
peerDependencies:
eslint: ^6.0.0 || ^7.0.0 || >=8.0.0
'@eslint-community/eslint-utils@4.9.0':
resolution: {integrity: sha512-ayVFHdtZ+hsq1t2Dy24wCmGXGe4q9Gu3smhLYALJrr473ZH27MsnSL+LKUlimp4BWJqMDMLmPpx/Q9R3OAlL4g==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies:
eslint: ^6.0.0 || ^7.0.0 || >=8.0.0
'@eslint-community/regexpp@4.12.1':
resolution: {integrity: sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==}
engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0}
@ -651,27 +657,26 @@ packages:
resolution: {integrity: sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==}
engines: {node: '>=18.18.0'}
'@humanfs/node@0.16.6':
resolution: {integrity: sha512-YuI2ZHQL78Q5HbhDiBA1X4LmYdXCKCMQIfw0pw7piHJwyREFebJUvrQN4cMssyES6x+vfUbx1CIpaQUKYdQZOw==}
'@humanfs/node@0.16.7':
resolution: {integrity: sha512-/zUx+yOsIrG4Y43Eh2peDeKCxlRt/gET6aHfaKpuq267qXdYDFViVHfMaLyygZOnl0kGWxFIgsBy8QFuTLUXEQ==}
engines: {node: '>=18.18.0'}
'@humanwhocodes/module-importer@1.0.1':
resolution: {integrity: sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==}
engines: {node: '>=12.22'}
'@humanwhocodes/retry@0.3.1':
resolution: {integrity: sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA==}
engines: {node: '>=18.18'}
'@humanwhocodes/retry@0.4.3':
resolution: {integrity: sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==}
engines: {node: '>=18.18'}
'@hypersphere/dity-graph@0.0.10':
resolution: {integrity: sha512-RDHgSxZIdhY3M7vhAoU2YWlJD3uW1+KAVHJPORghSJ6HIBMuFxdzd/lESbO0OklFqcnXbGMNkjIn1BQ2txvhAA==}
'@hypersphere/dity-graph@0.0.11':
resolution: {integrity: sha512-tJERPrHqSrMyHrmAqocQ0C5HTGhFpJOSQVLLxoOFfiw/Vek9LCgYawdXHGzUwjP9UIGha6+7yFPkQlxrRqBtVg==}
'@hypersphere/dity@0.0.10':
resolution: {integrity: sha512-zHFwf1EcHfuTRNtGxItqewUaNZ+4QzjeW9rh06uhgq4lPvRUg0jzpQpGtDFJCMnGOskeyc4vw9XFHw6hBYUEcg==}
'@hypersphere/dity@0.1.0':
resolution: {integrity: sha512-dtlJCuqSNuXnm7Qr02YRj+ztp/E0RiwPt9S95edHh25W86JdX6ZHtR4kY+jYIAYzBOmZKWH7b2Ivjs0l6IB3Ew==}
'@hypersphere/dity@0.1.3':
resolution: {integrity: sha512-6HyITnRB7iYDHX6/2Cc74Ds6gKQbMLI0P1PAHDQVGeNBIDmp+ogvKwmHUnargC9CXaL4EaBhr3nm18mIq1uhGw==}
'@hypersphere/omnibus@0.1.6':
resolution: {integrity: sha512-agZuKyhdW0n1JoLYZUuA6Du1QoQn39/LapFgRtbJs7fyRM62C9O2PWISHUCwAKnC1Splshpd8glQgx5pA2zkCg==}
@ -945,101 +950,206 @@ packages:
cpu: [arm]
os: [android]
'@rollup/rollup-android-arm-eabi@4.50.1':
resolution: {integrity: sha512-HJXwzoZN4eYTdD8bVV22DN8gsPCAj3V20NHKOs8ezfXanGpmVPR7kalUHd+Y31IJp9stdB87VKPFbsGY3H/2ag==}
cpu: [arm]
os: [android]
'@rollup/rollup-android-arm64@4.46.2':
resolution: {integrity: sha512-nTeCWY83kN64oQ5MGz3CgtPx8NSOhC5lWtsjTs+8JAJNLcP3QbLCtDDgUKQc/Ro/frpMq4SHUaHN6AMltcEoLQ==}
cpu: [arm64]
os: [android]
'@rollup/rollup-android-arm64@4.50.1':
resolution: {integrity: sha512-PZlsJVcjHfcH53mOImyt3bc97Ep3FJDXRpk9sMdGX0qgLmY0EIWxCag6EigerGhLVuL8lDVYNnSo8qnTElO4xw==}
cpu: [arm64]
os: [android]
'@rollup/rollup-darwin-arm64@4.46.2':
resolution: {integrity: sha512-HV7bW2Fb/F5KPdM/9bApunQh68YVDU8sO8BvcW9OngQVN3HHHkw99wFupuUJfGR9pYLLAjcAOA6iO+evsbBaPQ==}
cpu: [arm64]
os: [darwin]
'@rollup/rollup-darwin-arm64@4.50.1':
resolution: {integrity: sha512-xc6i2AuWh++oGi4ylOFPmzJOEeAa2lJeGUGb4MudOtgfyyjr4UPNK+eEWTPLvmPJIY/pgw6ssFIox23SyrkkJw==}
cpu: [arm64]
os: [darwin]
'@rollup/rollup-darwin-x64@4.46.2':
resolution: {integrity: sha512-SSj8TlYV5nJixSsm/y3QXfhspSiLYP11zpfwp6G/YDXctf3Xkdnk4woJIF5VQe0of2OjzTt8EsxnJDCdHd2xMA==}
cpu: [x64]
os: [darwin]
'@rollup/rollup-darwin-x64@4.50.1':
resolution: {integrity: sha512-2ofU89lEpDYhdLAbRdeyz/kX3Y2lpYc6ShRnDjY35bZhd2ipuDMDi6ZTQ9NIag94K28nFMofdnKeHR7BT0CATw==}
cpu: [x64]
os: [darwin]
'@rollup/rollup-freebsd-arm64@4.46.2':
resolution: {integrity: sha512-ZyrsG4TIT9xnOlLsSSi9w/X29tCbK1yegE49RYm3tu3wF1L/B6LVMqnEWyDB26d9Ecx9zrmXCiPmIabVuLmNSg==}
cpu: [arm64]
os: [freebsd]
'@rollup/rollup-freebsd-arm64@4.50.1':
resolution: {integrity: sha512-wOsE6H2u6PxsHY/BeFHA4VGQN3KUJFZp7QJBmDYI983fgxq5Th8FDkVuERb2l9vDMs1D5XhOrhBrnqcEY6l8ZA==}
cpu: [arm64]
os: [freebsd]
'@rollup/rollup-freebsd-x64@4.46.2':
resolution: {integrity: sha512-pCgHFoOECwVCJ5GFq8+gR8SBKnMO+xe5UEqbemxBpCKYQddRQMgomv1104RnLSg7nNvgKy05sLsY51+OVRyiVw==}
cpu: [x64]
os: [freebsd]
'@rollup/rollup-freebsd-x64@4.50.1':
resolution: {integrity: sha512-A/xeqaHTlKbQggxCqispFAcNjycpUEHP52mwMQZUNqDUJFFYtPHCXS1VAG29uMlDzIVr+i00tSFWFLivMcoIBQ==}
cpu: [x64]
os: [freebsd]
'@rollup/rollup-linux-arm-gnueabihf@4.46.2':
resolution: {integrity: sha512-EtP8aquZ0xQg0ETFcxUbU71MZlHaw9MChwrQzatiE8U/bvi5uv/oChExXC4mWhjiqK7azGJBqU0tt5H123SzVA==}
cpu: [arm]
os: [linux]
'@rollup/rollup-linux-arm-gnueabihf@4.50.1':
resolution: {integrity: sha512-54v4okehwl5TaSIkpp97rAHGp7t3ghinRd/vyC1iXqXMfjYUTm7TfYmCzXDoHUPTTf36L8pr0E7YsD3CfB3ZDg==}
cpu: [arm]
os: [linux]
'@rollup/rollup-linux-arm-musleabihf@4.46.2':
resolution: {integrity: sha512-qO7F7U3u1nfxYRPM8HqFtLd+raev2K137dsV08q/LRKRLEc7RsiDWihUnrINdsWQxPR9jqZ8DIIZ1zJJAm5PjQ==}
cpu: [arm]
os: [linux]
'@rollup/rollup-linux-arm-musleabihf@4.50.1':
resolution: {integrity: sha512-p/LaFyajPN/0PUHjv8TNyxLiA7RwmDoVY3flXHPSzqrGcIp/c2FjwPPP5++u87DGHtw+5kSH5bCJz0mvXngYxw==}
cpu: [arm]
os: [linux]
'@rollup/rollup-linux-arm64-gnu@4.46.2':
resolution: {integrity: sha512-3dRaqLfcOXYsfvw5xMrxAk9Lb1f395gkoBYzSFcc/scgRFptRXL9DOaDpMiehf9CO8ZDRJW2z45b6fpU5nwjng==}
cpu: [arm64]
os: [linux]
'@rollup/rollup-linux-arm64-gnu@4.50.1':
resolution: {integrity: sha512-2AbMhFFkTo6Ptna1zO7kAXXDLi7H9fGTbVaIq2AAYO7yzcAsuTNWPHhb2aTA6GPiP+JXh85Y8CiS54iZoj4opw==}
cpu: [arm64]
os: [linux]
'@rollup/rollup-linux-arm64-musl@4.46.2':
resolution: {integrity: sha512-fhHFTutA7SM+IrR6lIfiHskxmpmPTJUXpWIsBXpeEwNgZzZZSg/q4i6FU4J8qOGyJ0TR+wXBwx/L7Ho9z0+uDg==}
cpu: [arm64]
os: [linux]
'@rollup/rollup-linux-arm64-musl@4.50.1':
resolution: {integrity: sha512-Cgef+5aZwuvesQNw9eX7g19FfKX5/pQRIyhoXLCiBOrWopjo7ycfB292TX9MDcDijiuIJlx1IzJz3IoCPfqs9w==}
cpu: [arm64]
os: [linux]
'@rollup/rollup-linux-loongarch64-gnu@4.46.2':
resolution: {integrity: sha512-i7wfGFXu8x4+FRqPymzjD+Hyav8l95UIZ773j7J7zRYc3Xsxy2wIn4x+llpunexXe6laaO72iEjeeGyUFmjKeA==}
cpu: [loong64]
os: [linux]
'@rollup/rollup-linux-loongarch64-gnu@4.50.1':
resolution: {integrity: sha512-RPhTwWMzpYYrHrJAS7CmpdtHNKtt2Ueo+BlLBjfZEhYBhK00OsEqM08/7f+eohiF6poe0YRDDd8nAvwtE/Y62Q==}
cpu: [loong64]
os: [linux]
'@rollup/rollup-linux-ppc64-gnu@4.46.2':
resolution: {integrity: sha512-B/l0dFcHVUnqcGZWKcWBSV2PF01YUt0Rvlurci5P+neqY/yMKchGU8ullZvIv5e8Y1C6wOn+U03mrDylP5q9Yw==}
cpu: [ppc64]
os: [linux]
'@rollup/rollup-linux-ppc64-gnu@4.50.1':
resolution: {integrity: sha512-eSGMVQw9iekut62O7eBdbiccRguuDgiPMsw++BVUg+1K7WjZXHOg/YOT9SWMzPZA+w98G+Fa1VqJgHZOHHnY0Q==}
cpu: [ppc64]
os: [linux]
'@rollup/rollup-linux-riscv64-gnu@4.46.2':
resolution: {integrity: sha512-32k4ENb5ygtkMwPMucAb8MtV8olkPT03oiTxJbgkJa7lJ7dZMr0GCFJlyvy+K8iq7F/iuOr41ZdUHaOiqyR3iQ==}
cpu: [riscv64]
os: [linux]
'@rollup/rollup-linux-riscv64-gnu@4.50.1':
resolution: {integrity: sha512-S208ojx8a4ciIPrLgazF6AgdcNJzQE4+S9rsmOmDJkusvctii+ZvEuIC4v/xFqzbuP8yDjn73oBlNDgF6YGSXQ==}
cpu: [riscv64]
os: [linux]
'@rollup/rollup-linux-riscv64-musl@4.46.2':
resolution: {integrity: sha512-t5B2loThlFEauloaQkZg9gxV05BYeITLvLkWOkRXogP4qHXLkWSbSHKM9S6H1schf/0YGP/qNKtiISlxvfmmZw==}
cpu: [riscv64]
os: [linux]
'@rollup/rollup-linux-riscv64-musl@4.50.1':
resolution: {integrity: sha512-3Ag8Ls1ggqkGUvSZWYcdgFwriy2lWo+0QlYgEFra/5JGtAd6C5Hw59oojx1DeqcA2Wds2ayRgvJ4qxVTzCHgzg==}
cpu: [riscv64]
os: [linux]
'@rollup/rollup-linux-s390x-gnu@4.46.2':
resolution: {integrity: sha512-YKjekwTEKgbB7n17gmODSmJVUIvj8CX7q5442/CK80L8nqOUbMtf8b01QkG3jOqyr1rotrAnW6B/qiHwfcuWQA==}
cpu: [s390x]
os: [linux]
'@rollup/rollup-linux-s390x-gnu@4.50.1':
resolution: {integrity: sha512-t9YrKfaxCYe7l7ldFERE1BRg/4TATxIg+YieHQ966jwvo7ddHJxPj9cNFWLAzhkVsbBvNA4qTbPVNsZKBO4NSg==}
cpu: [s390x]
os: [linux]
'@rollup/rollup-linux-x64-gnu@4.46.2':
resolution: {integrity: sha512-Jj5a9RUoe5ra+MEyERkDKLwTXVu6s3aACP51nkfnK9wJTraCC8IMe3snOfALkrjTYd2G1ViE1hICj0fZ7ALBPA==}
cpu: [x64]
os: [linux]
'@rollup/rollup-linux-x64-gnu@4.50.1':
resolution: {integrity: sha512-MCgtFB2+SVNuQmmjHf+wfI4CMxy3Tk8XjA5Z//A0AKD7QXUYFMQcns91K6dEHBvZPCnhJSyDWLApk40Iq/H3tA==}
cpu: [x64]
os: [linux]
'@rollup/rollup-linux-x64-musl@4.46.2':
resolution: {integrity: sha512-7kX69DIrBeD7yNp4A5b81izs8BqoZkCIaxQaOpumcJ1S/kmqNFjPhDu1LHeVXv0SexfHQv5cqHsxLOjETuqDuA==}
cpu: [x64]
os: [linux]
'@rollup/rollup-linux-x64-musl@4.50.1':
resolution: {integrity: sha512-nEvqG+0jeRmqaUMuwzlfMKwcIVffy/9KGbAGyoa26iu6eSngAYQ512bMXuqqPrlTyfqdlB9FVINs93j534UJrg==}
cpu: [x64]
os: [linux]
'@rollup/rollup-openharmony-arm64@4.50.1':
resolution: {integrity: sha512-RDsLm+phmT3MJd9SNxA9MNuEAO/J2fhW8GXk62G/B4G7sLVumNFbRwDL6v5NrESb48k+QMqdGbHgEtfU0LCpbA==}
cpu: [arm64]
os: [openharmony]
'@rollup/rollup-win32-arm64-msvc@4.46.2':
resolution: {integrity: sha512-wiJWMIpeaak/jsbaq2HMh/rzZxHVW1rU6coyeNNpMwk5isiPjSTx0a4YLSlYDwBH/WBvLz+EtsNqQScZTLJy3g==}
cpu: [arm64]
os: [win32]
'@rollup/rollup-win32-arm64-msvc@4.50.1':
resolution: {integrity: sha512-hpZB/TImk2FlAFAIsoElM3tLzq57uxnGYwplg6WDyAxbYczSi8O2eQ+H2Lx74504rwKtZ3N2g4bCUkiamzS6TQ==}
cpu: [arm64]
os: [win32]
'@rollup/rollup-win32-ia32-msvc@4.46.2':
resolution: {integrity: sha512-gBgaUDESVzMgWZhcyjfs9QFK16D8K6QZpwAaVNJxYDLHWayOta4ZMjGm/vsAEy3hvlS2GosVFlBlP9/Wb85DqQ==}
cpu: [ia32]
os: [win32]
'@rollup/rollup-win32-ia32-msvc@4.50.1':
resolution: {integrity: sha512-SXjv8JlbzKM0fTJidX4eVsH+Wmnp0/WcD8gJxIZyR6Gay5Qcsmdbi9zVtnbkGPG8v2vMR1AD06lGWy5FLMcG7A==}
cpu: [ia32]
os: [win32]
'@rollup/rollup-win32-x64-msvc@4.46.2':
resolution: {integrity: sha512-CvUo2ixeIQGtF6WvuB87XWqPQkoFAFqW+HUo/WzHwuHDvIwZCtjdWXoYCcr06iKGydiqTclC4jU/TNObC/xKZg==}
cpu: [x64]
os: [win32]
'@rollup/rollup-win32-x64-msvc@4.50.1':
resolution: {integrity: sha512-StxAO/8ts62KZVRAm4JZYq9+NqNsV7RvimNK+YM7ry//zebEH6meuugqW/P5OFUCjyQgui+9fUxT6d5NShvMvA==}
cpu: [x64]
os: [win32]
'@shikijs/core@3.9.2':
resolution: {integrity: sha512-3q/mzmw09B2B6PgFNeiaN8pkNOixWS726IHmJEpjDAcneDPMQmUg2cweT9cWXY4XcyQS3i6mOOUgQz9RRUP6HA==}
@ -2135,6 +2245,15 @@ packages:
supports-color:
optional: true
debug@4.4.3:
resolution: {integrity: sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==}
engines: {node: '>=6.0'}
peerDependencies:
supports-color: '*'
peerDependenciesMeta:
supports-color:
optional: true
decompress-response@6.0.0:
resolution: {integrity: sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==}
engines: {node: '>=10'}
@ -2415,6 +2534,15 @@ packages:
picomatch:
optional: true
fdir@6.5.0:
resolution: {integrity: sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==}
engines: {node: '>=12.0.0'}
peerDependencies:
picomatch: ^3 || ^4
peerDependenciesMeta:
picomatch:
optional: true
file-entry-cache@8.0.0:
resolution: {integrity: sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==}
engines: {node: '>=16.0.0'}
@ -3612,6 +3740,11 @@ packages:
engines: {node: '>=18.0.0', npm: '>=8.0.0'}
hasBin: true
rollup@4.50.1:
resolution: {integrity: sha512-78E9voJHwnXQMiQdiqswVLZwJIzdBKJ1GdI5Zx6XwoFKUIk09/sSrr+05QFzvYb8q6Y9pPV45zzDuYa3907TZA==}
engines: {node: '>=18.0.0', npm: '>=8.0.0'}
hasBin: true
roughjs@4.6.6:
resolution: {integrity: sha512-ZUz/69+SYpFN/g/lUlo2FXcIjRkSu3nDarreVdGGndHEBJ6cXPdKguS8JGxwj5HA5xIbVKSmLgr5b3AWxtRfvQ==}
@ -3963,6 +4096,10 @@ packages:
resolution: {integrity: sha512-tX5e7OM1HnYr2+a2C/4V0htOcSQcoSTH9KgJnVvNm5zm/cyEWKJ7j7YutsH9CxMdtOkkLFy2AHrMci9IM8IPZQ==}
engines: {node: '>=12.0.0'}
tinyglobby@0.2.15:
resolution: {integrity: sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==}
engines: {node: '>=12.0.0'}
tmp@0.0.33:
resolution: {integrity: sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==}
engines: {node: '>=0.6.0'}
@ -4177,6 +4314,46 @@ packages:
yaml:
optional: true
vite@7.1.5:
resolution: {integrity: sha512-4cKBO9wR75r0BeIWWWId9XK9Lj6La5X846Zw9dFfzMRw38IlTk2iCcUt6hsyiDRcPidc55ZParFYDXi0nXOeLQ==}
engines: {node: ^20.19.0 || >=22.12.0}
hasBin: true
peerDependencies:
'@types/node': ^20.19.0 || >=22.12.0
jiti: '>=1.21.0'
less: ^4.0.0
lightningcss: ^1.21.0
sass: ^1.70.0
sass-embedded: ^1.70.0
stylus: '>=0.54.8'
sugarss: ^5.0.0
terser: ^5.16.0
tsx: ^4.8.1
yaml: ^2.4.2
peerDependenciesMeta:
'@types/node':
optional: true
jiti:
optional: true
less:
optional: true
lightningcss:
optional: true
sass:
optional: true
sass-embedded:
optional: true
stylus:
optional: true
sugarss:
optional: true
terser:
optional: true
tsx:
optional: true
yaml:
optional: true
vitepress@2.0.0-alpha.11:
resolution: {integrity: sha512-l3FFkGtcB3u3iMlpnvkCR+MdOYqNaz2z+xPRlgZZnx8Xne4XLgQR0yfEfTqY/UyloTymXwxvRvu443Yo9Cr8pA==}
hasBin: true
@ -4505,7 +4682,7 @@ snapshots:
'@braintree/sanitize-url@7.1.1': {}
'@bufbuild/protobuf@2.6.3': {}
'@bufbuild/protobuf@2.8.0': {}
'@changesets/apply-release-plan@7.0.12':
dependencies:
@ -4789,12 +4966,17 @@ snapshots:
eslint: 9.15.0
eslint-visitor-keys: 3.4.3
'@eslint-community/eslint-utils@4.9.0(eslint@9.15.0)':
dependencies:
eslint: 9.15.0
eslint-visitor-keys: 3.4.3
'@eslint-community/regexpp@4.12.1': {}
'@eslint/config-array@0.19.2':
dependencies:
'@eslint/object-schema': 2.1.6
debug: 4.4.1
debug: 4.4.3
minimatch: 3.1.2
transitivePeerDependencies:
- supports-color
@ -4810,7 +4992,7 @@ snapshots:
'@eslint/eslintrc@3.3.1':
dependencies:
ajv: 6.12.6
debug: 4.4.1
debug: 4.4.3
espree: 10.4.0
globals: 14.0.0
ignore: 5.3.2
@ -4834,20 +5016,18 @@ snapshots:
'@humanfs/core@0.19.1': {}
'@humanfs/node@0.16.6':
'@humanfs/node@0.16.7':
dependencies:
'@humanfs/core': 0.19.1
'@humanwhocodes/retry': 0.3.1
'@humanwhocodes/retry': 0.4.3
'@humanwhocodes/module-importer@1.0.1': {}
'@humanwhocodes/retry@0.3.1': {}
'@humanwhocodes/retry@0.4.3': {}
'@hypersphere/dity-graph@0.0.10(@types/node@24.2.1)(graphology-types@0.24.8)(sass-embedded@1.89.0)(sass@1.90.0)':
'@hypersphere/dity-graph@0.0.11(@types/node@24.2.1)(graphology-types@0.24.8)(sass-embedded@1.89.0)(sass@1.90.0)':
dependencies:
'@hypersphere/dity': 0.0.10(@types/node@24.2.1)(sass-embedded@1.89.0)(sass@1.90.0)
'@hypersphere/dity': 0.1.0(@types/node@24.2.1)(sass-embedded@1.89.0)(sass@1.90.0)
'@sigma/node-border': 3.0.0(sigma@3.0.2(graphology-types@0.24.8))
chroma-js: 3.1.2
graphology: 0.26.0(graphology-types@0.24.8)
@ -4869,10 +5049,27 @@ snapshots:
- tsx
- yaml
'@hypersphere/dity@0.0.10(@types/node@24.2.1)(sass-embedded@1.89.0)(sass@1.90.0)':
'@hypersphere/dity@0.1.0(@types/node@24.2.1)(sass-embedded@1.89.0)(sass@1.90.0)':
dependencies:
typescript: 5.9.2
vite: 7.1.2(@types/node@24.2.1)(sass-embedded@1.89.0)(sass@1.90.0)
vite: 7.1.5(@types/node@24.2.1)(sass-embedded@1.89.0)(sass@1.90.0)
transitivePeerDependencies:
- '@types/node'
- jiti
- less
- lightningcss
- sass
- sass-embedded
- stylus
- sugarss
- terser
- tsx
- yaml
'@hypersphere/dity@0.1.3(@types/node@24.2.1)(sass-embedded@1.89.0)(sass@1.90.0)':
dependencies:
typescript: 5.9.2
vite: 7.1.5(@types/node@24.2.1)(sass-embedded@1.89.0)(sass@1.90.0)
transitivePeerDependencies:
- '@types/node'
- jiti
@ -5259,63 +5456,126 @@ snapshots:
'@rollup/rollup-android-arm-eabi@4.46.2':
optional: true
'@rollup/rollup-android-arm-eabi@4.50.1':
optional: true
'@rollup/rollup-android-arm64@4.46.2':
optional: true
'@rollup/rollup-android-arm64@4.50.1':
optional: true
'@rollup/rollup-darwin-arm64@4.46.2':
optional: true
'@rollup/rollup-darwin-arm64@4.50.1':
optional: true
'@rollup/rollup-darwin-x64@4.46.2':
optional: true
'@rollup/rollup-darwin-x64@4.50.1':
optional: true
'@rollup/rollup-freebsd-arm64@4.46.2':
optional: true
'@rollup/rollup-freebsd-arm64@4.50.1':
optional: true
'@rollup/rollup-freebsd-x64@4.46.2':
optional: true
'@rollup/rollup-freebsd-x64@4.50.1':
optional: true
'@rollup/rollup-linux-arm-gnueabihf@4.46.2':
optional: true
'@rollup/rollup-linux-arm-gnueabihf@4.50.1':
optional: true
'@rollup/rollup-linux-arm-musleabihf@4.46.2':
optional: true
'@rollup/rollup-linux-arm-musleabihf@4.50.1':
optional: true
'@rollup/rollup-linux-arm64-gnu@4.46.2':
optional: true
'@rollup/rollup-linux-arm64-gnu@4.50.1':
optional: true
'@rollup/rollup-linux-arm64-musl@4.46.2':
optional: true
'@rollup/rollup-linux-arm64-musl@4.50.1':
optional: true
'@rollup/rollup-linux-loongarch64-gnu@4.46.2':
optional: true
'@rollup/rollup-linux-loongarch64-gnu@4.50.1':
optional: true
'@rollup/rollup-linux-ppc64-gnu@4.46.2':
optional: true
'@rollup/rollup-linux-ppc64-gnu@4.50.1':
optional: true
'@rollup/rollup-linux-riscv64-gnu@4.46.2':
optional: true
'@rollup/rollup-linux-riscv64-gnu@4.50.1':
optional: true
'@rollup/rollup-linux-riscv64-musl@4.46.2':
optional: true
'@rollup/rollup-linux-riscv64-musl@4.50.1':
optional: true
'@rollup/rollup-linux-s390x-gnu@4.46.2':
optional: true
'@rollup/rollup-linux-s390x-gnu@4.50.1':
optional: true
'@rollup/rollup-linux-x64-gnu@4.46.2':
optional: true
'@rollup/rollup-linux-x64-gnu@4.50.1':
optional: true
'@rollup/rollup-linux-x64-musl@4.46.2':
optional: true
'@rollup/rollup-linux-x64-musl@4.50.1':
optional: true
'@rollup/rollup-openharmony-arm64@4.50.1':
optional: true
'@rollup/rollup-win32-arm64-msvc@4.46.2':
optional: true
'@rollup/rollup-win32-arm64-msvc@4.50.1':
optional: true
'@rollup/rollup-win32-ia32-msvc@4.46.2':
optional: true
'@rollup/rollup-win32-ia32-msvc@4.50.1':
optional: true
'@rollup/rollup-win32-x64-msvc@4.46.2':
optional: true
'@rollup/rollup-win32-x64-msvc@4.50.1':
optional: true
'@shikijs/core@3.9.2':
dependencies:
'@shikijs/types': 3.9.2
@ -6532,6 +6792,10 @@ snapshots:
dependencies:
ms: 2.1.3
debug@4.4.3:
dependencies:
ms: 2.1.3
decompress-response@6.0.0:
dependencies:
mimic-response: 3.1.0
@ -6724,14 +6988,14 @@ snapshots:
eslint@9.15.0:
dependencies:
'@eslint-community/eslint-utils': 4.7.0(eslint@9.15.0)
'@eslint-community/eslint-utils': 4.9.0(eslint@9.15.0)
'@eslint-community/regexpp': 4.12.1
'@eslint/config-array': 0.19.2
'@eslint/core': 0.9.1
'@eslint/eslintrc': 3.3.1
'@eslint/js': 9.15.0
'@eslint/plugin-kit': 0.2.8
'@humanfs/node': 0.16.6
'@humanfs/node': 0.16.7
'@humanwhocodes/module-importer': 1.0.1
'@humanwhocodes/retry': 0.4.3
'@types/estree': 1.0.8
@ -6739,7 +7003,7 @@ snapshots:
ajv: 6.12.6
chalk: 4.1.2
cross-spawn: 7.0.6
debug: 4.4.1
debug: 4.4.3
escape-string-regexp: 4.0.0
eslint-scope: 8.4.0
eslint-visitor-keys: 4.2.1
@ -6850,6 +7114,10 @@ snapshots:
optionalDependencies:
picomatch: 4.0.3
fdir@6.5.0(picomatch@4.0.3):
optionalDependencies:
picomatch: 4.0.3
file-entry-cache@8.0.0:
dependencies:
flat-cache: 4.0.1
@ -8272,6 +8540,33 @@ snapshots:
'@rollup/rollup-win32-x64-msvc': 4.46.2
fsevents: 2.3.3
rollup@4.50.1:
dependencies:
'@types/estree': 1.0.8
optionalDependencies:
'@rollup/rollup-android-arm-eabi': 4.50.1
'@rollup/rollup-android-arm64': 4.50.1
'@rollup/rollup-darwin-arm64': 4.50.1
'@rollup/rollup-darwin-x64': 4.50.1
'@rollup/rollup-freebsd-arm64': 4.50.1
'@rollup/rollup-freebsd-x64': 4.50.1
'@rollup/rollup-linux-arm-gnueabihf': 4.50.1
'@rollup/rollup-linux-arm-musleabihf': 4.50.1
'@rollup/rollup-linux-arm64-gnu': 4.50.1
'@rollup/rollup-linux-arm64-musl': 4.50.1
'@rollup/rollup-linux-loongarch64-gnu': 4.50.1
'@rollup/rollup-linux-ppc64-gnu': 4.50.1
'@rollup/rollup-linux-riscv64-gnu': 4.50.1
'@rollup/rollup-linux-riscv64-musl': 4.50.1
'@rollup/rollup-linux-s390x-gnu': 4.50.1
'@rollup/rollup-linux-x64-gnu': 4.50.1
'@rollup/rollup-linux-x64-musl': 4.50.1
'@rollup/rollup-openharmony-arm64': 4.50.1
'@rollup/rollup-win32-arm64-msvc': 4.50.1
'@rollup/rollup-win32-ia32-msvc': 4.50.1
'@rollup/rollup-win32-x64-msvc': 4.50.1
fsevents: 2.3.3
roughjs@4.6.6:
dependencies:
hachure-fill: 0.5.2
@ -8365,7 +8660,7 @@ snapshots:
sass-embedded@1.89.0:
dependencies:
'@bufbuild/protobuf': 2.6.3
'@bufbuild/protobuf': 2.8.0
buffer-builder: 0.2.0
colorjs.io: 0.5.2
immutable: 5.1.3
@ -8595,6 +8890,11 @@ snapshots:
fdir: 6.4.6(picomatch@4.0.3)
picomatch: 4.0.3
tinyglobby@0.2.15:
dependencies:
fdir: 6.5.0(picomatch@4.0.3)
picomatch: 4.0.3
tmp@0.0.33:
dependencies:
os-tmpdir: 1.0.2
@ -8782,6 +9082,20 @@ snapshots:
sass: 1.90.0
sass-embedded: 1.89.0
vite@7.1.5(@types/node@24.2.1)(sass-embedded@1.89.0)(sass@1.90.0):
dependencies:
esbuild: 0.25.9
fdir: 6.5.0(picomatch@4.0.3)
picomatch: 4.0.3
postcss: 8.5.6
rollup: 4.50.1
tinyglobby: 0.2.15
optionalDependencies:
'@types/node': 24.2.1
fsevents: 2.3.3
sass: 1.90.0
sass-embedded: 1.89.0
vitepress@2.0.0-alpha.11(@types/node@24.2.1)(postcss@8.5.6)(sass-embedded@1.89.0)(sass@1.90.0)(typescript@5.9.2):
dependencies:
'@docsearch/css': 4.0.0-beta.7

View file

@ -19,16 +19,12 @@ export default class SqlSealPlugin extends Plugin {
async onload() {
// CONTAINER
this.container = mainModule
.resolve({
"obsidian.app": this.app,
"obsidian.plugin": this,
"obsidian.vault": this.app.vault,
})
.build();
.resolve('obsidian.app', d => d.value(this.app))
.resolve('obsidian.plugin', d => d.value(this))
.resolve('obsidian.vault', d => d.value(this.app.vault))
.build()
const init = await this.container.get("init");
init();
const init = await this.container.get("init")
init()
}
onunload() {}
}

View file

@ -1,11 +1,8 @@
import { Plugin } from "obsidian";
import {
PluginRegister,
SQLSealApi,
SQLSealRegisterApi,
} from "./pluginApi/sqlSealApi";
import { makeInjector } from "@hypersphere/dity";
import { ApiModule } from "./module";
import { RendererRegistry } from "../editor/renderer/rendererRegistry";
import { SqlSealDatabase } from "../database/database";
import { ModernCellParser } from "../syntaxHighlight/cellParser/ModernCellParser";
@ -13,43 +10,35 @@ import { ModernCellParser } from "../syntaxHighlight/cellParser/ModernCellParser
const SQLSEAL_API_KEY = "___sqlSeal";
const SQLSEAL_QUEUED_PLUGINS = "___sqlSeal_queue";
@(makeInjector<ApiModule, "factory">()([
"plugin",
"cellParser",
"rendererRegistry",
"db",
]))
export class ApiInit {
make(
plugin: Plugin,
cellParser: ModernCellParser,
rendererRegistry: RendererRegistry,
db: SqlSealDatabase,
) {
return () => {
const api = new SQLSealRegisterApi(
plugin,
cellParser,
rendererRegistry,
db,
);
(window as any)[SQLSEAL_API_KEY] = api;
plugin.register(() => {
delete (window as any)[SQLSEAL_API_KEY];
});
export const apiInit = (
plugin: Plugin,
cellParser: ModernCellParser,
rendererRegistry: RendererRegistry,
db: SqlSealDatabase,
) => {
return () => {
const api = new SQLSealRegisterApi(
plugin,
cellParser,
rendererRegistry,
db,
);
(window as any)[SQLSEAL_API_KEY] = api;
plugin.register(() => {
delete (window as any)[SQLSEAL_API_KEY];
});
const queuedPlugins = (window as any)[SQLSEAL_QUEUED_PLUGINS] as
| PluginRegister[]
| undefined;
if (!queuedPlugins) {
return;
}
const queuedPlugins = (window as any)[SQLSEAL_QUEUED_PLUGINS] as
| PluginRegister[]
| undefined;
if (!queuedPlugins) {
return;
}
queuedPlugins.forEach((pl) => {
api.registerForPluginNew(pl);
});
queuedPlugins.forEach((pl) => {
api.registerForPluginNew(pl);
});
(window as any)[SQLSEAL_QUEUED_PLUGINS] = [];
};
}
}
(window as any)[SQLSEAL_QUEUED_PLUGINS] = [];
};
};

View file

@ -1,21 +1,15 @@
import { asFactory, buildContainer } from "@hypersphere/dity";
import { ApiInit } from "./init";
import { Registrator } from "@hypersphere/dity";
import { apiInit } from "./init";
import { Plugin } from "obsidian";
import { SqlSealDatabase } from "../database/database";
import { RendererRegistry } from "../editor/renderer/rendererRegistry";
import { ModernCellParser } from "../syntaxHighlight/cellParser/ModernCellParser";
export const apiModule = buildContainer(c => c
.register({
init: asFactory(ApiInit)
})
.exports('init')
.externals<{
plugin: Plugin,
cellParser: ModernCellParser,
db: SqlSealDatabase,
rendererRegistry: RendererRegistry
}>()
)
export type ApiModule = typeof apiModule
export const apiModule = new Registrator()
.import<'plugin', Plugin>()
.import<'cellParser', Promise<ModernCellParser>>()
.import<'db', Promise<SqlSealDatabase>>()
.import<'rendererRegistry', RendererRegistry>()
.register('init', db => db.fn(apiInit).inject('plugin', 'cellParser', 'rendererRegistry', 'db'))
.export('init')

View file

@ -1,68 +1,60 @@
import { makeInjector } from "@hypersphere/dity"
import { ContextMenuModule } from "./module"
import { App, Menu, Plugin, TAbstractFile, TFile, TFolder } from "obsidian"
import { App, Menu, Plugin, TAbstractFile, TFile, TFolder } from "obsidian";
@(makeInjector<ContextMenuModule, 'factory'>()([
'plugin', 'app'
]))
export class ContextMenuInit {
make(plugin: Plugin, app: App) {
const createNewCSVFile = async (file: TAbstractFile) => {
const targetDir = file instanceof TFile ? file.parent : file
const basePath = targetDir!.path
export const contextMenuInit = (plugin: Plugin, app: App) => {
const createNewCSVFile = async (file: TAbstractFile) => {
const targetDir = file instanceof TFile ? file.parent : file;
const basePath = targetDir!.path;
const csvTemplate = 'Id,Name\n1,Test Data'
const csvTemplate = "Id,Name\n1,Test Data";
const defaultName = 'Untitled CSV'
let fileName = defaultName
let filePath = `${basePath}/${fileName}.csv`;
let counter = 1;
const defaultName = "Untitled CSV";
let fileName = defaultName;
let filePath = `${basePath}/${fileName}.csv`;
let counter = 1;
while (await app.vault.adapter.exists(filePath)) {
fileName = `${defaultName} ${counter}`;
filePath = `${basePath}/${fileName}.csv`;
counter++;
}
while (await app.vault.adapter.exists(filePath)) {
fileName = `${defaultName} ${counter}`;
filePath = `${basePath}/${fileName}.csv`;
counter++;
}
try {
const newFile = await app.vault.create(filePath, csvTemplate);
try {
const newFile = await app.vault.create(filePath, csvTemplate);
const leaf = app.workspace.getLeaf(false);
await leaf.openFile(newFile);
const leaf = app.workspace.getLeaf(false);
await leaf.openFile(newFile);
const fileExplorer = app.workspace.getLeavesOfType('file-explorer')[0]?.view;
if (fileExplorer) {
await(fileExplorer as any).revealInFolder(newFile);
}
} catch (error) {
console.error('Error creating CSV file:', error);
throw error;
}
}
const fileExplorer =
app.workspace.getLeavesOfType("file-explorer")[0]?.view;
if (fileExplorer) {
await (fileExplorer as any).revealInFolder(newFile);
}
} catch (error) {
console.error("Error creating CSV file:", error);
throw error;
}
};
const addCSVCreatorMenuItem = (menu: Menu, file: TAbstractFile) => {
if (!(file instanceof TFolder)) {
return
}
menu.addItem((item) => {
item
.setTitle('New CSV file')
.setSection('action-primary')
.setIcon('table')
.onClick(async () => {
try {
await createNewCSVFile(file)
} catch (error) {
console.error('Failed to create CSV file:', error)
}
});
});
}
const addCSVCreatorMenuItem = (menu: Menu, file: TAbstractFile) => {
if (!(file instanceof TFolder)) {
return;
}
menu.addItem((item) => {
item
.setTitle("New CSV file")
.setSection("action-primary")
.setIcon("table")
.onClick(async () => {
try {
await createNewCSVFile(file);
} catch (error) {
console.error("Failed to create CSV file:", error);
}
});
});
};
return () => {
plugin.registerEvent(
app.workspace.on('file-menu', addCSVCreatorMenuItem)
);
}
}
}
return () => {
plugin.registerEvent(app.workspace.on("file-menu", addCSVCreatorMenuItem));
};
};

View file

@ -1,16 +1,9 @@
import { asFactory, buildContainer } from "@hypersphere/dity";
import { ContextMenuInit } from "./init";
import { Registrator } from "@hypersphere/dity";
import { App, Plugin } from "obsidian";
import { contextMenuInit } from "./init";
export const contextMenu = buildContainer(c =>
c.register({
init: asFactory(ContextMenuInit)
})
.externals<{
app: App,
plugin: Plugin
}>()
.exports('init')
)
export type ContextMenuModule = typeof contextMenu
export const contextMenu = new Registrator()
.import<'app', App>()
.import<'plugin', Plugin>()
.register('init', d => d.fn(contextMenuInit).inject('plugin', 'app'))
.export('init')

View file

@ -1,16 +1,8 @@
import { App } from "obsidian";
import { SqlSealDatabase } from "./database";
import { makeInjector } from "@hypersphere/dity";
import { DbModel } from "./module";
@(makeInjector<DbModel, 'factory'>()([
'app'
]))
export class DatabaseFactory {
async make(app: App) {
const db = new SqlSealDatabase(app)
await db.connect()
return db
}
export const databaseFactory = async (app: App) => {
const db = new SqlSealDatabase(app)
await db.connect()
return db
}

View file

@ -1,13 +1,8 @@
import { asFactory, buildContainer } from "@hypersphere/dity";
import { Registrator } from "@hypersphere/dity";
import { App } from "obsidian";
import { DatabaseFactory } from "./factory";
import { databaseFactory } from "./factory";
export const db = buildContainer(c => c
.register({
db: asFactory(DatabaseFactory)
})
.externals<{ app: App }>()
.exports('db')
)
export type DbModel = typeof db
export const db = new Registrator()
.import<'app', App>()
.register('db', d => d.fn(databaseFactory).inject('app'))
.export('db')

View file

@ -1,11 +1,6 @@
import { makeInjector } from "@hypersphere/dity";
import { DebugModule } from "./module";
import { Plugin, WorkspaceLeaf } from "obsidian";
import { DityGraphView, VIEW_TYPE_EXAMPLE } from "./DityGraphView";
@(makeInjector<DebugModule, 'factory'>()(
['plugin']
))
export class DityGraph {
make(plugin: Plugin) {

View file

@ -1,16 +1,11 @@
import { App, MarkdownPostProcessorContext } from "obsidian"
import { RendererRegistry } from "../renderer/rendererRegistry"
import { CodeblockProcessor } from "./CodeblockProcessor"
import { makeInjector } from "@hypersphere/dity"
import { EditorModule } from "../module"
import { SqlSealDatabase } from "../../database/database"
import { Sync } from "../../sync/sync/sync"
import { Settings } from "../../settings/Settings"
import { ModernCellParser } from "../../syntaxHighlight/cellParser/ModernCellParser"
@(makeInjector<EditorModule>()(
['app', 'db', 'cellParser', 'sync', 'rendererRegistry', 'settings']
))
export class SqlSealCodeblockHandler {
constructor(
private readonly app: App,

View file

@ -1,15 +1,10 @@
import { App, MarkdownPostProcessorContext, Plugin } from "obsidian";
import { InlineProcessor } from "./InlineProcessor";
import { makeInjector } from "@hypersphere/dity";
import { EditorModule } from "../../module";
import { SqlSealDatabase } from "../../../database/database";
import { Sync } from "../../../sync/sync/sync";
import { Settings } from "../../../settings/Settings";
@(makeInjector<EditorModule>()(
['app', 'db', 'settings', 'sync', 'rendererRegistry']
))
export class SqlSealInlineHandler {
constructor(
private readonly app: App,

View file

@ -1,8 +1,6 @@
import { makeInjector } from "@hypersphere/dity";
import { App, Plugin } from "obsidian";
import { SqlSealDatabase } from "../database/database";
import { Sync } from "../sync/sync/sync";
import { EditorModule } from "./module";
import { RendererRegistry } from "./renderer/rendererRegistry";
import { TableRenderer } from "./renderer/TableRenderer";
import { GridRenderer } from "./renderer/GridRenderer";
@ -14,72 +12,77 @@ import { SqlSealInlineHandler } from "./codeblockHandler/inline/InlineCodeHandle
import { SqlSealCodeblockHandler } from "./codeblockHandler/SqlSealCodeblockHandler";
import { createSqlSealEditorExtension } from "../syntaxHighlight/editorExtension/inlineCodeBlock";
@(makeInjector<EditorModule, 'factory'>()([
'app', 'db', 'plugin', 'sync', 'inlineHandler', 'blockHandler', 'rendererRegistry', 'settings'
]))
export class EditorInit {
make(
app: App,
db: SqlSealDatabase,
plugin: Plugin,
sync: Sync,
inlineHandler: SqlSealInlineHandler,
blockHandler: SqlSealCodeblockHandler,
rendererRegistry: RendererRegistry,
settings: Settings
) {
export const editorInit = (
app: App,
db: SqlSealDatabase,
plugin: Plugin,
sync: Sync,
inlineHandler: SqlSealInlineHandler,
blockHandler: SqlSealCodeblockHandler,
rendererRegistry: RendererRegistry,
settings: Settings,
) => {
const registerInlineCodeblocks = () => {
// Extension for Live Preview
const editorExtension = createSqlSealEditorExtension(
app,
db,
settings,
sync,
);
const registerInlineCodeblocks = () => {
plugin.registerEditorExtension(editorExtension);
// Extension for Live Preview
const editorExtension = createSqlSealEditorExtension(
app,
db,
settings,
sync,
);
// Extension for Read mode
plugin.registerMarkdownPostProcessor((el, ctx) => {
const inlineCodeBlocks = el.querySelectorAll("code");
inlineCodeBlocks.forEach((node: HTMLSpanElement) => {
const text = node.innerText;
if (text.startsWith("S>")) {
const container = createEl("span", { cls: "sqlseal-inline-result" });
container.setAttribute("aria-label", text.slice(3));
container.classList.add("has-tooltip");
node.replaceWith(container);
inlineHandler.getHandler()(text, container, ctx);
}
});
});
};
plugin.registerEditorExtension(editorExtension);
const registerBlockCodeblock = () => {
plugin.registerMarkdownCodeBlockProcessor(
"sqlseal",
blockHandler.getHandler(),
);
};
// Extension for Read mode
plugin.registerMarkdownPostProcessor((el, ctx) => {
const inlineCodeBlocks = el.querySelectorAll('code');
inlineCodeBlocks.forEach((node: HTMLSpanElement) => {
const text = node.innerText;
if (text.startsWith('S>')) {
const container = createEl('span', { cls: 'sqlseal-inline-result' });
container.setAttribute('aria-label', text.slice(3));
container.classList.add('has-tooltip');
node.replaceWith(container);
inlineHandler.getHandler()(text, container, ctx);
}
});
});
const registerViews = () => {
rendererRegistry.register(
"sql-seal-internal-table",
new TableRenderer(app),
);
rendererRegistry.register(
"sql-seal-internal-grid",
new GridRenderer(settings, plugin, app),
);
rendererRegistry.register(
"sql-seal-internal-markdown",
new MarkdownRenderer(app),
);
rendererRegistry.register("sql-seal-internal-list", new ListRenderer(app));
rendererRegistry.register(
"sql-seal-internal-template",
new TemplateRenderer(app),
);
};
}
return () => {
registerViews();
const registerBlockCodeblock = () => {
plugin.registerMarkdownCodeBlockProcessor('sqlseal', blockHandler.getHandler())
}
const registerViews = () => {
rendererRegistry.register('sql-seal-internal-table', new TableRenderer(app))
rendererRegistry.register('sql-seal-internal-grid', new GridRenderer(settings, plugin, app))
rendererRegistry.register('sql-seal-internal-markdown', new MarkdownRenderer(app))
rendererRegistry.register('sql-seal-internal-list', new ListRenderer(app))
rendererRegistry.register('sql-seal-internal-template', new TemplateRenderer(app))
}
return () => {
registerViews()
app.workspace.onLayoutReady(async () => {
registerInlineCodeblocks()
registerBlockCodeblock()
})
// FIXME: block
}
}
}
app.workspace.onLayoutReady(async () => {
registerInlineCodeblocks();
registerBlockCodeblock();
});
// FIXME: block
};
};

View file

@ -1,30 +1,25 @@
import { asClass, asFactory, buildContainer } from "@hypersphere/dity"
import { Registrator } from "@hypersphere/dity"
import { App, Plugin } from "obsidian"
import { SqlSealDatabase } from "../database/database"
import { Sync } from "../sync/sync/sync"
import { RendererRegistry } from "./renderer/rendererRegistry"
import { EditorInit } from "./init"
import { editorInit } from "./init"
import { SqlSealCodeblockHandler } from "./codeblockHandler/SqlSealCodeblockHandler"
import { SqlSealInlineHandler } from "./codeblockHandler/inline/InlineCodeHandler"
import { Settings } from "../settings/Settings"
import { ModernCellParser } from "../syntaxHighlight/cellParser/ModernCellParser"
export const editor = buildContainer(c => c
.register({
blockHandler: asClass(SqlSealCodeblockHandler),
inlineHandler: asClass(SqlSealInlineHandler),
rendererRegistry: asClass(RendererRegistry),
init: asFactory(EditorInit)
})
.externals<{
app: App,
db: SqlSealDatabase,
plugin: Plugin,
sync: Sync,
cellParser: ModernCellParser,
settings: Settings
}>()
.exports('rendererRegistry', 'init')
)
export const editor = new Registrator()
.import<'app', App>()
.import<'db', Promise<SqlSealDatabase>>()
.import<'plugin', Plugin>()
.import<'sync', Promise<Sync>>()
.import<'cellParser', Promise<ModernCellParser>>()
.import<'settings', Promise<Settings>>()
.register('inlineRenderer', d => d.cls(SqlSealInlineHandler).inject('app', 'db', 'settings', 'sync'))
.register('rendererRegistry', d => d.cls(RendererRegistry).inject())
.register('blockHandler', d => d.cls(SqlSealCodeblockHandler).inject('app', 'db', 'cellParser', 'sync', 'rendererRegistry', 'settings'))
.register('init', d => d.fn(editorInit).inject('app', 'db', 'plugin', 'sync', 'inlineRenderer', 'blockHandler', 'rendererRegistry', 'settings'))
.export('rendererRegistry', 'init')
export type EditorModule = typeof editor

View file

@ -1,6 +1,4 @@
import { makeInjector } from "@hypersphere/dity";
import { ExplorerModule } from "./module";
import { addIcon, App, Plugin, WorkspaceLeaf } from "obsidian";
import { addIcon, App, Plugin } from "obsidian";
import { SqlSealDatabase } from "../database/database";
import { ModernCellParser } from "../syntaxHighlight/cellParser/ModernCellParser";
import { RendererRegistry } from "../editor/renderer/rendererRegistry";
@ -16,64 +14,57 @@ import { activateView } from "./activateView";
// @ts-ignore: Handled by esbuild
import SQLSealIcon from "./sqlseal-bw.svg";
@(makeInjector<ExplorerModule, "factory">()([
"plugin",
"app",
"db",
"cellParser",
"rendererRegistry",
"sync",
"settings",
"viewPluginGenerator",
"dbManager"
]))
export class InitFactory {
make(
plugin: Plugin,
app: App,
db: SqlSealDatabase,
cellParser: ModernCellParser,
rendererRegistry: RendererRegistry,
sync: Sync,
settings: Settings,
viewPluginGenerator: ViewPluginGeneratorType,
dbManager: DatabaseManager
) {
export const explorerInit = (
plugin: Plugin,
app: App,
db: SqlSealDatabase,
cellParser: ModernCellParser,
rendererRegistry: RendererRegistry,
sync: Sync,
settings: Settings,
viewPluginGenerator: ViewPluginGeneratorType,
dbManager: DatabaseManager,
) => {
return () => {
plugin.registerView(
"sqlseal-explorer-view",
(leaf) =>
new ExplorerView(
leaf,
rendererRegistry,
db,
cellParser,
settings,
sync,
viewPluginGenerator,
),
);
addIcon("logo-sqlseal", SQLSealIcon);
plugin.addRibbonIcon("logo-sqlseal", "SQLSeal Explorer", () =>
activateView(plugin.app, "sqlseal-explorer-view"),
);
return () => {
plugin.registerView(
"sqlseal-explorer-view",
(leaf) =>
new ExplorerView(
leaf,
rendererRegistry,
db,
cellParser,
settings,
sync,
viewPluginGenerator
),
);
addIcon("logo-sqlseal", SQLSealIcon);
plugin.addRibbonIcon("logo-sqlseal", "SQLSeal Explorer", () =>
activateView(plugin.app, "sqlseal-explorer-view"),
// Register unified SQLSeal file view for both SQL and database files
plugin.registerView(SQLSEAL_FILE_VIEW, (leaf) => {
return new SQLSealFileView(
leaf,
dbManager,
viewPluginGenerator,
rendererRegistry,
cellParser,
settings,
sync,
db,
);
});
// Register unified SQLSeal file view for both SQL and database files
plugin.registerView(SQLSEAL_FILE_VIEW, (leaf) => {
return new SQLSealFileView(leaf, dbManager, viewPluginGenerator, rendererRegistry, cellParser, settings, sync, db)
})
// Extensions for SQLSeal file view are registered by SettingsSQLControls
// Extensions for SQLSeal file view are registered by SettingsSQLControls
plugin.addCommand({
id: 'sqlseal-command-explorer',
name: 'Open SQLSeal Explorer',
icon: 'logo-sqlseal',
callback: () => activateView(app, 'sqlseal-explorer-view')
})
};
}
}
plugin.addCommand({
id: "sqlseal-command-explorer",
name: "Open SQLSeal Explorer",
icon: "logo-sqlseal",
callback: () => activateView(app, "sqlseal-explorer-view"),
});
};
};

View file

@ -1,5 +1,5 @@
import { asClass, asFactory, buildContainer } from "@hypersphere/dity";
import { InitFactory } from "./InitFactory";
import { Registrator } from "@hypersphere/dity";
import { explorerInit } from "./InitFactory";
import { App, Plugin } from "obsidian";
import { ModernCellParser } from "../syntaxHighlight/cellParser/ModernCellParser";
import { SqlSealDatabase } from "../database/database";
@ -10,23 +10,15 @@ import { ViewPlugin } from "@codemirror/view";
import { ViewPluginGeneratorType } from "../syntaxHighlight/viewPluginGenerator";
import { DatabaseManager } from "./database/databaseManager";
export const explorer = buildContainer((c) =>
c
.register({
init: asFactory(InitFactory),
dbManager: asClass(DatabaseManager)
})
.externals<{
app: App,
cellParser: ModernCellParser,
db: SqlSealDatabase,
settings: Settings,
sync: Sync
rendererRegistry: RendererRegistry,
plugin: Plugin,
viewPluginGenerator: ViewPluginGeneratorType
}>()
.exports('init'),
);
export type ExplorerModule = typeof explorer;
export const explorer = new Registrator()
.import<'app', App>()
.import<'cellParser', Promise<ModernCellParser>>()
.import<'db', Promise<SqlSealDatabase>>()
.import<'settings', Promise<Settings>>()
.import<'sync', Promise<Sync>>()
.import<'rendererRegistry', RendererRegistry>()
.import<'plugin', Plugin>()
.import<'viewPluginGenerator', ViewPluginGeneratorType>()
.register('dbManager', d => d.cls(DatabaseManager).inject())
.register('init', d => d.fn(explorerInit).inject('plugin', 'app', 'db', 'cellParser', 'rendererRegistry', 'sync', 'settings', 'viewPluginGenerator', 'dbManager'))
.export('init')

View file

@ -1,27 +1,24 @@
import { makeInjector } from "@hypersphere/dity";
import { GlobalTablesModule } from "./module";
import { App, Plugin, WorkspaceLeaf } from "obsidian";
import { App, Plugin } from "obsidian";
import { GLOBAL_TABLES_VIEW_TYPE, GlobalTablesView } from "./GlobalTablesView";
import { Sync } from "../sync/sync/sync";
import { activateView } from "../explorer/activateView";
@(makeInjector<GlobalTablesModule, "factory">()(["plugin", "app", "sync"]))
export class GlobalTablesViewRegister {
make(plugin: Plugin, app: App, sync: Sync) {
export const globalTablesViewRendererFactory = (
plugin: Plugin,
app: App,
sync: Sync,
) => {
return () => {
plugin.registerView(
GLOBAL_TABLES_VIEW_TYPE,
(leaf) => new GlobalTablesView(leaf, app.vault, sync),
);
return () => {
plugin.registerView(
GLOBAL_TABLES_VIEW_TYPE,
(leaf) => new GlobalTablesView(leaf, app.vault, sync),
);
plugin.addCommand({
id: 'sqlseal-command-global-tables',
name: 'Open global tables configuration',
icon: 'logo-sqlseal',
callback: () => activateView(app, GLOBAL_TABLES_VIEW_TYPE)
})
};
}
}
plugin.addCommand({
id: "sqlseal-command-global-tables",
name: "Open global tables configuration",
icon: "logo-sqlseal",
callback: () => activateView(app, GLOBAL_TABLES_VIEW_TYPE),
});
};
};

View file

@ -1,11 +1,5 @@
import { makeInjector } from "@hypersphere/dity"
import { GlobalTablesModule } from "./module"
@(makeInjector<GlobalTablesModule, 'factory'>()(['globalTablesViewRegister']))
export class InitFactory {
make(register: () => void) {
return () => {
register()
}
}
}
export const globalTablesInit = (register: () => void) => {
return () => {
register();
};
};

View file

@ -1,20 +1,13 @@
import { asFactory, buildContainer } from "@hypersphere/dity";
import { InitFactory } from "./InitFactory";
import { Registrator } from "@hypersphere/dity";
import { globalTablesInit } from "./InitFactory";
import { App, Plugin } from "obsidian";
import { GlobalTablesViewRegister } from "./GlobalTablesViewRegister";
import { globalTablesViewRendererFactory } from "./GlobalTablesViewRegister";
import { Sync } from "../sync/sync/sync";
export const globalTables = buildContainer(c =>
c.register({
init: asFactory(InitFactory),
globalTablesViewRegister: asFactory(GlobalTablesViewRegister)
})
.externals<{
plugin: Plugin,
app: App,
sync: Sync
}>()
.exports('init')
)
export type GlobalTablesModule = typeof globalTables
export const globalTables = new Registrator()
.import<'app', App>()
.import<'plugin', Plugin>()
.import<'sync', Promise<Sync>>()
.register('globalTablesViewRegister', d => d.fn(globalTablesViewRendererFactory).inject('plugin', 'app', 'sync'))
.register('init', d => d.fn(globalTablesInit).inject('globalTablesViewRegister'))
.export('init')

View file

@ -1,39 +1,23 @@
import { makeInjector } from "@hypersphere/dity";
import { MainModule } from "./module";
type InitFn = () => void;
type InitFn = () => void
@(makeInjector<MainModule, 'factory'>()([
'settings.init',
'editor.init',
'syntaxHighlight.init',
'contextMenu.init',
'sync.init',
'api.init',
'globalTables.init',
'explorer.init'
]))
export class Init {
async make(
settingsInit: InitFn,
editorInit: InitFn,
highlighInit: InitFn,
contextMenu: InitFn,
syncInit: InitFn,
apiInit: InitFn,
globalTablesInit: InitFn,
explorerInit: InitFn
) {
return () => {
settingsInit()
editorInit()
highlighInit()
contextMenu()
syncInit()
apiInit()
globalTablesInit()
explorerInit()
}
}
}
export const mainInit = (
settingsInit: InitFn,
editorInit: InitFn,
highlighInit: InitFn,
contextMenu: InitFn,
syncInit: InitFn,
apiInit: InitFn,
globalTablesInit: InitFn,
explorerInit: InitFn,
) => {
return () => {
settingsInit();
editorInit();
highlighInit();
contextMenu();
syncInit();
apiInit();
globalTablesInit();
explorerInit();
};
};

View file

@ -1,10 +1,10 @@
import { asFactory, buildContainer } from '@hypersphere/dity'
import { Registrator } from '@hypersphere/dity'
import { App, Plugin, Vault } from 'obsidian'
import { db } from '../database/module'
import { editor } from '../editor/module'
import { sync } from '../sync/module'
import { SQLSealSettings } from '../settings/SQLSealSettingsTab'
import { Init } from './init'
import { mainInit } from './init'
import { settingsModule } from '../settings/module'
import { syntaxHighlight } from '../syntaxHighlight/module'
import { contextMenu } from '../contextMenu/module'
@ -12,86 +12,76 @@ import { apiModule } from '../api/module'
import { globalTables } from '../globalTables/module'
import { explorer } from '../explorer/module'
const obsidian = buildContainer(c => c
.externals<{
app: App,
plugin: Plugin,
vault: Vault
}>()
)
const obsidian = new Registrator({ logger: console.log })
.import<'app', App>()
.import<'plugin', Plugin>()
.import<'vault', Vault>()
.export('app', 'plugin', 'vault')
export const mainModule = buildContainer(c => c
.submodules({
obsidian,
db,
editor,
sync,
settings: settingsModule,
syntaxHighlight,
contextMenu,
api: apiModule,
globalTables,
explorer
})
.register({
init: asFactory(Init)
})
.externals<{ settings: SQLSealSettings }>()
.resolve({
'db.app': 'obsidian.app',
})
.resolve({
'editor.app': 'obsidian.app', // THESE SHOULD BE INVALID NOW
'editor.db': 'db.db',
'editor.plugin': 'obsidian.plugin',
'editor.sync': 'sync.syncBus',
'editor.cellParser': 'syntaxHighlight.cellParser',
'editor.settings': 'settings.settings'
})
.resolve({
'sync.app': 'obsidian.app',
'sync.db': 'db.db',
'sync.plugin': 'obsidian.plugin',
'sync.vault': 'obsidian.vault',
})
.resolve({
'settings.app': 'obsidian.app',
'settings.plugin': 'obsidian.plugin',
'settings.cellParser': 'syntaxHighlight.cellParser',
'settings.viewPluginGenerator': 'syntaxHighlight.viewPluginGenerator'
})
.resolve({
'syntaxHighlight.app': 'obsidian.app',
'syntaxHighlight.db': 'db.db',
'syntaxHighlight.plugin': 'obsidian.plugin',
'syntaxHighlight.rendererRegistry': 'editor.rendererRegistry'
})
.resolve({
'contextMenu.app': 'obsidian.app',
'contextMenu.plugin': 'obsidian.plugin'
})
.resolve({
'api.plugin': 'obsidian.plugin',
'api.cellParser': 'syntaxHighlight.cellParser',
'api.db': 'db.db',
'api.rendererRegistry': 'editor.rendererRegistry'
})
.resolve({
'globalTables.plugin': 'obsidian.plugin',
'globalTables.app': 'obsidian.app',
'globalTables.sync': 'sync.syncBus'
})
.resolve({
'explorer.app': 'obsidian.app',
'explorer.cellParser': 'syntaxHighlight.cellParser',
'explorer.db': 'db.db',
'explorer.settings': 'settings.settings',
'explorer.plugin': 'obsidian.plugin',
'explorer.rendererRegistry': 'editor.rendererRegistry',
'explorer.sync': 'sync.syncBus',
'explorer.viewPluginGenerator': 'syntaxHighlight.viewPluginGenerator'
})
)
export const mainModule = new Registrator()
.module('obsidian', obsidian)
.module('db', db)
.module('editor', editor)
.module('sync', sync)
.module('settings', settingsModule)
.module('syntaxHighlight', syntaxHighlight)
.module('contextMenu', contextMenu)
.module('api', apiModule)
.module('globalTables', globalTables)
.module('explorer', explorer)
.register('init', d => d.fn(mainInit).inject(
'settings.init',
'editor.init',
'syntaxHighlight.init',
'contextMenu.init',
'sync.init',
'api.init',
'globalTables.init',
'explorer.init'
))
.link('db.app', 'obsidian.app')
.link('editor.app', 'obsidian.app')
.link('editor.db', 'db.db')
.link('editor.plugin', 'obsidian.plugin')
.link('editor.sync', 'sync.syncBus')
.link('editor.cellParser', 'syntaxHighlight.cellParser')
.link('editor.settings', 'settings.settings')
.link('sync.app', 'obsidian.app')
.link('sync.db', 'db.db')
.link('sync.plugin', 'obsidian.plugin')
.link('sync.vault', 'obsidian.vault')
.link('settings.app', 'obsidian.app')
.link('settings.plugin', 'obsidian.plugin')
.link('settings.viewPluginGenerator', 'syntaxHighlight.viewPluginGenerator')
.link('settings.cellParser', 'syntaxHighlight.cellParser')
.link('syntaxHighlight.app', 'obsidian.app')
.link('syntaxHighlight.db', 'db.db')
.link('syntaxHighlight.plugin', 'obsidian.plugin')
.link('syntaxHighlight.rendererRegistry', 'editor.rendererRegistry')
.link('contextMenu.app', 'obsidian.app')
.link('contextMenu.plugin', 'obsidian.plugin')
.link('api.plugin', 'obsidian.plugin')
.link('api.cellParser', 'syntaxHighlight.cellParser')
.link('api.db', 'db.db')
.link('api.rendererRegistry', 'editor.rendererRegistry')
.link('globalTables.app', 'obsidian.app')
.link('globalTables.plugin', 'obsidian.plugin')
.link('globalTables.sync', 'sync.syncBus')
.link('explorer.app', 'obsidian.app')
.link('explorer.plugin', 'obsidian.plugin')
.link('explorer.cellParser', 'syntaxHighlight.cellParser')
.link('explorer.db', 'db.db')
.link('explorer.viewPluginGenerator', 'syntaxHighlight.viewPluginGenerator')
.link('explorer.sync', 'sync.syncBus')
.link('explorer.rendererRegistry', 'editor.rendererRegistry')
.link('explorer.settings', 'settings.settings')
export type MainModule = typeof mainModule

View file

@ -1,4 +1,3 @@
import { makeInjector } from '@hypersphere/dity';
import { App, PluginSettingTab, Setting, Plugin } from 'obsidian';
import { SettingsModule } from './module';
import { Settings } from './Settings';
@ -27,7 +26,6 @@ export const DEFAULT_SETTINGS: SQLSealSettings = {
};
@(makeInjector<SettingsModule>()(['app', 'plugin', 'settings']))
export class SQLSealSettingsTab extends PluginSettingTab {
plugin: Plugin;
// settings: SQLSealSettings;
@ -121,4 +119,8 @@ export class SQLSealSettingsTab extends PluginSettingTab {
this.settings.onChange(fn)
// this.onChangeFns.push(fn)
}
}
export const settingsTabFactory = (app: App, plugin: Plugin, settings: Settings) => {
return new SQLSealSettingsTab(app, plugin, settings)
}

View file

@ -1,5 +1,3 @@
import { makeInjector } from "@hypersphere/dity";
import { SettingsModule } from "./module";
import { App, Plugin } from "obsidian";
import { SQLSealSettingsTab } from "./SQLSealSettingsTab";
import { Settings } from "./Settings";
@ -8,29 +6,36 @@ import { SettingsJsonControls } from "./settingsTabSection/SettingsJsonControls"
import { SettingsSQLControls } from "./settingsTabSection/SettingsSQLControls";
import { ViewPluginGeneratorType } from "../syntaxHighlight/viewPluginGenerator";
@(makeInjector<SettingsModule>()(["plugin", "settingsTab", "app", "settings", "viewPluginGenerator"]))
export class SettingsInit {
async make(
plugin: Plugin,
settingsTab: SQLSealSettingsTab,
app: App,
settings: Settings,
viewPluginGenerator: ViewPluginGeneratorType
) {
const csvControl = new SettingsCSVControls(settings, app, plugin, viewPluginGenerator);
const jsonControl = new SettingsJsonControls(settings, app, plugin, viewPluginGenerator);
export const settingsInit = (
plugin: Plugin,
settingsTab: SQLSealSettingsTab,
app: App,
settings: Settings,
viewPluginGenerator: ViewPluginGeneratorType,
) => {
return () => {
const csvControl = new SettingsCSVControls(
settings,
app,
plugin,
viewPluginGenerator,
);
const jsonControl = new SettingsJsonControls(
settings,
app,
plugin,
viewPluginGenerator,
);
const sqlControl = new SettingsSQLControls(settings, app, plugin);
const controls = [csvControl, jsonControl, sqlControl];
settingsTab.registerControls(...controls);
return () => {
controls.forEach((c) => c.register());
plugin.addSettingTab(settingsTab);
plugin.register(() => {
controls.forEach((c) => c.unregister());
});
};
}
}
controls.forEach((c) => c.register());
plugin.addSettingTab(settingsTab);
plugin.register(() => {
controls.forEach((c) => c.unregister());
});
};
};

View file

@ -1,24 +1,19 @@
import { asClass, asFactory, buildContainer } from "@hypersphere/dity";
import { Registrator } from "@hypersphere/dity";
import { App, Plugin } from "obsidian";
import { SettingsFactory } from "./settingsFactory";
import { SQLSealSettingsTab } from "./SQLSealSettingsTab";
import { SettingsInit } from "./init";
import { settingsFactory } from "./settingsFactory";
import { settingsTabFactory, SQLSealSettingsTab } from "./SQLSealSettingsTab";
import { settingsInit } from "./init";
import { ModernCellParser } from "../syntaxHighlight/cellParser/ModernCellParser";
import { ViewPluginGeneratorType } from "../syntaxHighlight/viewPluginGenerator";
export const settingsModule = buildContainer(c => c
.externals<{
'plugin': Plugin,
'app': App,
'cellParser': ModernCellParser,
'viewPluginGenerator': ViewPluginGeneratorType
}>()
.register({
'settings': asFactory(SettingsFactory),
'settingsTab': asClass(SQLSealSettingsTab),
init: asFactory(SettingsInit)
})
.exports('settings', 'init')
)
export const settingsModule = new Registrator()
.import<'plugin', Plugin>()
.import<'app', App>()
.import<'cellParser', Promise<ModernCellParser>>()
.import<'viewPluginGenerator', ViewPluginGeneratorType>() // FIXME: we don't need this anymore
.register('settings', d => d.fn(settingsFactory).inject('plugin'))
.register('settingsTab', d => d.fn(settingsTabFactory).inject('app', 'plugin', 'settings'))
.register('init', d => d.fn(settingsInit).inject('plugin', 'settingsTab', 'app', 'settings', 'viewPluginGenerator'))
.export('settings', 'init')
export type SettingsModule = typeof settingsModule

View file

@ -1,19 +1,14 @@
import { makeInjector } from "@hypersphere/dity";
import { SettingsModule } from "./module";
import { Plugin } from "obsidian";
import { DEFAULT_SETTINGS } from "./SQLSealSettingsTab";
import { Settings } from "./Settings";
@(makeInjector<SettingsModule, 'factory'>()(['plugin']))
export class SettingsFactory {
async make(plugin: Plugin) {
const settings = Object.assign({}, DEFAULT_SETTINGS, await plugin.loadData());
const obj = new Settings(settings)
export const settingsFactory = async (plugin: Plugin) => {
const settings = Object.assign({}, DEFAULT_SETTINGS, await plugin.loadData());
const obj = new Settings(settings);
obj.onChange((settings) => {
plugin.saveData(settings)
})
obj.onChange((settings) => {
plugin.saveData(settings);
});
return obj
}
}
return obj;
};

View file

@ -1,29 +1,29 @@
import { App, Plugin } from "obsidian";
import { SealFileSync } from "./FileSync";
import { Sync } from "../sync/sync";
import { makeInjector } from "@hypersphere/dity";
import { SyncModule } from "../module";
import { SqlSealDatabase } from "../../database/database";
import { FilesFileSyncTable } from "../sync/tables/filesTable";
import { TagsFileSyncTable } from "../sync/tables/tagsTable";
import { TasksFileSyncTable } from "../sync/tables/tasksTable";
import { LinksFileSyncTable } from "../sync/tables/linksTable";
@(makeInjector<SyncModule>()(["app", "plugin", "db", "syncBus"]))
export class FileSyncFactory {
async make(app: App, plugin: Plugin, db: SqlSealDatabase, sync: Sync) {
return async () => {
const fileSync = new SealFileSync(app, plugin, (name) =>
sync.triggerGlobalTableChange(name),
);
export const fileSyncFactory = async (
app: App,
plugin: Plugin,
db: SqlSealDatabase,
sync: Sync,
) => {
return async () => {
const fileSync = new SealFileSync(app, plugin, (name) =>
sync.triggerGlobalTableChange(name),
);
fileSync.addTablePlugin(new FilesFileSyncTable(db, app, plugin));
fileSync.addTablePlugin(new TagsFileSyncTable(db, app));
fileSync.addTablePlugin(new TasksFileSyncTable(db, app));
fileSync.addTablePlugin(new LinksFileSyncTable(db, app));
fileSync.addTablePlugin(new FilesFileSyncTable(db, app, plugin));
fileSync.addTablePlugin(new TagsFileSyncTable(db, app));
fileSync.addTablePlugin(new TasksFileSyncTable(db, app));
fileSync.addTablePlugin(new LinksFileSyncTable(db, app));
await fileSync.init();
return fileSync;
};
}
}
await fileSync.init();
return fileSync;
};
};

View file

@ -1,22 +1,16 @@
import { asFactory, buildContainer } from "@hypersphere/dity"
import { FileSyncFactory } from "./fileSyncController/fileSyncFactory"
import { Registrator } from "@hypersphere/dity"
import { App, Plugin, Vault } from "obsidian"
import { SyncFactory } from "./sync/syncFactory"
import { syncBusFactory } from "./sync/syncFactory"
import { SqlSealDatabase } from "../database/database"
import { SyncInit } from "./sync/init"
import { syncInit } from "./sync/init"
import { fileSyncFactory } from "./fileSyncController/fileSyncFactory"
export const sync = buildContainer(c => c
.register({
fileSync: asFactory(FileSyncFactory),
syncBus: asFactory(SyncFactory),
init: asFactory(SyncInit)
})
.externals<{
app: App,
plugin: Plugin,
db: SqlSealDatabase,
vault: Vault
}>()
.exports('init', 'syncBus')
)
export type SyncModule = typeof sync
export const sync = new Registrator()
.import<'app', App>()
.import<'plugin', Plugin>()
.import<'db', Promise<SqlSealDatabase>>()
.import<'vault', Vault>()
.register('syncBus', d => d.fn(syncBusFactory).inject('db', 'vault', 'app'))
.register('fileSync', d => d.fn(fileSyncFactory).inject('app', 'plugin', 'db', 'syncBus'))
.register('init', d => d.fn(syncInit).inject('app', 'fileSync'))
.export('init', 'syncBus')

View file

@ -1,17 +1,10 @@
import { makeInjector } from "@hypersphere/dity";
import { SyncModule } from "../module";
import { App } from "obsidian";
import { SealFileSync } from "../fileSyncController/FileSync";
@(makeInjector<SyncModule, 'factory'>()([
'app', 'fileSync'
]))
export class SyncInit {
make(app: App, fileSync: () => Promise<SealFileSync>) {
return () => {
app.workspace.onLayoutReady(async () => {
await fileSync()
})
}
}
}
export const syncInit = (app: App, fileSync: () => Promise<SealFileSync>) => {
return () => {
app.workspace.onLayoutReady(async () => {
await fileSync();
});
};
};

View file

@ -1,19 +1,9 @@
import { App, Vault } from "obsidian";
import { makeInjector } from "@hypersphere/dity";
import { Sync } from "./sync";
import { SyncModule } from "../module";
import { SqlSealDatabase } from "../../database/database";
@(makeInjector<SyncModule>()([
'db', 'vault', 'app'
]))
export class SyncFactory {
async make(
db: SqlSealDatabase,
vault: Vault,
app: App) {
const sync = new Sync(db, vault, app)
await sync.init()
return sync
}
}
export const syncBusFactory = async (db: SqlSealDatabase, vault: Vault, app: App) => {
const sync = new Sync(db, vault, app);
await sync.init();
return sync;
};

View file

@ -1,32 +1,27 @@
import { App } from "obsidian"
import { ModernCellParser } from "./ModernCellParser"
import { LinkParser } from "./parser/link"
import { ImageParser } from "./parser/image"
import { CheckboxParser } from "./parser/checkbox"
import { makeInjector } from "@hypersphere/dity"
import { MainModule } from "../../main/module"
import { SqlSealDatabase } from "../../database/database"
import { SyntaxHighlightModule } from "../module"
import { App } from "obsidian";
import { ModernCellParser } from "./ModernCellParser";
import { LinkParser } from "./parser/link";
import { ImageParser } from "./parser/image";
import { CheckboxParser } from "./parser/checkbox";
import { SqlSealDatabase } from "../../database/database";
export const getCellParser = (app: App, create = createEl) => {
const cellParser = new ModernCellParser()
cellParser.register(new LinkParser(app, create))
cellParser.register(new ImageParser(app, create))
cellParser.register(new CheckboxParser(app, create))
return cellParser
}
const cellParser = new ModernCellParser();
cellParser.register(new LinkParser(app, create));
cellParser.register(new ImageParser(app, create));
cellParser.register(new CheckboxParser(app, create));
return cellParser;
};
@(makeInjector<SyntaxHighlightModule>()([
'app',
'db'
]))
export class CellParserFactory {
make(app: App, db: SqlSealDatabase, create: typeof createEl = createEl) {
const cellParser = new ModernCellParser()
cellParser.register(new LinkParser(app, create))
cellParser.register(new ImageParser(app, create))
cellParser.register(new CheckboxParser(app, create))
cellParser.registerDbFunctions(db)
return cellParser
}
}
export const cellParserFactory = (
app: App,
db: SqlSealDatabase,
create: typeof createEl = createEl,
) => {
const cellParser = new ModernCellParser();
cellParser.register(new LinkParser(app, create));
cellParser.register(new ImageParser(app, create));
cellParser.register(new CheckboxParser(app, create));
cellParser.registerDbFunctions(db);
return cellParser;
};

View file

@ -1,18 +1,14 @@
import { makeInjector } from "@hypersphere/dity"
import { SyntaxHighlightModule } from "./module"
import { EditorView, ViewPlugin } from "@codemirror/view";
import { App, Plugin } from "obsidian";
import { RendererRegistry } from "../editor/renderer/rendererRegistry";
import { SQLSealViewPlugin } from "./editorExtension/syntaxHighlight";
@(makeInjector<SyntaxHighlightModule, 'factory'>()([
'plugin', 'viewPluginGenerator'
]))
export class SyntaxHighlightInit {
make(plugin: Plugin, viewPluginGenerator: () => ViewPlugin<any>) {
return () => {
// FIXME: settings here.
plugin.registerEditorExtension([viewPluginGenerator()]);
}
}
}
export const syntaxHighlightInit = (
plugin: Plugin,
viewPluginGenerator: () => ViewPlugin<any>,
) => {
return () => {
// FIXME: settings here.
plugin.registerEditorExtension([viewPluginGenerator()]);
};
};

View file

@ -1,25 +1,18 @@
import { asFactory, buildContainer } from "@hypersphere/dity";
import { SyntaxHighlightInit } from "./init";
import { Registrator } from "@hypersphere/dity";
import { syntaxHighlightInit } from "./init";
import { App, Plugin } from "obsidian";
import { RendererRegistry } from "../editor/renderer/rendererRegistry";
import { CellParserFactory } from "./cellParser/factory";
import { cellParserFactory } from "./cellParser/factory";
import { SqlSealDatabase } from "../database/database";
import { ViewPluginGenerator } from "./viewPluginGenerator";
import { viewPluginGeneratorFactory } from "./viewPluginGenerator";
export const syntaxHighlight = buildContainer((c) =>
c
.externals<{
app: App;
db: SqlSealDatabase;
rendererRegistry: RendererRegistry;
plugin: Plugin;
}>()
.register({
init: asFactory(SyntaxHighlightInit),
cellParser: asFactory(CellParserFactory),
viewPluginGenerator: asFactory(ViewPluginGenerator)
})
.exports("init", "cellParser", "viewPluginGenerator"),
);
export type SyntaxHighlightModule = typeof syntaxHighlight;
export const syntaxHighlight = new Registrator()
.import<'app', App>()
.import<'db', Promise<SqlSealDatabase>>()
.import<'rendererRegistry', RendererRegistry>()
.import<'plugin', Plugin>()
.register('cellParser', d => d.fn(cellParserFactory).inject('app', 'db'))
.register('viewPluginGenerator', d => d.fn(viewPluginGeneratorFactory).inject('app', 'rendererRegistry'))
.register('init', d => d.fn(syntaxHighlightInit).inject('plugin', 'viewPluginGenerator'))
.export('init', 'viewPluginGenerator', 'cellParser')

View file

@ -1,17 +1,9 @@
import { makeInjector } from "@hypersphere/dity";
import { SyntaxHighlightModule } from "./module";
import { EditorView, ViewPlugin } from "@codemirror/view";
import { SQLSealViewPlugin } from "./editorExtension/syntaxHighlight";
import { App } from "obsidian";
import { RendererRegistry } from "../editor/renderer/rendererRegistry";
export type ViewPluginGeneratorType = ReturnType<ViewPluginGenerator['make']>
@(makeInjector<SyntaxHighlightModule, 'factory'>()([
'app', 'rendererRegistry'
]))
export class ViewPluginGenerator {
make(app: App, rendererRegistry: RendererRegistry) {
export const viewPluginGeneratorFactory = (app: App, rendererRegistry: RendererRegistry) => {
return (allIsCode: boolean = false) => {
return ViewPlugin.define(
(view: EditorView) => new SQLSealViewPlugin(view, app, rendererRegistry, allIsCode),
@ -19,4 +11,6 @@ export class ViewPluginGenerator {
)
}
}
}
export type ViewPluginGeneratorType = ReturnType<typeof viewPluginGeneratorFactory>