@treenity/core 1.0.47 → 3.0.0
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/chain.d.ts +20 -0
- package/dist/chain.d.ts.map +1 -0
- package/dist/chain.js +59 -0
- package/dist/chain.js.map +1 -0
- package/dist/client/handle.d.ts +13 -0
- package/dist/client/handle.d.ts.map +1 -0
- package/dist/client/handle.js +46 -0
- package/dist/client/handle.js.map +1 -0
- package/dist/client/index.d.ts +21 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +5 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/trpc.d.ts +13 -0
- package/dist/client/trpc.d.ts.map +1 -0
- package/dist/client/trpc.js +78 -0
- package/dist/client/trpc.js.map +1 -0
- package/dist/client.d.ts +2 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +2 -0
- package/dist/client.js.map +1 -0
- package/dist/comp/handle.d.ts +14 -0
- package/dist/comp/handle.d.ts.map +1 -0
- package/dist/comp/handle.js +21 -0
- package/dist/comp/handle.js.map +1 -0
- package/dist/comp/index.d.ts +42 -0
- package/dist/comp/index.d.ts.map +1 -0
- package/dist/comp/index.js +126 -0
- package/dist/comp/index.js.map +1 -0
- package/dist/comp/needs.d.ts +26 -0
- package/dist/comp/needs.d.ts.map +1 -0
- package/dist/comp/needs.js +101 -0
- package/dist/comp/needs.js.map +1 -0
- package/dist/comp/validate.d.ts +13 -0
- package/dist/comp/validate.d.ts.map +1 -0
- package/dist/comp/validate.js +117 -0
- package/dist/comp/validate.js.map +1 -0
- package/dist/comp.d.ts +2 -0
- package/dist/comp.d.ts.map +1 -0
- package/dist/comp.js +2 -0
- package/dist/comp.js.map +1 -0
- package/dist/contexts/schema/index.d.ts +7 -0
- package/dist/contexts/schema/index.d.ts.map +1 -0
- package/dist/contexts/schema/index.js +2 -0
- package/dist/contexts/schema/index.js.map +1 -0
- package/dist/contexts/schema.d.ts +2 -0
- package/dist/contexts/schema.d.ts.map +1 -0
- package/dist/contexts/schema.js +2 -0
- package/dist/contexts/schema.js.map +1 -0
- package/dist/contexts/service/index.d.ts +31 -0
- package/dist/contexts/service/index.d.ts.map +1 -0
- package/dist/contexts/service/index.js +16 -0
- package/dist/contexts/service/index.js.map +1 -0
- package/dist/contexts/service.d.ts +1 -14
- package/dist/contexts/service.d.ts.map +1 -1
- package/dist/contexts/service.js +2 -0
- package/dist/contexts/service.js.map +1 -0
- package/dist/contexts/telegram/index.d.ts +19 -0
- package/dist/contexts/telegram/index.d.ts.map +1 -0
- package/dist/contexts/telegram/index.js +89 -0
- package/dist/contexts/telegram/index.js.map +1 -0
- package/dist/contexts/text/index.d.ts +7 -0
- package/dist/contexts/text/index.d.ts.map +1 -0
- package/dist/contexts/text/index.js +9 -0
- package/dist/contexts/text/index.js.map +1 -0
- package/dist/contexts/text.d.ts +2 -0
- package/dist/contexts/text.d.ts.map +1 -0
- package/dist/contexts/text.js +2 -0
- package/dist/contexts/text.js.map +1 -0
- package/dist/core/component.d.ts +41 -0
- package/dist/core/component.d.ts.map +1 -0
- package/dist/core/component.js +105 -0
- package/dist/core/component.js.map +1 -0
- package/dist/core/context.d.ts +5 -0
- package/dist/core/context.d.ts.map +1 -0
- package/dist/core/context.js +3 -0
- package/dist/core/context.js.map +1 -0
- package/dist/core/index.d.ts +5 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +8 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/path.d.ts +7 -0
- package/dist/core/path.d.ts.map +1 -0
- package/dist/core/path.js +37 -0
- package/dist/core/path.js.map +1 -0
- package/dist/core/registry.d.ts +16 -0
- package/dist/core/registry.d.ts.map +1 -0
- package/dist/core/registry.js +100 -0
- package/dist/core/registry.js.map +1 -0
- package/dist/core.d.ts +2 -0
- package/dist/core.d.ts.map +1 -0
- package/dist/core.js +2 -0
- package/dist/core.js.map +1 -0
- package/dist/log.d.ts +8 -0
- package/dist/log.d.ts.map +1 -0
- package/dist/log.js +31 -0
- package/dist/log.js.map +1 -0
- package/dist/mod/discover.d.ts +4 -0
- package/dist/mod/discover.d.ts.map +1 -0
- package/dist/mod/discover.js +103 -0
- package/dist/mod/discover.js.map +1 -0
- package/dist/mod/examples/ticker/seed.d.ts +3 -0
- package/dist/mod/examples/ticker/seed.d.ts.map +1 -0
- package/dist/mod/examples/ticker/seed.js +16 -0
- package/dist/mod/examples/ticker/seed.js.map +1 -0
- package/dist/mod/examples/ticker/service.d.ts +2 -0
- package/dist/mod/examples/ticker/service.d.ts.map +1 -0
- package/dist/mod/examples/ticker/service.js +18 -0
- package/dist/mod/examples/ticker/service.js.map +1 -0
- package/dist/mod/examples/ticker/types.d.ts +16 -0
- package/dist/mod/examples/ticker/types.d.ts.map +1 -0
- package/dist/mod/examples/ticker/types.js +20 -0
- package/dist/mod/examples/ticker/types.js.map +1 -0
- package/dist/mod/examples/ticker/view.d.ts +2 -0
- package/dist/mod/examples/ticker/view.d.ts.map +1 -0
- package/dist/mod/examples/ticker/view.js +10 -0
- package/dist/mod/examples/ticker/view.js.map +1 -0
- package/dist/mod/index.d.ts +11 -0
- package/dist/mod/index.d.ts.map +1 -0
- package/dist/mod/index.js +8 -0
- package/dist/mod/index.js.map +1 -0
- package/dist/mod/loader.d.ts +18 -0
- package/dist/mod/loader.d.ts.map +1 -0
- package/dist/mod/loader.js +154 -0
- package/dist/mod/loader.js.map +1 -0
- package/dist/mod/optimistic.d.ts +34 -0
- package/dist/mod/optimistic.d.ts.map +1 -0
- package/dist/mod/optimistic.js +176 -0
- package/dist/mod/optimistic.js.map +1 -0
- package/dist/mod/prefab.d.ts +18 -0
- package/dist/mod/prefab.d.ts.map +1 -0
- package/dist/mod/prefab.js +42 -0
- package/dist/mod/prefab.js.map +1 -0
- package/dist/mod/tracking.d.ts +8 -0
- package/dist/mod/tracking.d.ts.map +1 -0
- package/dist/mod/tracking.js +44 -0
- package/dist/mod/tracking.js.map +1 -0
- package/dist/mod/types.d.ts +31 -0
- package/dist/mod/types.d.ts.map +1 -0
- package/dist/mod/types.js +5 -0
- package/dist/mod/types.js.map +1 -0
- package/dist/mod.d.ts +2 -0
- package/dist/mod.d.ts.map +1 -0
- package/dist/mod.js +2 -0
- package/dist/mod.js.map +1 -0
- package/dist/mods/autostart/server.d.ts +2 -0
- package/dist/mods/autostart/server.d.ts.map +1 -0
- package/dist/mods/autostart/server.js +2 -0
- package/dist/mods/autostart/server.js.map +1 -0
- package/dist/mods/autostart/service.d.ts +14 -0
- package/dist/mods/autostart/service.d.ts.map +1 -0
- package/dist/mods/autostart/service.js +88 -0
- package/dist/mods/autostart/service.js.map +1 -0
- package/dist/mods/llm/index.d.ts +13 -0
- package/dist/mods/llm/index.d.ts.map +1 -0
- package/dist/mods/llm/index.js +43 -0
- package/dist/mods/llm/index.js.map +1 -0
- package/dist/mods/llm/server.d.ts +2 -0
- package/dist/mods/llm/server.d.ts.map +1 -0
- package/dist/mods/llm/server.js +2 -0
- package/dist/mods/llm/server.js.map +1 -0
- package/dist/mods/mcp/server.d.ts +3 -0
- package/dist/mods/mcp/server.d.ts.map +1 -0
- package/dist/mods/mcp/server.js +3 -0
- package/dist/mods/mcp/server.js.map +1 -0
- package/dist/mods/mcp/service.d.ts +2 -0
- package/dist/mods/mcp/service.d.ts.map +1 -0
- package/dist/mods/mcp/service.js +17 -0
- package/dist/mods/mcp/service.js.map +1 -0
- package/dist/mods/mcp/types.d.ts +5 -0
- package/dist/mods/mcp/types.d.ts.map +1 -0
- package/dist/mods/mcp/types.js +7 -0
- package/dist/mods/mcp/types.js.map +1 -0
- package/dist/mods/treenity/agent-port.d.ts +2 -0
- package/dist/mods/treenity/agent-port.d.ts.map +1 -0
- package/dist/mods/treenity/agent-port.js +76 -0
- package/dist/mods/treenity/agent-port.js.map +1 -0
- package/dist/mods/treenity/groups.d.ts +2 -0
- package/dist/mods/treenity/groups.d.ts.map +1 -0
- package/dist/mods/treenity/groups.js +18 -0
- package/dist/mods/treenity/groups.js.map +1 -0
- package/dist/mods/treenity/mod-type.d.ts +2 -0
- package/dist/mods/treenity/mod-type.d.ts.map +1 -0
- package/dist/mods/treenity/mod-type.js +9 -0
- package/dist/mods/treenity/mod-type.js.map +1 -0
- package/dist/mods/treenity/seed.d.ts +2 -0
- package/dist/mods/treenity/seed.d.ts.map +1 -0
- package/dist/mods/treenity/seed.js +53 -0
- package/dist/mods/treenity/seed.js.map +1 -0
- package/dist/mods/treenity/server.d.ts +5 -0
- package/dist/mods/treenity/server.d.ts.map +1 -0
- package/dist/mods/treenity/server.js +5 -0
- package/dist/mods/treenity/server.js.map +1 -0
- package/dist/mods/treenity/system.d.ts +36 -0
- package/dist/mods/treenity/system.d.ts.map +1 -0
- package/dist/mods/treenity/system.js +61 -0
- package/dist/mods/treenity/system.js.map +1 -0
- package/dist/mods/uix/client.d.ts +3 -0
- package/dist/mods/uix/client.d.ts.map +1 -0
- package/dist/mods/uix/client.js +96 -0
- package/dist/mods/uix/client.js.map +1 -0
- package/dist/mods/uix/compile.d.ts +7 -0
- package/dist/mods/uix/compile.d.ts.map +1 -0
- package/dist/mods/uix/compile.js +94 -0
- package/dist/mods/uix/compile.js.map +1 -0
- package/dist/mods/uix/jsx-parser.d.ts +2 -0
- package/dist/mods/uix/jsx-parser.d.ts.map +1 -0
- package/dist/mods/uix/jsx-parser.js +565 -0
- package/dist/mods/uix/jsx-parser.js.map +1 -0
- package/dist/mods/uix/verify.d.ts +7 -0
- package/dist/mods/uix/verify.d.ts.map +1 -0
- package/dist/mods/uix/verify.js +59 -0
- package/dist/mods/uix/verify.js.map +1 -0
- package/dist/schema/catalog.d.ts +23 -0
- package/dist/schema/catalog.d.ts.map +1 -0
- package/dist/schema/catalog.js +82 -0
- package/dist/schema/catalog.js.map +1 -0
- package/dist/schema/extract-schemas.d.ts +5 -0
- package/dist/schema/extract-schemas.d.ts.map +1 -0
- package/dist/schema/extract-schemas.js +444 -0
- package/dist/schema/extract-schemas.js.map +1 -0
- package/dist/schema/load.d.ts +2 -0
- package/dist/schema/load.d.ts.map +1 -0
- package/dist/schema/load.js +23 -0
- package/dist/schema/load.js.map +1 -0
- package/dist/schema/test-fixture.types.d.ts +2 -0
- package/dist/schema/test-fixture.types.d.ts.map +1 -0
- package/dist/schema/test-fixture.types.js +19 -0
- package/dist/schema/test-fixture.types.js.map +1 -0
- package/dist/schema/test-opaque.d.ts +3 -0
- package/dist/schema/test-opaque.d.ts.map +1 -0
- package/dist/schema/test-opaque.js +43 -0
- package/dist/schema/test-opaque.js.map +1 -0
- package/dist/schema/types.d.ts +37 -0
- package/dist/schema/types.d.ts.map +1 -0
- package/dist/schema/types.js +3 -0
- package/dist/schema/types.js.map +1 -0
- package/dist/server/actions.d.ts +35 -0
- package/dist/server/actions.d.ts.map +1 -0
- package/dist/server/actions.js +170 -0
- package/dist/server/actions.js.map +1 -0
- package/dist/server/agent.d.ts +6 -0
- package/dist/server/agent.d.ts.map +1 -0
- package/dist/server/agent.js +15 -0
- package/dist/server/agent.js.map +1 -0
- package/dist/server/auth.d.ts +39 -0
- package/dist/server/auth.d.ts.map +1 -0
- package/dist/server/auth.js +335 -0
- package/dist/server/auth.js.map +1 -0
- package/dist/server/client.d.ts +183 -0
- package/dist/server/client.d.ts.map +1 -0
- package/dist/server/client.js +22 -0
- package/dist/server/client.js.map +1 -0
- package/dist/server/cookies.d.ts +5 -0
- package/dist/server/cookies.d.ts.map +1 -0
- package/dist/server/cookies.js +24 -0
- package/dist/server/cookies.js.map +1 -0
- package/dist/server/doc-index.d.ts +38 -0
- package/dist/server/doc-index.d.ts.map +1 -0
- package/dist/server/doc-index.js +244 -0
- package/dist/server/doc-index.js.map +1 -0
- package/dist/server/errors.d.ts +7 -0
- package/dist/server/errors.d.ts.map +1 -0
- package/dist/server/errors.js +11 -0
- package/dist/server/errors.js.map +1 -0
- package/dist/server/factory.d.ts +23 -0
- package/dist/server/factory.d.ts.map +1 -0
- package/dist/server/factory.js +70 -0
- package/dist/server/factory.js.map +1 -0
- package/dist/server/main.d.ts +6 -0
- package/dist/server/main.d.ts.map +1 -0
- package/dist/server/main.js +45 -0
- package/dist/server/main.js.map +1 -0
- package/dist/server/mcp.d.ts +5 -0
- package/dist/server/mcp.d.ts.map +1 -0
- package/dist/server/mcp.js +280 -0
- package/dist/server/mcp.js.map +1 -0
- package/dist/server/migrate.d.ts +3 -0
- package/dist/server/migrate.d.ts.map +1 -0
- package/dist/server/migrate.js +56 -0
- package/dist/server/migrate.js.map +1 -0
- package/dist/server/mod-catalog.d.ts +14 -0
- package/dist/server/mod-catalog.d.ts.map +1 -0
- package/dist/server/mod-catalog.js +40 -0
- package/dist/server/mod-catalog.js.map +1 -0
- package/dist/server/mods-mount.d.ts +4 -0
- package/dist/server/mods-mount.d.ts.map +1 -0
- package/dist/server/mods-mount.js +169 -0
- package/dist/server/mods-mount.js.map +1 -0
- package/dist/server/mount-adapters.d.ts +9 -0
- package/dist/server/mount-adapters.d.ts.map +1 -0
- package/dist/server/mount-adapters.js +75 -0
- package/dist/server/mount-adapters.js.map +1 -0
- package/dist/server/mount.d.ts +3 -0
- package/dist/server/mount.d.ts.map +1 -0
- package/dist/server/mount.js +195 -0
- package/dist/server/mount.js.map +1 -0
- package/dist/server/prefab.d.ts +18 -0
- package/dist/server/prefab.d.ts.map +1 -0
- package/dist/server/prefab.js +70 -0
- package/dist/server/prefab.js.map +1 -0
- package/dist/server/seed/index.d.ts +6 -0
- package/dist/server/seed/index.d.ts.map +1 -0
- package/dist/server/seed/index.js +16 -0
- package/dist/server/seed/index.js.map +1 -0
- package/dist/server/server.d.ts +28 -0
- package/dist/server/server.d.ts.map +1 -0
- package/dist/server/server.js +117 -0
- package/dist/server/server.js.map +1 -0
- package/dist/server/sub.d.ts +34 -0
- package/dist/server/sub.d.ts.map +1 -0
- package/dist/server/sub.js +174 -0
- package/dist/server/sub.js.map +1 -0
- package/dist/server/trpc.d.ts +192 -0
- package/dist/server/trpc.d.ts.map +1 -0
- package/dist/server/trpc.js +319 -0
- package/dist/server/trpc.js.map +1 -0
- package/dist/server/types-mount.d.ts +3 -0
- package/dist/server/types-mount.d.ts.map +1 -0
- package/dist/server/types-mount.js +144 -0
- package/dist/server/types-mount.js.map +1 -0
- package/dist/server/validate.d.ts +3 -0
- package/dist/server/validate.d.ts.map +1 -0
- package/dist/server/validate.js +20 -0
- package/dist/server/validate.js.map +1 -0
- package/dist/server/volatile.d.ts +11 -0
- package/dist/server/volatile.d.ts.map +1 -0
- package/dist/server/volatile.js +26 -0
- package/dist/server/volatile.js.map +1 -0
- package/dist/server/watch.d.ts +23 -0
- package/dist/server/watch.d.ts.map +1 -0
- package/dist/server/watch.js +178 -0
- package/dist/server/watch.js.map +1 -0
- package/dist/tree/cache.d.ts +3 -0
- package/dist/tree/cache.d.ts.map +1 -0
- package/dist/tree/cache.js +48 -0
- package/dist/tree/cache.js.map +1 -0
- package/dist/tree/fs.d.ts +3 -0
- package/dist/tree/fs.d.ts.map +1 -0
- package/dist/tree/fs.js +274 -0
- package/dist/tree/fs.js.map +1 -0
- package/dist/tree/index.d.ts +38 -0
- package/dist/tree/index.d.ts.map +1 -0
- package/dist/tree/index.js +182 -0
- package/dist/tree/index.js.map +1 -0
- package/dist/tree/inflight.d.ts +2 -0
- package/dist/tree/inflight.d.ts.map +1 -0
- package/dist/tree/inflight.js +15 -0
- package/dist/tree/inflight.js.map +1 -0
- package/dist/tree/json-codec.d.ts +2 -0
- package/dist/tree/json-codec.d.ts.map +1 -0
- package/dist/tree/json-codec.js +13 -0
- package/dist/tree/json-codec.js.map +1 -0
- package/dist/tree/mimefs.d.ts +13 -0
- package/dist/tree/mimefs.d.ts.map +1 -0
- package/dist/tree/mimefs.js +124 -0
- package/dist/tree/mimefs.js.map +1 -0
- package/dist/tree/mongo.d.ts +5 -0
- package/dist/tree/mongo.d.ts.map +1 -0
- package/dist/tree/mongo.js +110 -0
- package/dist/tree/mongo.js.map +1 -0
- package/dist/tree/patch.d.ts +30 -0
- package/dist/tree/patch.d.ts.map +1 -0
- package/dist/tree/patch.js +112 -0
- package/dist/tree/patch.js.map +1 -0
- package/dist/tree/query.d.ts +12 -0
- package/dist/tree/query.d.ts.map +1 -0
- package/dist/tree/query.js +61 -0
- package/dist/tree/query.js.map +1 -0
- package/dist/tree/repath.d.ts +3 -0
- package/dist/tree/repath.d.ts.map +1 -0
- package/dist/tree/repath.js +38 -0
- package/dist/tree/repath.js.map +1 -0
- package/dist/tree-chain.d.ts +18 -0
- package/dist/tree-chain.d.ts.map +1 -0
- package/dist/tree-chain.js +109 -0
- package/dist/tree-chain.js.map +1 -0
- package/dist/tree.d.ts +2 -0
- package/dist/tree.d.ts.map +1 -0
- package/dist/tree.js +2 -0
- package/dist/tree.js.map +1 -0
- package/dist/uri.d.ts +11 -0
- package/dist/uri.d.ts.map +1 -0
- package/dist/uri.js +79 -0
- package/dist/uri.js.map +1 -0
- package/package.json +39 -40
- package/src/chain.test.ts +190 -0
- package/src/chain.ts +82 -0
- package/src/client/client.test.ts +192 -0
- package/src/client/handle.ts +53 -0
- package/src/client/index.ts +18 -0
- package/src/client/trpc.ts +91 -0
- package/src/client.ts +1 -0
- package/src/comp/CLAUDE.md +14 -0
- package/src/comp/handle.ts +36 -0
- package/src/comp/index.test.ts +129 -0
- package/src/comp/index.ts +175 -0
- package/src/comp/needs.test.ts +499 -0
- package/src/comp/needs.ts +113 -0
- package/src/comp/validate.test.ts +304 -0
- package/src/comp/validate.ts +125 -0
- package/src/comp.ts +1 -0
- package/src/contexts/schema/index.ts +7 -0
- package/src/contexts/schema.ts +1 -0
- package/src/contexts/service/index.test.ts +323 -0
- package/src/contexts/service/index.ts +43 -0
- package/src/contexts/service.ts +1 -0
- package/src/contexts/telegram/index.ts +115 -0
- package/src/contexts/text/index.test.ts +31 -0
- package/src/contexts/text/index.ts +18 -0
- package/src/contexts/text.ts +1 -0
- package/src/core/component.ts +151 -0
- package/src/core/context.ts +14 -0
- package/src/core/index.test.ts +203 -0
- package/src/core/index.ts +9 -0
- package/src/core/path.ts +35 -0
- package/src/core/registry.ts +115 -0
- package/src/core.ts +1 -0
- package/src/log.test.ts +70 -0
- package/src/log.ts +28 -0
- package/src/mod/discover.test.ts +133 -0
- package/src/mod/discover.ts +100 -0
- package/src/mod/docs/00-index.md +19 -0
- package/src/mod/docs/01-primitives.md +38 -0
- package/src/mod/docs/02-core-api.md +68 -0
- package/src/mod/docs/03-registry.md +30 -0
- package/src/mod/docs/04-store.md +62 -0
- package/src/mod/docs/05-comp.md +111 -0
- package/src/mod/docs/06-actions.md +193 -0
- package/src/mod/docs/07-realtime.md +100 -0
- package/src/mod/docs/08-services.md +33 -0
- package/src/mod/docs/09-mounts.md +43 -0
- package/src/mod/docs/10-acl.md +60 -0
- package/src/mod/docs/11-server.md +62 -0
- package/src/mod/docs/12-conventions.md +65 -0
- package/src/mod/docs/13-example.md +132 -0
- package/src/mod/docs/14-mod-format.md +304 -0
- package/src/mod/docs/15-documenting-types.md +156 -0
- package/src/mod/examples/ticker/seed.ts +19 -0
- package/src/mod/examples/ticker/service.ts +20 -0
- package/src/mod/examples/ticker/ticker.test.ts +18 -0
- package/src/mod/examples/ticker/types.ts +22 -0
- package/src/mod/examples/ticker/view.tsx +19 -0
- package/src/mod/index.ts +12 -0
- package/src/mod/loader.test.ts +168 -0
- package/src/mod/loader.ts +174 -0
- package/src/mod/optimistic.test.ts +446 -0
- package/src/mod/optimistic.ts +210 -0
- package/src/mod/prefab.ts +62 -0
- package/src/mod/tracking.test.ts +59 -0
- package/src/mod/tracking.ts +51 -0
- package/src/mod/types.ts +40 -0
- package/src/mod.ts +1 -0
- package/src/mods/autostart/CLAUDE.md +6 -0
- package/src/mods/autostart/autostart.test.ts +85 -0
- package/src/mods/autostart/server.ts +1 -0
- package/src/mods/autostart/service.ts +98 -0
- package/src/mods/llm/CLAUDE.md +6 -0
- package/src/mods/llm/index.ts +57 -0
- package/src/mods/llm/llm.test.ts +109 -0
- package/src/mods/llm/server.ts +1 -0
- package/src/mods/mcp/CLAUDE.md +6 -0
- package/src/mods/mcp/server.ts +2 -0
- package/src/mods/mcp/service.ts +19 -0
- package/src/mods/mcp/types.ts +7 -0
- package/src/mods/treenity/agent-port.ts +93 -0
- package/src/mods/treenity/groups.ts +19 -0
- package/src/mods/treenity/mod-type.ts +10 -0
- package/src/mods/treenity/seed.ts +56 -0
- package/src/mods/treenity/server.ts +4 -0
- package/src/mods/treenity/system.ts +70 -0
- package/src/mods/uix/CLAUDE.md +7 -0
- package/src/mods/uix/client.ts +117 -0
- package/src/mods/uix/compile.test.ts +228 -0
- package/src/mods/uix/compile.ts +110 -0
- package/src/mods/uix/jsx-parser.test.ts +554 -0
- package/src/mods/uix/jsx-parser.ts +489 -0
- package/src/mods/uix/lazy-load.test.ts +261 -0
- package/src/mods/uix/uix-repomix.md +3509 -0
- package/src/mods/uix/verify.ts +68 -0
- package/src/schema/CLAUDE.md +13 -0
- package/src/schema/catalog.ts +101 -0
- package/src/schema/extract-schemas.test.ts +84 -0
- package/src/schema/extract-schemas.ts +462 -0
- package/src/schema/generated/autostart.json +44 -0
- package/src/schema/generated/board.column.json +25 -0
- package/src/schema/generated/board.task.json +147 -0
- package/src/schema/generated/brahman.action.back.json +12 -0
- package/src/schema/generated/brahman.action.broadcast.json +31 -0
- package/src/schema/generated/brahman.action.call.json +57 -0
- package/src/schema/generated/brahman.action.emittext.json +23 -0
- package/src/schema/generated/brahman.action.eval.json +23 -0
- package/src/schema/generated/brahman.action.file.json +28 -0
- package/src/schema/generated/brahman.action.forward.json +29 -0
- package/src/schema/generated/brahman.action.getvalue.json +28 -0
- package/src/schema/generated/brahman.action.ifelse.json +42 -0
- package/src/schema/generated/brahman.action.keywordselect.json +46 -0
- package/src/schema/generated/brahman.action.message.json +127 -0
- package/src/schema/generated/brahman.action.onerror.json +29 -0
- package/src/schema/generated/brahman.action.page.json +22 -0
- package/src/schema/generated/brahman.action.params.json +36 -0
- package/src/schema/generated/brahman.action.question.json +43 -0
- package/src/schema/generated/brahman.action.remove.json +12 -0
- package/src/schema/generated/brahman.action.resethistory.json +12 -0
- package/src/schema/generated/brahman.action.resetsession.json +12 -0
- package/src/schema/generated/brahman.action.selectlang.json +20 -0
- package/src/schema/generated/brahman.action.setvalue.json +27 -0
- package/src/schema/generated/brahman.action.tag.json +27 -0
- package/src/schema/generated/brahman.bot.json +68 -0
- package/src/schema/generated/brahman.page.json +25 -0
- package/src/schema/generated/brahman.session.json +29 -0
- package/src/schema/generated/brahman.user.json +58 -0
- package/src/schema/generated/cafe.contact.json +56 -0
- package/src/schema/generated/cafe.mail.json +29 -0
- package/src/schema/generated/default.json +15 -0
- package/src/schema/generated/doc.page.json +23 -0
- package/src/schema/generated/examples.demo.generator.json +16 -0
- package/src/schema/generated/examples.demo.sensor.json +35 -0
- package/src/schema/generated/groups.json +20 -0
- package/src/schema/generated/launcher.json +91 -0
- package/src/schema/generated/mcp.server.json +15 -0
- package/src/schema/generated/mindmap.map.json +22 -0
- package/src/schema/generated/sim.agent.json +24 -0
- package/src/schema/generated/sim.ai.json +24 -0
- package/src/schema/generated/sim.config.json +38 -0
- package/src/schema/generated/sim.descriptive.json +26 -0
- package/src/schema/generated/sim.events.json +47 -0
- package/src/schema/generated/sim.item.json +20 -0
- package/src/schema/generated/sim.memory.json +17 -0
- package/src/schema/generated/sim.nearby.json +17 -0
- package/src/schema/generated/sim.position.json +25 -0
- package/src/schema/generated/sim.round.json +64 -0
- package/src/schema/generated/sim.world.json +32 -0
- package/src/schema/generated/t.agent.port.json +74 -0
- package/src/schema/generated/t.llm.json +20 -0
- package/src/schema/generated/t.mod.json +27 -0
- package/src/schema/generated/t3d.animator.json +46 -0
- package/src/schema/generated/t3d.audio.json +58 -0
- package/src/schema/generated/t3d.camera.json +50 -0
- package/src/schema/generated/t3d.collider.json +84 -0
- package/src/schema/generated/t3d.light.json +90 -0
- package/src/schema/generated/t3d.line.json +47 -0
- package/src/schema/generated/t3d.lod.json +28 -0
- package/src/schema/generated/t3d.material.json +131 -0
- package/src/schema/generated/t3d.mesh.json +65 -0
- package/src/schema/generated/t3d.object.json +64 -0
- package/src/schema/generated/t3d.particles.json +109 -0
- package/src/schema/generated/t3d.rigidbody.json +81 -0
- package/src/schema/generated/t3d.scene.json +7 -0
- package/src/schema/generated/t3d.script.json +23 -0
- package/src/schema/generated/t3d.text.json +86 -0
- package/src/schema/generated/t3d.trail.json +45 -0
- package/src/schema/generated/task.json +96 -0
- package/src/schema/generated/test.fixture.json +43 -0
- package/src/schema/generated/ticker.config.json +43 -0
- package/src/schema/generated/ticker.price.json +20 -0
- package/src/schema/generated/todo.item.json +25 -0
- package/src/schema/generated/todo.list.json +33 -0
- package/src/schema/generated/treenity.system.json +259 -0
- package/src/schema/generated/whisper.audio.json +25 -0
- package/src/schema/generated/whisper.checklist.json +17 -0
- package/src/schema/generated/whisper.config.json +30 -0
- package/src/schema/generated/whisper.inbox.json +24 -0
- package/src/schema/generated/whisper.meta.json +35 -0
- package/src/schema/generated/whisper.text.json +16 -0
- package/src/schema/load.ts +24 -0
- package/src/schema/schema.test.ts +86 -0
- package/src/schema/test-fixture.types.ts +21 -0
- package/src/schema/test-opaque.ts +42 -0
- package/src/schema/types.ts +33 -0
- package/src/server/CLAUDE.md +26 -0
- package/src/server/actions.test.ts +272 -0
- package/src/server/actions.ts +274 -0
- package/src/server/agent-sub.test.ts +90 -0
- package/src/server/agent.test.ts +305 -0
- package/src/server/agent.ts +17 -0
- package/src/server/api.test.ts +454 -0
- package/src/server/auth.test.ts +441 -0
- package/src/server/auth.ts +386 -0
- package/src/server/client.ts +24 -0
- package/src/server/conditions.test.ts +128 -0
- package/src/server/cookies.ts +25 -0
- package/src/server/coverage.test.ts +827 -0
- package/src/server/doc-index.ts +286 -0
- package/src/server/e2e.test.ts +966 -0
- package/src/server/errors.ts +11 -0
- package/src/server/factory.ts +99 -0
- package/src/server/main.ts +56 -0
- package/src/server/mcp.ts +326 -0
- package/src/server/migrate.test.ts +123 -0
- package/src/server/migrate.ts +62 -0
- package/src/server/mod-catalog.ts +59 -0
- package/src/server/mods-mount.ts +179 -0
- package/src/server/mount-adapters.ts +82 -0
- package/src/server/mount.parametrized.test.ts +52 -0
- package/src/server/mount.query.test.ts +127 -0
- package/src/server/mount.test.ts +497 -0
- package/src/server/mount.ts +208 -0
- package/src/server/prefab.test.ts +415 -0
- package/src/server/prefab.ts +104 -0
- package/src/server/seed/index.ts +24 -0
- package/src/server/server.ts +153 -0
- package/src/server/stress.test.ts +844 -0
- package/src/server/sub.test.ts +55 -0
- package/src/server/sub.ts +224 -0
- package/src/server/trpc.ts +369 -0
- package/src/server/types-mount.ts +142 -0
- package/src/server/validate.test.ts +91 -0
- package/src/server/validate.ts +22 -0
- package/src/server/volatile.test.ts +140 -0
- package/src/server/volatile.ts +32 -0
- package/src/server/watch.test.ts +594 -0
- package/src/server/watch.ts +202 -0
- package/src/server/workflow.test.ts +82 -0
- package/src/tree/CLAUDE.md +13 -0
- package/src/tree/cache.test.ts +213 -0
- package/src/tree/cache.ts +51 -0
- package/src/tree/fs.test.ts +247 -0
- package/src/tree/fs.ts +251 -0
- package/src/tree/index.test.ts +164 -0
- package/src/tree/index.ts +216 -0
- package/src/tree/inflight.ts +15 -0
- package/src/tree/json-codec.ts +16 -0
- package/src/tree/mimefs.test.ts +289 -0
- package/src/tree/mimefs.ts +142 -0
- package/src/tree/mongo.ts +125 -0
- package/src/tree/patch.test.ts +192 -0
- package/src/tree/patch.ts +133 -0
- package/src/tree/query.test.ts +110 -0
- package/src/tree/query.ts +70 -0
- package/src/tree/repath.test.ts +86 -0
- package/src/tree/repath.ts +53 -0
- package/src/tree-chain.test.ts +723 -0
- package/src/tree-chain.ts +144 -0
- package/src/tree.ts +1 -0
- package/src/uri.test.ts +86 -0
- package/src/uri.ts +82 -0
- package/CHANGELOG.md +0 -305
- package/README.md +0 -18
- package/dist/context.d.ts +0 -41
- package/dist/context.d.ts.map +0 -1
- package/dist/context.mjs +0 -81
- package/dist/context.mjs.map +0 -1
- package/dist/contexts/node-engine.d.ts +0 -12
- package/dist/contexts/node-engine.d.ts.map +0 -1
- package/dist/contexts/node-engine.mjs +0 -7
- package/dist/contexts/node-engine.mjs.map +0 -1
- package/dist/contexts/noflo/types.d.ts +0 -20
- package/dist/contexts/noflo/types.d.ts.map +0 -1
- package/dist/contexts/object.d.ts +0 -11
- package/dist/contexts/object.d.ts.map +0 -1
- package/dist/contexts/object.mjs +0 -15
- package/dist/contexts/object.mjs.map +0 -1
- package/dist/contexts/proto.d.ts +0 -11
- package/dist/contexts/proto.d.ts.map +0 -1
- package/dist/contexts/proto.mjs +0 -7
- package/dist/contexts/proto.mjs.map +0 -1
- package/dist/contexts/react-context.d.ts +0 -21
- package/dist/contexts/react-context.d.ts.map +0 -1
- package/dist/contexts/react-context.mjs +0 -24
- package/dist/contexts/react-context.mjs.map +0 -1
- package/dist/contexts/service.mjs +0 -7
- package/dist/contexts/service.mjs.map +0 -1
- package/dist/get-type-cache.d.ts +0 -2
- package/dist/get-type-cache.d.ts.map +0 -1
- package/dist/get-type-cache.mjs +0 -7
- package/dist/get-type-cache.mjs.map +0 -1
- package/dist/index.d.ts +0 -13
- package/dist/index.d.ts.map +0 -1
- package/dist/index.mjs +0 -10
- package/dist/index.mjs.map +0 -1
- package/dist/link/link.d.ts +0 -25
- package/dist/link/link.d.ts.map +0 -1
- package/dist/link/link.mjs +0 -72
- package/dist/link/link.mjs.map +0 -1
- package/dist/link/link.test.d.ts +0 -2
- package/dist/link/link.test.d.ts.map +0 -1
- package/dist/loading.d.ts +0 -9
- package/dist/loading.d.ts.map +0 -1
- package/dist/meta-type.d.ts +0 -58
- package/dist/meta-type.d.ts.map +0 -1
- package/dist/meta-type.mjs +0 -104
- package/dist/meta-type.mjs.map +0 -1
- package/dist/meta.d.ts +0 -20
- package/dist/meta.d.ts.map +0 -1
- package/dist/meta.mjs +0 -16
- package/dist/meta.mjs.map +0 -1
- package/dist/node/index.d.ts +0 -2
- package/dist/node/index.d.ts.map +0 -1
- package/dist/node/types.d.ts +0 -37
- package/dist/node/types.d.ts.map +0 -1
- package/dist/test/context.test.d.ts +0 -2
- package/dist/test/context.test.d.ts.map +0 -1
- package/dist/types.d.ts +0 -14
- package/dist/types.d.ts.map +0 -1
- package/dist/types.mjs +0 -16
- package/dist/types.mjs.map +0 -1
|
@@ -0,0 +1,3509 @@
|
|
|
1
|
+
This file is a merged representation of the entire codebase, combined into a single document by Repomix.
|
|
2
|
+
|
|
3
|
+
<file_summary>
|
|
4
|
+
This section contains a summary of this file.
|
|
5
|
+
|
|
6
|
+
<purpose>
|
|
7
|
+
This file contains a packed representation of the entire repository's contents.
|
|
8
|
+
It is designed to be easily consumable by AI systems for analysis, code review,
|
|
9
|
+
or other automated processes.
|
|
10
|
+
</purpose>
|
|
11
|
+
|
|
12
|
+
<file_format>
|
|
13
|
+
The content is organized as follows:
|
|
14
|
+
1. This summary section
|
|
15
|
+
2. Repository information
|
|
16
|
+
3. Directory structure
|
|
17
|
+
4. Repository files (if enabled)
|
|
18
|
+
5. Multiple file entries, each consisting of:
|
|
19
|
+
- File path as an attribute
|
|
20
|
+
- Full contents of the file
|
|
21
|
+
</file_format>
|
|
22
|
+
|
|
23
|
+
<usage_guidelines>
|
|
24
|
+
- This file should be treated as read-only. Any changes should be made to the
|
|
25
|
+
original repository files, not this packed version.
|
|
26
|
+
- When processing this file, use the file path to distinguish
|
|
27
|
+
between different files in the repository.
|
|
28
|
+
- Be aware that this file may contain sensitive information. Handle it with
|
|
29
|
+
the same level of security as you would the original repository.
|
|
30
|
+
</usage_guidelines>
|
|
31
|
+
|
|
32
|
+
<notes>
|
|
33
|
+
- Some files may have been excluded based on .gitignore rules and Repomix's configuration
|
|
34
|
+
- Binary files are not included in this packed representation. Please refer to the Repository Structure section for a complete list of file paths, including binary files
|
|
35
|
+
- Files matching patterns in .gitignore are excluded
|
|
36
|
+
- Files matching default ignore patterns are excluded
|
|
37
|
+
- Files are sorted by Git change count (files with more changes are at the bottom)
|
|
38
|
+
</notes>
|
|
39
|
+
|
|
40
|
+
</file_summary>
|
|
41
|
+
|
|
42
|
+
<directory_structure>
|
|
43
|
+
src/
|
|
44
|
+
components/
|
|
45
|
+
ErrorBoundary.tsx
|
|
46
|
+
ShowAfterTimeout.tsx
|
|
47
|
+
context/
|
|
48
|
+
RenderContext.tsx
|
|
49
|
+
form/
|
|
50
|
+
exmapleSchemas/
|
|
51
|
+
apply.method.json
|
|
52
|
+
array-schema.method.json
|
|
53
|
+
delete.method.json
|
|
54
|
+
oneOf.json
|
|
55
|
+
globalProperties/
|
|
56
|
+
align.json
|
|
57
|
+
case.json
|
|
58
|
+
fontWeight.json
|
|
59
|
+
margin.json
|
|
60
|
+
transformTranslate.json
|
|
61
|
+
tools/
|
|
62
|
+
generateComponentUrl.ts
|
|
63
|
+
generatePath.ts
|
|
64
|
+
getDefaultValue.tsx
|
|
65
|
+
getFormSize.tsx
|
|
66
|
+
index.ts
|
|
67
|
+
mapRange.ts
|
|
68
|
+
useFieldValue.ts
|
|
69
|
+
context.tsx
|
|
70
|
+
formItem.tsx
|
|
71
|
+
index.tsx
|
|
72
|
+
parser.tsx
|
|
73
|
+
ref.tsx
|
|
74
|
+
types.ts
|
|
75
|
+
hooks/
|
|
76
|
+
use-save-shortcut.tsx
|
|
77
|
+
useImmer.ts
|
|
78
|
+
useInputState.ts
|
|
79
|
+
useStorage.ts
|
|
80
|
+
useSwrSync.ts
|
|
81
|
+
useToggle.ts
|
|
82
|
+
make-icon/
|
|
83
|
+
icomoon-gen.mjs
|
|
84
|
+
icomoon.css
|
|
85
|
+
Icon.tsx
|
|
86
|
+
index.tsx
|
|
87
|
+
types.ts
|
|
88
|
+
with-tooltip.tsx
|
|
89
|
+
render/
|
|
90
|
+
Render.tsx
|
|
91
|
+
store/
|
|
92
|
+
create-loader-store.ts
|
|
93
|
+
create-store.ts
|
|
94
|
+
loading.ts
|
|
95
|
+
theme/
|
|
96
|
+
provider/
|
|
97
|
+
emotion.d.ts
|
|
98
|
+
theme-entity.ts
|
|
99
|
+
ThemeProvider.tsx
|
|
100
|
+
types.ts
|
|
101
|
+
use-token.ts
|
|
102
|
+
additional-tokens.ts
|
|
103
|
+
index.ts
|
|
104
|
+
types.ts
|
|
105
|
+
txt/
|
|
106
|
+
react/
|
|
107
|
+
layout.jsx
|
|
108
|
+
utils/
|
|
109
|
+
portal/
|
|
110
|
+
index.tsx
|
|
111
|
+
types.ts
|
|
112
|
+
emotion-omit-props.ts
|
|
113
|
+
image.ts
|
|
114
|
+
normalizeComponentSize.tsx
|
|
115
|
+
context.ts
|
|
116
|
+
form.ts
|
|
117
|
+
hooks.ts
|
|
118
|
+
index.ts
|
|
119
|
+
store.ts
|
|
120
|
+
theme.ts
|
|
121
|
+
utils.ts
|
|
122
|
+
test/
|
|
123
|
+
code/
|
|
124
|
+
uix-export.jsx
|
|
125
|
+
react/
|
|
126
|
+
default.jsx
|
|
127
|
+
uix-require.jsx
|
|
128
|
+
.npmignore
|
|
129
|
+
CHANGELOG.md
|
|
130
|
+
emotion.d.ts
|
|
131
|
+
global.d.ts
|
|
132
|
+
package.json
|
|
133
|
+
rollup.config.mjs
|
|
134
|
+
tsconfig.json
|
|
135
|
+
</directory_structure>
|
|
136
|
+
|
|
137
|
+
<files>
|
|
138
|
+
This section contains the contents of the repository's files.
|
|
139
|
+
|
|
140
|
+
<file path="src/components/ErrorBoundary.tsx">
|
|
141
|
+
import React from 'react';
|
|
142
|
+
|
|
143
|
+
export class ErrorBoundary extends React.Component<any, { error?: Error }> {
|
|
144
|
+
constructor(props: any) {
|
|
145
|
+
super(props);
|
|
146
|
+
this.state = { error: undefined };
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
static getDerivedStateFromError(error: any) {
|
|
150
|
+
// Update state so the next render will show the fallback UI.
|
|
151
|
+
return { error };
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
componentDidUpdate(prevProps: any) {
|
|
155
|
+
if (prevProps.children.props?.id !== this.props.children?.props?.id) {
|
|
156
|
+
this.setState({ error: undefined });
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
componentDidCatch(error: Error, errorInfo: any) {
|
|
161
|
+
// You can also log the error to an error reporting service
|
|
162
|
+
// logErrorToMyService(error, errorInfo);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
render() {
|
|
166
|
+
const { error } = this.state;
|
|
167
|
+
// useEffect(() => {
|
|
168
|
+
// if (error) console.error('ErrorBoundary', error);
|
|
169
|
+
// }, [error]);
|
|
170
|
+
if (error) {
|
|
171
|
+
console.error('ErrorBoundary', error.stack);
|
|
172
|
+
// You can render any custom fallback UI
|
|
173
|
+
|
|
174
|
+
return (
|
|
175
|
+
<div className="error-wrapper">
|
|
176
|
+
<div className="error-button">
|
|
177
|
+
<span className="error-text">Error</span>
|
|
178
|
+
<span className="error-button-text">?</span>
|
|
179
|
+
<pre className="card error error-full-text">{error.stack}</pre>
|
|
180
|
+
</div>
|
|
181
|
+
</div>
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
return this.props.children;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
</file>
|
|
189
|
+
|
|
190
|
+
<file path="src/components/ShowAfterTimeout.tsx">
|
|
191
|
+
import { FC, PropsWithChildren, useLayoutEffect, useState } from 'react';
|
|
192
|
+
|
|
193
|
+
function useLoadingTimeout(ms: number): boolean {
|
|
194
|
+
const [loading, setLoading] = useState(false);
|
|
195
|
+
useLayoutEffect(() => {
|
|
196
|
+
const id = setTimeout(() => {
|
|
197
|
+
setLoading(true);
|
|
198
|
+
}, ms);
|
|
199
|
+
return () => clearTimeout(id);
|
|
200
|
+
}, []);
|
|
201
|
+
|
|
202
|
+
return loading;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export const ShowAfterTimeout: FC<PropsWithChildren & { timeout: number }> = ({
|
|
206
|
+
children,
|
|
207
|
+
timeout,
|
|
208
|
+
}) => {
|
|
209
|
+
const showChild = useLoadingTimeout(timeout);
|
|
210
|
+
return showChild ? children : null;
|
|
211
|
+
};
|
|
212
|
+
</file>
|
|
213
|
+
|
|
214
|
+
<file path="src/context/RenderContext.tsx">
|
|
215
|
+
import { createContext, ReactNode, useContext } from 'react';
|
|
216
|
+
|
|
217
|
+
const RENDER_CONTEXT = {
|
|
218
|
+
DEFAULT: '',
|
|
219
|
+
EDIT: 'edit',
|
|
220
|
+
RENDER: 'render',
|
|
221
|
+
WIDGET: 'widget',
|
|
222
|
+
FORM: 'form',
|
|
223
|
+
} as const;
|
|
224
|
+
|
|
225
|
+
type RenderContextType = (typeof RENDER_CONTEXT)[keyof typeof RENDER_CONTEXT];
|
|
226
|
+
|
|
227
|
+
const RenderContext = createContext<RenderContextType>(RENDER_CONTEXT.DEFAULT);
|
|
228
|
+
|
|
229
|
+
const RenderContextProvider: React.FC<{ children: ReactNode; value: RenderContextType }> = ({
|
|
230
|
+
children,
|
|
231
|
+
value,
|
|
232
|
+
}) => {
|
|
233
|
+
return <RenderContext.Provider value={value}>{children}</RenderContext.Provider>;
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
const useRenderContext = (): string => {
|
|
237
|
+
const context = useContext(RenderContext);
|
|
238
|
+
|
|
239
|
+
// TODO: should we throw an error if the context is not set? or just use default context.
|
|
240
|
+
// if (!context) {
|
|
241
|
+
// throw new Error(`useRenderContext must be used within an RenderProvider`);
|
|
242
|
+
// }
|
|
243
|
+
|
|
244
|
+
return context;
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
export { RENDER_CONTEXT, RenderContextProvider, useRenderContext };
|
|
248
|
+
export type { RenderContextType };
|
|
249
|
+
</file>
|
|
250
|
+
|
|
251
|
+
<file path="src/form/exmapleSchemas/apply.method.json">
|
|
252
|
+
{
|
|
253
|
+
"$id": "https://treenity.pro/schemas/schema.json",
|
|
254
|
+
"title": "k8s.method.apply",
|
|
255
|
+
"description": "k8s Service Apply method",
|
|
256
|
+
"type": "object",
|
|
257
|
+
"required": [
|
|
258
|
+
"in"
|
|
259
|
+
],
|
|
260
|
+
"properties": {
|
|
261
|
+
"in": {
|
|
262
|
+
"type": "object",
|
|
263
|
+
"required": [
|
|
264
|
+
"items"
|
|
265
|
+
],
|
|
266
|
+
"properties": {
|
|
267
|
+
"testBoolean": {
|
|
268
|
+
"type": "boolean"
|
|
269
|
+
},
|
|
270
|
+
"testComponent": {
|
|
271
|
+
"$ref": "/schemas/ui/text/default"
|
|
272
|
+
},
|
|
273
|
+
"test1": {
|
|
274
|
+
"$ref": "#/$defs/friend"
|
|
275
|
+
},
|
|
276
|
+
"test3": {
|
|
277
|
+
"$ref": "http://localhost:5173/static/delete.method.json"
|
|
278
|
+
},
|
|
279
|
+
"items": {
|
|
280
|
+
"type": "array",
|
|
281
|
+
"items": {
|
|
282
|
+
"type": "object",
|
|
283
|
+
"required": [
|
|
284
|
+
"group",
|
|
285
|
+
"format",
|
|
286
|
+
"content"
|
|
287
|
+
],
|
|
288
|
+
"properties": {
|
|
289
|
+
"group": {
|
|
290
|
+
"title": "Группа",
|
|
291
|
+
"type": "string"
|
|
292
|
+
},
|
|
293
|
+
"format": {
|
|
294
|
+
"type": "string"
|
|
295
|
+
},
|
|
296
|
+
"content": {
|
|
297
|
+
"type": "string"
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
},
|
|
305
|
+
"$defs": {
|
|
306
|
+
"friend": {
|
|
307
|
+
"type": "object",
|
|
308
|
+
"properties": {
|
|
309
|
+
"name": {
|
|
310
|
+
"title": "Friend string",
|
|
311
|
+
"type": "string"
|
|
312
|
+
},
|
|
313
|
+
"friends": {
|
|
314
|
+
"type": "array",
|
|
315
|
+
"items": {
|
|
316
|
+
"$ref": "#/$defs/friend"
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
</file>
|
|
324
|
+
|
|
325
|
+
<file path="src/form/exmapleSchemas/array-schema.method.json">
|
|
326
|
+
{
|
|
327
|
+
"$id": "https://treenity.pro/schemas/schema.json",
|
|
328
|
+
"title": "k8s.method.apply",
|
|
329
|
+
"description": "k8s Service Apply method",
|
|
330
|
+
"type": "object",
|
|
331
|
+
"required": [
|
|
332
|
+
"in"
|
|
333
|
+
],
|
|
334
|
+
"properties": {
|
|
335
|
+
"in": {
|
|
336
|
+
"type": "object",
|
|
337
|
+
"required": [
|
|
338
|
+
"items"
|
|
339
|
+
],
|
|
340
|
+
"properties": {
|
|
341
|
+
"items": {
|
|
342
|
+
"type": "array",
|
|
343
|
+
"items": {
|
|
344
|
+
"type": "object",
|
|
345
|
+
"required": [
|
|
346
|
+
"group",
|
|
347
|
+
"format",
|
|
348
|
+
"content"
|
|
349
|
+
],
|
|
350
|
+
"properties": {
|
|
351
|
+
"group": {
|
|
352
|
+
"title": "Группа",
|
|
353
|
+
"type": "string"
|
|
354
|
+
},
|
|
355
|
+
"format": {
|
|
356
|
+
"type": "string"
|
|
357
|
+
},
|
|
358
|
+
"content": {
|
|
359
|
+
"type": "string"
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
</file>
|
|
369
|
+
|
|
370
|
+
<file path="src/form/exmapleSchemas/delete.method.json">
|
|
371
|
+
{
|
|
372
|
+
"$id": "http://example.com/schemas/defs.json",
|
|
373
|
+
"title": "k8s.method.delete",
|
|
374
|
+
"description": "k8s Service Delete method",
|
|
375
|
+
"type": "object",
|
|
376
|
+
"required": [
|
|
377
|
+
"in",
|
|
378
|
+
"out"
|
|
379
|
+
],
|
|
380
|
+
"properties": {
|
|
381
|
+
"in": {
|
|
382
|
+
"description": "",
|
|
383
|
+
"type": "object",
|
|
384
|
+
"required": [
|
|
385
|
+
"group"
|
|
386
|
+
],
|
|
387
|
+
"properties": {
|
|
388
|
+
"items": {
|
|
389
|
+
"type": "object",
|
|
390
|
+
"required": [
|
|
391
|
+
"group"
|
|
392
|
+
],
|
|
393
|
+
"properties": {
|
|
394
|
+
"group": {
|
|
395
|
+
"type": "string"
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
},
|
|
401
|
+
"out": {
|
|
402
|
+
"description": "",
|
|
403
|
+
"type": "object",
|
|
404
|
+
"properties": {
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
</file>
|
|
410
|
+
|
|
411
|
+
<file path="src/form/exmapleSchemas/oneOf.json">
|
|
412
|
+
{
|
|
413
|
+
"title": "Schema dependencies",
|
|
414
|
+
"description": "These samples are best viewed without live validation.",
|
|
415
|
+
"type": "object",
|
|
416
|
+
"required": ["first"],
|
|
417
|
+
"properties": {
|
|
418
|
+
"first": {
|
|
419
|
+
"title": "First",
|
|
420
|
+
"type": "string",
|
|
421
|
+
"default": "Test field"
|
|
422
|
+
},
|
|
423
|
+
"conditional": {
|
|
424
|
+
"title": "Conditional",
|
|
425
|
+
"$ref": "#/definitions/person"
|
|
426
|
+
}
|
|
427
|
+
},
|
|
428
|
+
"definitions": {
|
|
429
|
+
"person": {
|
|
430
|
+
"title": "Person",
|
|
431
|
+
"type": "object",
|
|
432
|
+
"properties": {
|
|
433
|
+
"Do you have any pets?": {
|
|
434
|
+
"type": "string",
|
|
435
|
+
"enum": ["No", "Yes: One", "Yes: More than one"],
|
|
436
|
+
"default": "No",
|
|
437
|
+
"widget": "react.antd.select"
|
|
438
|
+
}
|
|
439
|
+
},
|
|
440
|
+
"required": ["Do you have any pets?"],
|
|
441
|
+
"dependencies": {
|
|
442
|
+
"Do you have any pets?": {
|
|
443
|
+
"oneOf": [
|
|
444
|
+
{
|
|
445
|
+
"properties": {
|
|
446
|
+
"Do you have any pets?": {
|
|
447
|
+
"enum": ["No"]
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
},
|
|
451
|
+
{
|
|
452
|
+
"properties": {
|
|
453
|
+
"Do you have any pets?": {
|
|
454
|
+
"enum": ["Yes: One"]
|
|
455
|
+
},
|
|
456
|
+
"What kind of?": {
|
|
457
|
+
"type": "string",
|
|
458
|
+
"enum": ["Cat", "Dog"]
|
|
459
|
+
},
|
|
460
|
+
"How old is your pet?": {
|
|
461
|
+
"type": "number"
|
|
462
|
+
}
|
|
463
|
+
},
|
|
464
|
+
"required": ["How old is your pet?"]
|
|
465
|
+
},
|
|
466
|
+
{
|
|
467
|
+
"properties": {
|
|
468
|
+
"Do you have any pets?": {
|
|
469
|
+
"enum": ["Yes: More than one"]
|
|
470
|
+
},
|
|
471
|
+
"Do you want to get rid of any?": {
|
|
472
|
+
"type": "boolean"
|
|
473
|
+
}
|
|
474
|
+
},
|
|
475
|
+
"required": ["Do you want to get rid of any?"]
|
|
476
|
+
}
|
|
477
|
+
]
|
|
478
|
+
},
|
|
479
|
+
"Do you want to get rid of any?": {
|
|
480
|
+
"oneOf": [
|
|
481
|
+
{
|
|
482
|
+
"properties": {
|
|
483
|
+
"Do you want to get rid of any?": {
|
|
484
|
+
"enum": [true]
|
|
485
|
+
},
|
|
486
|
+
"How many?": {
|
|
487
|
+
"type": "number"
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
]
|
|
492
|
+
},
|
|
493
|
+
"How old is your pet?": {
|
|
494
|
+
"oneOf": [
|
|
495
|
+
{
|
|
496
|
+
"properties": {
|
|
497
|
+
"How old is your pet?": {
|
|
498
|
+
"enum": [14, 15, 16, 17, 18, 19, 20]
|
|
499
|
+
},
|
|
500
|
+
"Wow, so long": {
|
|
501
|
+
"type": "number"
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
]
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
</file>
|
|
512
|
+
|
|
513
|
+
<file path="src/form/globalProperties/align.json">
|
|
514
|
+
{
|
|
515
|
+
"textAlign": {
|
|
516
|
+
"title": "Text align",
|
|
517
|
+
"type": "string",
|
|
518
|
+
"default": "left",
|
|
519
|
+
"enum": [
|
|
520
|
+
{
|
|
521
|
+
"icon": "align-left_outlined",
|
|
522
|
+
"value": "left"
|
|
523
|
+
}, {
|
|
524
|
+
"icon": "align-center_outlined",
|
|
525
|
+
"value": "center"
|
|
526
|
+
}, {
|
|
527
|
+
"icon": "align-right_outlined",
|
|
528
|
+
"value": "right"
|
|
529
|
+
}, {
|
|
530
|
+
"icon": "align-justify_outlined",
|
|
531
|
+
"value": "justify"
|
|
532
|
+
}
|
|
533
|
+
],
|
|
534
|
+
"widget": "react.antd.radio-button"
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
</file>
|
|
538
|
+
|
|
539
|
+
<file path="src/form/globalProperties/case.json">
|
|
540
|
+
{
|
|
541
|
+
"case": {
|
|
542
|
+
"title": "Case",
|
|
543
|
+
"type": "string",
|
|
544
|
+
"default": "none",
|
|
545
|
+
"enum": [{
|
|
546
|
+
"label": "-",
|
|
547
|
+
"value": "none"
|
|
548
|
+
},{
|
|
549
|
+
"label":"Ab",
|
|
550
|
+
"value": "capitalize"
|
|
551
|
+
},{
|
|
552
|
+
"label":"AB",
|
|
553
|
+
"value": "uppercase"
|
|
554
|
+
},{
|
|
555
|
+
"label": "ab",
|
|
556
|
+
"value": "lowercase"
|
|
557
|
+
}],
|
|
558
|
+
"widget": "react.antd.radio-button"
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
</file>
|
|
562
|
+
|
|
563
|
+
<file path="src/form/globalProperties/fontWeight.json">
|
|
564
|
+
{
|
|
565
|
+
"fontWeight": {
|
|
566
|
+
"title": "Font weight",
|
|
567
|
+
"type": "number",
|
|
568
|
+
"default": 400,
|
|
569
|
+
"enum": [{
|
|
570
|
+
"label": "100 - Thin",
|
|
571
|
+
"value": 100
|
|
572
|
+
},{
|
|
573
|
+
"label":"200 - Extra Light",
|
|
574
|
+
"value": 200
|
|
575
|
+
},{
|
|
576
|
+
"label":"300 - Light",
|
|
577
|
+
"value": 300
|
|
578
|
+
},{
|
|
579
|
+
"label": "400 - Normal",
|
|
580
|
+
"value": 400
|
|
581
|
+
},{
|
|
582
|
+
"label": "500 - Medium",
|
|
583
|
+
"value": 500
|
|
584
|
+
},{
|
|
585
|
+
"label": "600 - Semi Bold",
|
|
586
|
+
"value": 600
|
|
587
|
+
},{
|
|
588
|
+
"label": "700 - Bold",
|
|
589
|
+
"value": 700
|
|
590
|
+
},{
|
|
591
|
+
"label": "800 - Extra Bold",
|
|
592
|
+
"value": 800
|
|
593
|
+
},{
|
|
594
|
+
"label": "900 - Black",
|
|
595
|
+
"value": 900
|
|
596
|
+
}],
|
|
597
|
+
"widget": "react.antd.select"
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
</file>
|
|
601
|
+
|
|
602
|
+
<file path="src/form/globalProperties/margin.json">
|
|
603
|
+
{
|
|
604
|
+
"margin": {
|
|
605
|
+
"type": "string",
|
|
606
|
+
"minimum": 0,
|
|
607
|
+
"length": 4,
|
|
608
|
+
"subtitle": "Margin",
|
|
609
|
+
"widget": "css.full-custom-size"
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
</file>
|
|
613
|
+
|
|
614
|
+
<file path="src/form/globalProperties/transformTranslate.json">
|
|
615
|
+
{
|
|
616
|
+
"transformTranslate": {
|
|
617
|
+
"type": "string",
|
|
618
|
+
"title": null,
|
|
619
|
+
"min": 0,
|
|
620
|
+
"length": 2,
|
|
621
|
+
"subtitle": "Transform translate",
|
|
622
|
+
"widget": "css.full-custom-size"
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
</file>
|
|
626
|
+
|
|
627
|
+
<file path="src/form/tools/generateComponentUrl.ts">
|
|
628
|
+
const getComponentUrl = (refUrl: string) => {
|
|
629
|
+
if (refUrl.startsWith('/schemas/')) {
|
|
630
|
+
return refUrl?.slice(9).replaceAll('/', '.');
|
|
631
|
+
}
|
|
632
|
+
return refUrl;
|
|
633
|
+
};
|
|
634
|
+
|
|
635
|
+
export default getComponentUrl;
|
|
636
|
+
</file>
|
|
637
|
+
|
|
638
|
+
<file path="src/form/tools/generatePath.ts">
|
|
639
|
+
const generatePath = (path: string[], key?: string): string[] => {
|
|
640
|
+
if (!key) {
|
|
641
|
+
return path;
|
|
642
|
+
}
|
|
643
|
+
return path.concat(key);
|
|
644
|
+
};
|
|
645
|
+
|
|
646
|
+
export default generatePath;
|
|
647
|
+
</file>
|
|
648
|
+
|
|
649
|
+
<file path="src/form/tools/getDefaultValue.tsx">
|
|
650
|
+
export type ItemType = 'string' | 'number' | 'boolean' | 'array' | 'object' | 'ref';
|
|
651
|
+
|
|
652
|
+
export default function getDefaultValue(type: ItemType, value: any) {
|
|
653
|
+
if (value) {
|
|
654
|
+
return value;
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
switch (type) {
|
|
658
|
+
case 'string':
|
|
659
|
+
return '';
|
|
660
|
+
case 'number':
|
|
661
|
+
return 0;
|
|
662
|
+
case 'boolean':
|
|
663
|
+
return false;
|
|
664
|
+
case 'array':
|
|
665
|
+
return [];
|
|
666
|
+
case 'object':
|
|
667
|
+
return {};
|
|
668
|
+
case 'ref':
|
|
669
|
+
return {};
|
|
670
|
+
default:
|
|
671
|
+
return {};
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
</file>
|
|
675
|
+
|
|
676
|
+
<file path="src/form/tools/getFormSize.tsx">
|
|
677
|
+
import { SizeType } from 'antd/es/config-provider/SizeContext';
|
|
678
|
+
import { TSizeForm } from '../types';
|
|
679
|
+
|
|
680
|
+
const defaultSize: Record<TSizeForm, SizeType | undefined> = {
|
|
681
|
+
sm: 'small',
|
|
682
|
+
md: 'middle',
|
|
683
|
+
lg: 'large',
|
|
684
|
+
xs: undefined,
|
|
685
|
+
};
|
|
686
|
+
|
|
687
|
+
const getFormSize = (size: TSizeForm | undefined) => (size ? defaultSize[size] : undefined);
|
|
688
|
+
|
|
689
|
+
export default getFormSize;
|
|
690
|
+
</file>
|
|
691
|
+
|
|
692
|
+
<file path="src/form/tools/index.ts">
|
|
693
|
+
export { default as generatePath } from './generatePath';
|
|
694
|
+
export { default as generateComponentUrl } from './generateComponentUrl';
|
|
695
|
+
export { default as getDefaultValue } from './getDefaultValue';
|
|
696
|
+
export { default as mapRange } from './mapRange';
|
|
697
|
+
export * from './useFieldValue';
|
|
698
|
+
export { default as getFormSize } from './getFormSize';
|
|
699
|
+
</file>
|
|
700
|
+
|
|
701
|
+
<file path="src/form/tools/mapRange.ts">
|
|
702
|
+
type mapFunction<T> = (k: number) => T;
|
|
703
|
+
|
|
704
|
+
const mapRange = <T>(length: number, callback: mapFunction<T>) =>
|
|
705
|
+
Array.from({ length }, (_, k) => callback(k));
|
|
706
|
+
|
|
707
|
+
export default mapRange;
|
|
708
|
+
</file>
|
|
709
|
+
|
|
710
|
+
<file path="src/form/tools/useFieldValue.ts">
|
|
711
|
+
import { Form } from 'antd';
|
|
712
|
+
import { FormInstance } from 'antd/es/form/hooks/useForm';
|
|
713
|
+
|
|
714
|
+
export const useFieldValueSubscribe = (form: FormInstance, formPath: string[]) =>
|
|
715
|
+
Form.useWatch(formPath, form);
|
|
716
|
+
</file>
|
|
717
|
+
|
|
718
|
+
<file path="src/form/context.tsx">
|
|
719
|
+
import { createContext, FC, memo, PropsWithChildren, useContext, useMemo } from 'react';
|
|
720
|
+
import { IRegistryComponentProps } from './types';
|
|
721
|
+
|
|
722
|
+
type TreenityContext = {
|
|
723
|
+
isForm: boolean;
|
|
724
|
+
Title?: FC<PropsWithChildren<IRegistryComponentProps>>;
|
|
725
|
+
fieldProps?: Record<string, any>;
|
|
726
|
+
};
|
|
727
|
+
|
|
728
|
+
const TreenityFormContext = createContext<TreenityContext>({ isForm: false });
|
|
729
|
+
|
|
730
|
+
const useTreenityForm = () => {
|
|
731
|
+
const context = useContext(TreenityFormContext);
|
|
732
|
+
if (!context) {
|
|
733
|
+
throw new Error('TreenityFormContext not found');
|
|
734
|
+
}
|
|
735
|
+
return context;
|
|
736
|
+
};
|
|
737
|
+
|
|
738
|
+
const TreenityFormProvider: FC<PropsWithChildren<TreenityContext>> = ({
|
|
739
|
+
isForm,
|
|
740
|
+
fieldProps,
|
|
741
|
+
Title,
|
|
742
|
+
children,
|
|
743
|
+
}) => {
|
|
744
|
+
const value = useMemo(() => ({ isForm: true, fieldProps, Title }), [fieldProps, Title]);
|
|
745
|
+
return <TreenityFormContext.Provider value={value}>{children}</TreenityFormContext.Provider>;
|
|
746
|
+
};
|
|
747
|
+
|
|
748
|
+
export { TreenityFormProvider, useTreenityForm, TreenityContext };
|
|
749
|
+
</file>
|
|
750
|
+
|
|
751
|
+
<file path="src/form/formItem.tsx">
|
|
752
|
+
import { IRegistryComponentProps } from './types';
|
|
753
|
+
import styled from '@emotion/styled';
|
|
754
|
+
import { Form } from 'antd';
|
|
755
|
+
import { FC, memo, PropsWithChildren } from 'react';
|
|
756
|
+
|
|
757
|
+
const makeRules = (required: boolean) => [
|
|
758
|
+
{
|
|
759
|
+
required,
|
|
760
|
+
message: 'required',
|
|
761
|
+
},
|
|
762
|
+
];
|
|
763
|
+
|
|
764
|
+
const FormItemHandler: FC<PropsWithChildren<IRegistryComponentProps & { url?: string }>> = ({
|
|
765
|
+
options,
|
|
766
|
+
children,
|
|
767
|
+
initialValue,
|
|
768
|
+
url,
|
|
769
|
+
}) => {
|
|
770
|
+
return (
|
|
771
|
+
<FormItemStyled
|
|
772
|
+
label={options.label}
|
|
773
|
+
name={options.path}
|
|
774
|
+
initialValue={options.defaultValue ?? initialValue}
|
|
775
|
+
required={options.required}
|
|
776
|
+
rules={makeRules(options.required)}
|
|
777
|
+
>
|
|
778
|
+
{children}
|
|
779
|
+
</FormItemStyled>
|
|
780
|
+
);
|
|
781
|
+
};
|
|
782
|
+
|
|
783
|
+
const FormItemStyled = styled(Form.Item)`
|
|
784
|
+
.ant-row,
|
|
785
|
+
.ant-col,
|
|
786
|
+
.ant-form-item-control-input,
|
|
787
|
+
.ant-form-item-control-input-content {
|
|
788
|
+
max-width: 100%;
|
|
789
|
+
}
|
|
790
|
+
`;
|
|
791
|
+
|
|
792
|
+
export default memo(FormItemHandler);
|
|
793
|
+
</file>
|
|
794
|
+
|
|
795
|
+
<file path="src/form/index.tsx">
|
|
796
|
+
import styled from '@emotion/styled';
|
|
797
|
+
import { throttle } from '@s-libs/micro-dash';
|
|
798
|
+
import { JSONSchema7 } from '@treenity/json-schema';
|
|
799
|
+
import { Button, Form } from 'antd';
|
|
800
|
+
import type { FormLayout } from 'antd/es/form/Form';
|
|
801
|
+
import { createContext, FC, memo, PropsWithChildren, useEffect, useMemo } from 'react';
|
|
802
|
+
import { TreenityFormProvider, useTreenityForm } from './context';
|
|
803
|
+
import ParseForm from './parser';
|
|
804
|
+
import { IRegistryComponentProps, TSizeForm } from './types';
|
|
805
|
+
|
|
806
|
+
const TreenityFormContext = createContext<boolean>(false);
|
|
807
|
+
|
|
808
|
+
export type { TSizeForm };
|
|
809
|
+
|
|
810
|
+
export interface IMetaFormProps {
|
|
811
|
+
schema: JSONSchema7;
|
|
812
|
+
initialValues?: any;
|
|
813
|
+
onChange?(fieldValue: any, metaValue: any): void;
|
|
814
|
+
onSubmit?(value: any): void;
|
|
815
|
+
formSize?: TSizeForm;
|
|
816
|
+
layout?: FormLayout;
|
|
817
|
+
buttonSaveText?: string;
|
|
818
|
+
renderContext?: string;
|
|
819
|
+
fieldProps?: Record<string, any>;
|
|
820
|
+
Title?: FC<PropsWithChildren<IRegistryComponentProps>>;
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
const labelCol = { span: 5 };
|
|
824
|
+
const wrapperCol = { span: 19 };
|
|
825
|
+
|
|
826
|
+
const FormHandler: FC<IMetaFormProps> = ({
|
|
827
|
+
schema,
|
|
828
|
+
onSubmit,
|
|
829
|
+
initialValues,
|
|
830
|
+
onChange,
|
|
831
|
+
formSize,
|
|
832
|
+
Title,
|
|
833
|
+
layout,
|
|
834
|
+
buttonSaveText = 'Save',
|
|
835
|
+
renderContext = 'form',
|
|
836
|
+
fieldProps,
|
|
837
|
+
}) => {
|
|
838
|
+
const [form] = Form.useForm();
|
|
839
|
+
|
|
840
|
+
const throttledSetFieldsVlaue = useMemo(() => {
|
|
841
|
+
return throttle(values => {
|
|
842
|
+
form.setFieldsValue(values);
|
|
843
|
+
}, 2000);
|
|
844
|
+
}, [form]);
|
|
845
|
+
|
|
846
|
+
useEffect(() => {
|
|
847
|
+
throttledSetFieldsVlaue(initialValues);
|
|
848
|
+
}, [initialValues, throttledSetFieldsVlaue]);
|
|
849
|
+
|
|
850
|
+
const { isForm } = useTreenityForm();
|
|
851
|
+
|
|
852
|
+
if (isForm) {
|
|
853
|
+
return (
|
|
854
|
+
<FormStyled labelCol={labelCol} wrapperCol={wrapperCol} onValuesChange={onChange}>
|
|
855
|
+
<ParseForm formSize={formSize} item={schema} form={form} renderContext={renderContext} />
|
|
856
|
+
</FormStyled>
|
|
857
|
+
);
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
return (
|
|
861
|
+
<FormStyled
|
|
862
|
+
form={form}
|
|
863
|
+
layout={layout}
|
|
864
|
+
labelCol={labelCol}
|
|
865
|
+
wrapperCol={wrapperCol}
|
|
866
|
+
onFinish={onSubmit}
|
|
867
|
+
onValuesChange={onChange}
|
|
868
|
+
>
|
|
869
|
+
<TreenityFormProvider isForm={true} fieldProps={fieldProps} Title={Title}>
|
|
870
|
+
<ParseForm formSize={formSize} item={schema} form={form} renderContext={renderContext} />
|
|
871
|
+
</TreenityFormProvider>
|
|
872
|
+
{!onChange && (
|
|
873
|
+
<FormItemStyled>
|
|
874
|
+
<Button type="primary" htmlType="submit">
|
|
875
|
+
{buttonSaveText}
|
|
876
|
+
</Button>
|
|
877
|
+
</FormItemStyled>
|
|
878
|
+
)}
|
|
879
|
+
</FormStyled>
|
|
880
|
+
);
|
|
881
|
+
};
|
|
882
|
+
|
|
883
|
+
const FormStyled = styled(Form)`
|
|
884
|
+
.ant-row {
|
|
885
|
+
display: grid;
|
|
886
|
+
grid-template-columns: 74px 1fr;
|
|
887
|
+
}
|
|
888
|
+
.ant-form-item-row {
|
|
889
|
+
gap: 8px;
|
|
890
|
+
}
|
|
891
|
+
& > .ant-form-item {
|
|
892
|
+
padding-inline: 10px;
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
.ant-form-item {
|
|
896
|
+
margin-bottom: 0px;
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
.ant-form-item-label {
|
|
900
|
+
text-align: start;
|
|
901
|
+
align-items: center;
|
|
902
|
+
display: flex;
|
|
903
|
+
|
|
904
|
+
label {
|
|
905
|
+
margin: 0;
|
|
906
|
+
-webkit-transition: color 0.2s cubic-bezier(0.78, 0.14, 0.15, 0.86);
|
|
907
|
+
transition: color 0.2s cubic-bezier(0.78, 0.14, 0.15, 0.86);
|
|
908
|
+
font-size: 10px;
|
|
909
|
+
line-height: 140%;
|
|
910
|
+
letter-spacing: -0.2px;
|
|
911
|
+
font-weight: 700;
|
|
912
|
+
line-height: 1;
|
|
913
|
+
width: 72px;
|
|
914
|
+
line-height: 20px;
|
|
915
|
+
align-self: baseline;
|
|
916
|
+
|
|
917
|
+
&::before,
|
|
918
|
+
&::after {
|
|
919
|
+
display: none !important;
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
`;
|
|
924
|
+
|
|
925
|
+
const FormItemStyled = styled(Form.Item)`
|
|
926
|
+
margin-bottom: 0;
|
|
927
|
+
`;
|
|
928
|
+
|
|
929
|
+
export default memo(FormHandler);
|
|
930
|
+
</file>
|
|
931
|
+
|
|
932
|
+
<file path="src/form/parser.tsx">
|
|
933
|
+
import { FormInstance } from 'antd/es/form/hooks/useForm';
|
|
934
|
+
import { FC, memo, useMemo } from 'react';
|
|
935
|
+
import FormOptions, { ISizeForm } from './types';
|
|
936
|
+
import FormItemHandler from './formItem';
|
|
937
|
+
import { JsonObjectSchema, JSONSchema7, refResolver } from '@treenity/json-schema';
|
|
938
|
+
import { Render } from '#render/Render';
|
|
939
|
+
import { useSwrSync } from '#hooks/useSwrSync';
|
|
940
|
+
import { useTreenityForm } from './context';
|
|
941
|
+
|
|
942
|
+
interface IParseForm extends ISizeForm {
|
|
943
|
+
item: JSONSchema7;
|
|
944
|
+
formPath?: string[];
|
|
945
|
+
required?: string[];
|
|
946
|
+
schema?: JSONSchema7;
|
|
947
|
+
dependencies?: Record<string, JSONSchema7 | string[]>;
|
|
948
|
+
renderContext?: string;
|
|
949
|
+
form?: FormInstance;
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
const getUrlSchema = (schema: JSONSchema7, renderContext: string, type: string) => {
|
|
953
|
+
if (typeof schema.widget === 'object' && schema.widget?.[renderContext]) {
|
|
954
|
+
return schema.widget[renderContext];
|
|
955
|
+
} else if (typeof schema.widget === 'string') {
|
|
956
|
+
return schema.widget;
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
return type;
|
|
960
|
+
};
|
|
961
|
+
|
|
962
|
+
const ParseForm: FC<IParseForm> = ({
|
|
963
|
+
item,
|
|
964
|
+
formPath = [],
|
|
965
|
+
required = [],
|
|
966
|
+
schema,
|
|
967
|
+
formSize,
|
|
968
|
+
renderContext = 'form',
|
|
969
|
+
form,
|
|
970
|
+
}) => {
|
|
971
|
+
let type: string = (
|
|
972
|
+
Array.isArray(item.type) ? item[0].type || item.anyOf?.[0].type : item.type
|
|
973
|
+
) as string;
|
|
974
|
+
if (!type) {
|
|
975
|
+
if (Array.isArray(item) ? item.at(0).$ref : item.$ref) {
|
|
976
|
+
type = 'ref';
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
const { data: resolvedRef } = useSwrSync(item.$ref ? `load-schema-${item.$ref}` : null, () =>
|
|
981
|
+
refResolver({
|
|
982
|
+
item: item,
|
|
983
|
+
schema: schema!,
|
|
984
|
+
}),
|
|
985
|
+
);
|
|
986
|
+
|
|
987
|
+
function fixItem(item: JSONSchema7): JsonObjectSchema {
|
|
988
|
+
if (item.type === 'array' && item.widget) {
|
|
989
|
+
return {
|
|
990
|
+
...(item as object),
|
|
991
|
+
widget: null,
|
|
992
|
+
type: 'array',
|
|
993
|
+
items: {
|
|
994
|
+
...item.items,
|
|
995
|
+
widget: item.widget,
|
|
996
|
+
},
|
|
997
|
+
};
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
// @ts-ignore
|
|
1001
|
+
return resolvedRef ? { ...resolvedRef, ...item } : item;
|
|
1002
|
+
}
|
|
1003
|
+
const { Title, fieldProps } = useTreenityForm();
|
|
1004
|
+
|
|
1005
|
+
const options = useMemo(
|
|
1006
|
+
() =>
|
|
1007
|
+
new FormOptions({
|
|
1008
|
+
_required: required,
|
|
1009
|
+
path: formPath,
|
|
1010
|
+
title: item?.title,
|
|
1011
|
+
fieldProps,
|
|
1012
|
+
type,
|
|
1013
|
+
formSize,
|
|
1014
|
+
item: fixItem(item),
|
|
1015
|
+
disabled: item.disabled,
|
|
1016
|
+
schema: schema || item,
|
|
1017
|
+
renderContext,
|
|
1018
|
+
form,
|
|
1019
|
+
}),
|
|
1020
|
+
[resolvedRef, fieldProps],
|
|
1021
|
+
);
|
|
1022
|
+
|
|
1023
|
+
const url = getUrlSchema(fixItem(item), renderContext, type);
|
|
1024
|
+
|
|
1025
|
+
if (!url) {
|
|
1026
|
+
return null;
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
if (url === 'array' || url === 'object') {
|
|
1030
|
+
if (Title) {
|
|
1031
|
+
return (
|
|
1032
|
+
<Title options={options}>
|
|
1033
|
+
<Render context="form" value={'DONT_REMOVE'} url={url} options={options} />
|
|
1034
|
+
</Title>
|
|
1035
|
+
);
|
|
1036
|
+
}
|
|
1037
|
+
return <Render context="form" value={'DONT_REMOVE'} url={url} options={options} />;
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
if (url === 'ref') {
|
|
1041
|
+
return <Render context="form" value={'DONT_REMOVE'} url={url} options={options} />;
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
return (
|
|
1045
|
+
<FormItemHandler options={options}>
|
|
1046
|
+
<Render context="form" url={url} options={options} />
|
|
1047
|
+
</FormItemHandler>
|
|
1048
|
+
);
|
|
1049
|
+
};
|
|
1050
|
+
|
|
1051
|
+
export default memo(ParseForm);
|
|
1052
|
+
</file>
|
|
1053
|
+
|
|
1054
|
+
<file path="src/form/ref.tsx">
|
|
1055
|
+
import { IRegistryComponentProps } from '#form/types';
|
|
1056
|
+
import { types } from '@treenity/core';
|
|
1057
|
+
import { JSONSchema7, refResolver } from '@treenity/json-schema';
|
|
1058
|
+
import { FC } from 'react';
|
|
1059
|
+
import { Render } from '#render/Render';
|
|
1060
|
+
import { useSwrSync } from '#hooks/useSwrSync';
|
|
1061
|
+
import FormItemHandler from './formItem';
|
|
1062
|
+
import { generateComponentUrl } from './tools';
|
|
1063
|
+
import ParseForm from './parser';
|
|
1064
|
+
|
|
1065
|
+
const RefParser: FC<IRegistryComponentProps> = ({ options, fieldProps, ...rest }) => {
|
|
1066
|
+
const refUrl = options.item.$ref;
|
|
1067
|
+
const componentUrl = generateComponentUrl(refUrl!);
|
|
1068
|
+
const { data } = useSwrSync(
|
|
1069
|
+
`load-component-${componentUrl}`,
|
|
1070
|
+
() => types.react.get('form', componentUrl),
|
|
1071
|
+
{ revalidate: false },
|
|
1072
|
+
);
|
|
1073
|
+
|
|
1074
|
+
if (data) {
|
|
1075
|
+
return (
|
|
1076
|
+
<FormItemHandler options={options}>
|
|
1077
|
+
<Render context="form" url={componentUrl} options={options} />
|
|
1078
|
+
</FormItemHandler>
|
|
1079
|
+
);
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
// @ts-ignore
|
|
1083
|
+
const { data: schema, error } = useSwrSync(`load-schema-${refUrl}`, () => refResolver(options));
|
|
1084
|
+
if (error) return <div>Error loading schema: {error.message}</div>;
|
|
1085
|
+
if (!schema) {
|
|
1086
|
+
return null;
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
return (
|
|
1090
|
+
<ParseForm
|
|
1091
|
+
form={options.form}
|
|
1092
|
+
item={schema as JSONSchema7}
|
|
1093
|
+
formPath={options.path}
|
|
1094
|
+
schema={options.schema}
|
|
1095
|
+
formSize={options.formSize}
|
|
1096
|
+
/>
|
|
1097
|
+
);
|
|
1098
|
+
};
|
|
1099
|
+
|
|
1100
|
+
export default RefParser;
|
|
1101
|
+
</file>
|
|
1102
|
+
|
|
1103
|
+
<file path="src/form/types.ts">
|
|
1104
|
+
import { JSONSchema7 } from '@treenity/json-schema';
|
|
1105
|
+
import { FormInstance } from 'antd/es/form/hooks/useForm';
|
|
1106
|
+
import { FC, ReactNode } from 'react';
|
|
1107
|
+
|
|
1108
|
+
export type TSizeForm = 'xs' | 'sm' | 'md' | 'lg';
|
|
1109
|
+
|
|
1110
|
+
export interface ISizeForm {
|
|
1111
|
+
formSize?: TSizeForm;
|
|
1112
|
+
}
|
|
1113
|
+
|
|
1114
|
+
export interface IRegistryComponentProps {
|
|
1115
|
+
options: FormOptions;
|
|
1116
|
+
[key: string]: any;
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
export type FieldProps<TValue = unknown, TFieldProps = unknown> = {
|
|
1120
|
+
'aria-required'?: string;
|
|
1121
|
+
context: string;
|
|
1122
|
+
id: string;
|
|
1123
|
+
url: string;
|
|
1124
|
+
value: TValue;
|
|
1125
|
+
onChange: (value: TValue) => void;
|
|
1126
|
+
options: FormOptions<TFieldProps>;
|
|
1127
|
+
};
|
|
1128
|
+
|
|
1129
|
+
export type FieldRenderer<T = unknown, D = {}> = (props: FieldProps<T, D>) => ReactNode;
|
|
1130
|
+
|
|
1131
|
+
export type RegistryComponentValue = FC<IRegistryComponentProps>;
|
|
1132
|
+
|
|
1133
|
+
export interface IRegistryComponent {
|
|
1134
|
+
[key: string]: RegistryComponentValue;
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
export interface IFormOptions<TFieldProps = unknown> {
|
|
1138
|
+
type: string;
|
|
1139
|
+
path: string[];
|
|
1140
|
+
title?: string;
|
|
1141
|
+
key?: string;
|
|
1142
|
+
item: JSONSchema7;
|
|
1143
|
+
formSize?: TSizeForm;
|
|
1144
|
+
_required?: string[];
|
|
1145
|
+
schema?: JSONSchema7;
|
|
1146
|
+
disabled: boolean;
|
|
1147
|
+
renderContext?: string;
|
|
1148
|
+
form?: FormInstance;
|
|
1149
|
+
fieldProps: TFieldProps;
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1152
|
+
class FormOptions<TFieldProps = unknown> implements IFormOptions<TFieldProps> {
|
|
1153
|
+
key?: string;
|
|
1154
|
+
title?: string;
|
|
1155
|
+
path: string[];
|
|
1156
|
+
type: string;
|
|
1157
|
+
item: JSONSchema7;
|
|
1158
|
+
schema?: JSONSchema7;
|
|
1159
|
+
formSize?: TSizeForm;
|
|
1160
|
+
_required?: string[];
|
|
1161
|
+
disabled: boolean;
|
|
1162
|
+
renderContext?: string;
|
|
1163
|
+
form?: FormInstance;
|
|
1164
|
+
fieldProps: TFieldProps;
|
|
1165
|
+
|
|
1166
|
+
constructor(options: IFormOptions<TFieldProps>) {
|
|
1167
|
+
this._required = options._required || [];
|
|
1168
|
+
this.title = options.title;
|
|
1169
|
+
this.path = options.path;
|
|
1170
|
+
this.type = options.type;
|
|
1171
|
+
this.formSize = options.formSize;
|
|
1172
|
+
this.item = options.item;
|
|
1173
|
+
this.schema = options.schema;
|
|
1174
|
+
this.renderContext = options.renderContext;
|
|
1175
|
+
this.disabled = options.disabled || false;
|
|
1176
|
+
this.form = options.form;
|
|
1177
|
+
this.fieldProps = options.fieldProps;
|
|
1178
|
+
|
|
1179
|
+
if (!options.fieldProps) {
|
|
1180
|
+
throw new Error('fieldProps is required');
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1183
|
+
if (this.path?.length) {
|
|
1184
|
+
this.key = this.path.at(-1);
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
public get defaultValue(): any {
|
|
1189
|
+
return this.item.default || this.item.defaultValue;
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
private getLabelFromPath(): string | undefined {
|
|
1193
|
+
if (!this.path || !this.path.length) {
|
|
1194
|
+
return;
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
return this.path.at(-1);
|
|
1198
|
+
}
|
|
1199
|
+
|
|
1200
|
+
public get label(): string | undefined {
|
|
1201
|
+
if (this.title === null) {
|
|
1202
|
+
return undefined;
|
|
1203
|
+
}
|
|
1204
|
+
if (this.title) {
|
|
1205
|
+
return String(this.title);
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
return this.getLabelFromPath() || '';
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
public get required(): boolean {
|
|
1212
|
+
if (!this.key) {
|
|
1213
|
+
return false;
|
|
1214
|
+
}
|
|
1215
|
+
|
|
1216
|
+
return this._required?.includes(this.key) || false;
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
public getParam(key: string, defaultValue: any): any {
|
|
1220
|
+
// @ts-ignore
|
|
1221
|
+
return this.item[key] || defaultValue;
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
export default FormOptions;
|
|
1226
|
+
</file>
|
|
1227
|
+
|
|
1228
|
+
<file path="src/hooks/use-save-shortcut.tsx">
|
|
1229
|
+
import { useEffect, useRef } from 'react';
|
|
1230
|
+
|
|
1231
|
+
const _document = typeof document !== 'undefined' ? document : null;
|
|
1232
|
+
|
|
1233
|
+
type SaveCallback = () => void | Promise<void>;
|
|
1234
|
+
|
|
1235
|
+
/**
|
|
1236
|
+
* Hook that blocks default browser save event & adds Ctrl+S/Cmd+S shortcut listener
|
|
1237
|
+
* @param onSaved - Callback function to be called when the save shortcut is triggered
|
|
1238
|
+
* @param doc - The document object to attach the listener to (default: document)
|
|
1239
|
+
* @example
|
|
1240
|
+
* ```tsx
|
|
1241
|
+
* // Basic usage
|
|
1242
|
+
* useSaveShortcut(() => console.log('Saved!'));
|
|
1243
|
+
*
|
|
1244
|
+
* // Usage with iframe document
|
|
1245
|
+
* const [iframeRef, setIframeRef] = useState<HTMLIFrameElement | null>(null);
|
|
1246
|
+
* useSaveShortcut(handleSave, iframeRef?.contentDocument);
|
|
1247
|
+
* ```
|
|
1248
|
+
*/
|
|
1249
|
+
export const useSaveShortcut = (onSaved?: SaveCallback, doc: Document | null = _document): void => {
|
|
1250
|
+
const onSavedRef = useRef(onSaved);
|
|
1251
|
+
onSavedRef.current = onSaved;
|
|
1252
|
+
|
|
1253
|
+
useEffect(() => {
|
|
1254
|
+
if (!doc) return;
|
|
1255
|
+
|
|
1256
|
+
const handleKeyDown = async (e: KeyboardEvent) => {
|
|
1257
|
+
if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === 's') {
|
|
1258
|
+
e.preventDefault();
|
|
1259
|
+
|
|
1260
|
+
if (!e.repeat) {
|
|
1261
|
+
await onSavedRef.current?.();
|
|
1262
|
+
}
|
|
1263
|
+
}
|
|
1264
|
+
};
|
|
1265
|
+
|
|
1266
|
+
doc.addEventListener('keydown', handleKeyDown);
|
|
1267
|
+
return () => doc.removeEventListener('keydown', handleKeyDown);
|
|
1268
|
+
}, [doc]);
|
|
1269
|
+
};
|
|
1270
|
+
</file>
|
|
1271
|
+
|
|
1272
|
+
<file path="src/hooks/useImmer.ts">
|
|
1273
|
+
import { useCallback, useState } from 'react';
|
|
1274
|
+
import { produce } from 'immer';
|
|
1275
|
+
|
|
1276
|
+
type ImmerCallback<T> = (val: T) => T | void;
|
|
1277
|
+
|
|
1278
|
+
export function useImmer<T>(initial: T | (() => T)): [T, (cb: ImmerCallback<T> | T) => void] {
|
|
1279
|
+
const [data, setData] = useState(initial);
|
|
1280
|
+
const setImmer = useCallback(
|
|
1281
|
+
(cb: ImmerCallback<T> | T) =>
|
|
1282
|
+
// @ts-ignore in `produce(data, cb)` cb is not assignable, but we know, it is function
|
|
1283
|
+
typeof cb === 'function' ? setData(data => produce(data, cb)) : setData(cb),
|
|
1284
|
+
[setData],
|
|
1285
|
+
);
|
|
1286
|
+
return [data, setImmer];
|
|
1287
|
+
}
|
|
1288
|
+
</file>
|
|
1289
|
+
|
|
1290
|
+
<file path="src/hooks/useInputState.ts">
|
|
1291
|
+
import { Dispatch, SetStateAction, useCallback, useState } from 'react';
|
|
1292
|
+
|
|
1293
|
+
type StateUpdater<T> = Dispatch<SetStateAction<T>>;
|
|
1294
|
+
|
|
1295
|
+
export function useInputState<T>(initial: T): [T, StateUpdater<T>] {
|
|
1296
|
+
const [value, setValue] = useState<T>(initial);
|
|
1297
|
+
const setInputValue = useCallback<StateUpdater<T>>(
|
|
1298
|
+
(e: any) => {
|
|
1299
|
+
const value =
|
|
1300
|
+
e && 'target' in e ? (e.target.type === 'checkbox' ? e.target.checked : e.target.value) : e;
|
|
1301
|
+
setValue(value);
|
|
1302
|
+
},
|
|
1303
|
+
[setValue],
|
|
1304
|
+
);
|
|
1305
|
+
return [value, setInputValue];
|
|
1306
|
+
}
|
|
1307
|
+
</file>
|
|
1308
|
+
|
|
1309
|
+
<file path="src/hooks/useStorage.ts">
|
|
1310
|
+
import { useCallback, useState } from 'react';
|
|
1311
|
+
|
|
1312
|
+
function useStorage<T>(key: string): [T | undefined, (v: T | undefined) => void];
|
|
1313
|
+
function useStorage<T>(key: string, defaultValue: T): [T, (v: T | undefined) => void];
|
|
1314
|
+
|
|
1315
|
+
function useStorage<T>(key: string, defaultValue?: T): [T | undefined, (v: T | undefined) => void] {
|
|
1316
|
+
if (typeof window === 'undefined') {
|
|
1317
|
+
return [defaultValue, () => {}];
|
|
1318
|
+
}
|
|
1319
|
+
|
|
1320
|
+
const [value, setValue] = useState<T | undefined>(() => {
|
|
1321
|
+
const storageValue = localStorage.getItem(key);
|
|
1322
|
+
try {
|
|
1323
|
+
return storageValue ? (JSON.parse(storageValue) as T) : defaultValue;
|
|
1324
|
+
} catch (err) {
|
|
1325
|
+
console.warn('localstorage', key, 'parse error', err);
|
|
1326
|
+
localStorage.setItem(key, JSON.stringify(defaultValue));
|
|
1327
|
+
return defaultValue;
|
|
1328
|
+
}
|
|
1329
|
+
});
|
|
1330
|
+
const setFn = useCallback((v: T | undefined) => {
|
|
1331
|
+
if (v === undefined) {
|
|
1332
|
+
localStorage.removeItem(key);
|
|
1333
|
+
} else {
|
|
1334
|
+
localStorage.setItem(key, JSON.stringify(v));
|
|
1335
|
+
}
|
|
1336
|
+
setValue(v);
|
|
1337
|
+
}, []);
|
|
1338
|
+
|
|
1339
|
+
return [value, setFn];
|
|
1340
|
+
}
|
|
1341
|
+
|
|
1342
|
+
export default useStorage;
|
|
1343
|
+
</file>
|
|
1344
|
+
|
|
1345
|
+
<file path="src/hooks/useSwrSync.ts">
|
|
1346
|
+
import { useRef } from 'react';
|
|
1347
|
+
import useSWR, { SWRConfiguration, SWRResponse } from 'swr';
|
|
1348
|
+
|
|
1349
|
+
export type Configuration = SWRConfiguration & { revalidate?: boolean };
|
|
1350
|
+
|
|
1351
|
+
const SWR_DONT_REVALIDATE = {
|
|
1352
|
+
revalidateIfStale: false,
|
|
1353
|
+
revalidateOnFocus: false,
|
|
1354
|
+
revalidateOnReconnect: false,
|
|
1355
|
+
};
|
|
1356
|
+
|
|
1357
|
+
// TODO: write tests
|
|
1358
|
+
/**
|
|
1359
|
+
* Sync version of useSWR, run its callback synchronously, and could resolve synchronous-promise,
|
|
1360
|
+
* it will reduce flicker if component could be loaded from cache
|
|
1361
|
+
* @param id
|
|
1362
|
+
* @param cb
|
|
1363
|
+
* @param config
|
|
1364
|
+
*/
|
|
1365
|
+
export function useSwrSync<T>(
|
|
1366
|
+
id: string | null,
|
|
1367
|
+
cb: () => Promise<T> | T,
|
|
1368
|
+
config: Configuration = {},
|
|
1369
|
+
): SWRResponse<T> {
|
|
1370
|
+
const isFirst = useRef(true);
|
|
1371
|
+
if (config.revalidate === false) {
|
|
1372
|
+
config = Object.assign({}, SWR_DONT_REVALIDATE, config);
|
|
1373
|
+
}
|
|
1374
|
+
|
|
1375
|
+
let prom: any;
|
|
1376
|
+
const result = useSWR(id, () => prom || cb(), config);
|
|
1377
|
+
// try resolve promise synchronously (yes, we using synchronous-promise package for this)
|
|
1378
|
+
if (isFirst.current) {
|
|
1379
|
+
isFirst.current = false;
|
|
1380
|
+
let error;
|
|
1381
|
+
try {
|
|
1382
|
+
prom = cb();
|
|
1383
|
+
} catch (err) {
|
|
1384
|
+
error = err;
|
|
1385
|
+
}
|
|
1386
|
+
if (prom) {
|
|
1387
|
+
if (typeof prom.then === 'function') {
|
|
1388
|
+
let value;
|
|
1389
|
+
prom.then(
|
|
1390
|
+
v => (value = v),
|
|
1391
|
+
err => (error = err),
|
|
1392
|
+
);
|
|
1393
|
+
if (value != undefined) return { ...result, data: value };
|
|
1394
|
+
} else {
|
|
1395
|
+
return { ...result, data: prom };
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1398
|
+
if (error) {
|
|
1399
|
+
return { ...result, error };
|
|
1400
|
+
}
|
|
1401
|
+
}
|
|
1402
|
+
|
|
1403
|
+
return result;
|
|
1404
|
+
}
|
|
1405
|
+
|
|
1406
|
+
export function useSwrSync2<T>(
|
|
1407
|
+
id: string | null,
|
|
1408
|
+
cb: () => Promise<T> | T,
|
|
1409
|
+
config: Configuration = {},
|
|
1410
|
+
): { data?: T; error?: Error } {
|
|
1411
|
+
const isFirst = useRef(true);
|
|
1412
|
+
|
|
1413
|
+
const use = next => {
|
|
1414
|
+
return (key, fn, config) => {
|
|
1415
|
+
const result = next(key, fn, config);
|
|
1416
|
+
if (isFirst.current) {
|
|
1417
|
+
isFirst.current = false;
|
|
1418
|
+
let error;
|
|
1419
|
+
let value;
|
|
1420
|
+
try {
|
|
1421
|
+
value = fn();
|
|
1422
|
+
} catch (err) {
|
|
1423
|
+
error = err;
|
|
1424
|
+
}
|
|
1425
|
+
if (value != undefined) return { ...result, data: value };
|
|
1426
|
+
if (error) {
|
|
1427
|
+
return { ...result, error };
|
|
1428
|
+
}
|
|
1429
|
+
}
|
|
1430
|
+
return result;
|
|
1431
|
+
};
|
|
1432
|
+
};
|
|
1433
|
+
|
|
1434
|
+
if (config.revalidate === false) {
|
|
1435
|
+
config = Object.assign({ use }, SWR_DONT_REVALIDATE, config);
|
|
1436
|
+
}
|
|
1437
|
+
|
|
1438
|
+
let prom: any;
|
|
1439
|
+
const result = useSWR(id, () => prom || cb(), config);
|
|
1440
|
+
// try resolve promise synchronously (yes, we using synchronous-promise package for this)
|
|
1441
|
+
if (isFirst.current) {
|
|
1442
|
+
isFirst.current = false;
|
|
1443
|
+
let error;
|
|
1444
|
+
try {
|
|
1445
|
+
prom = cb();
|
|
1446
|
+
} catch (err) {
|
|
1447
|
+
error = err;
|
|
1448
|
+
}
|
|
1449
|
+
if (prom) {
|
|
1450
|
+
if (typeof prom.then === 'function') {
|
|
1451
|
+
let value;
|
|
1452
|
+
prom.then(
|
|
1453
|
+
v => (value = v),
|
|
1454
|
+
err => (error = err),
|
|
1455
|
+
);
|
|
1456
|
+
if (value != undefined) return { ...result, data: value };
|
|
1457
|
+
} else {
|
|
1458
|
+
return { ...result, data: prom };
|
|
1459
|
+
}
|
|
1460
|
+
}
|
|
1461
|
+
if (error) {
|
|
1462
|
+
return { ...result, error };
|
|
1463
|
+
}
|
|
1464
|
+
}
|
|
1465
|
+
|
|
1466
|
+
return result;
|
|
1467
|
+
}
|
|
1468
|
+
</file>
|
|
1469
|
+
|
|
1470
|
+
<file path="src/hooks/useToggle.ts">
|
|
1471
|
+
import { useCallback, useState } from 'react';
|
|
1472
|
+
|
|
1473
|
+
export default function useToggle(start: boolean = false): [boolean, (value?: any) => void] {
|
|
1474
|
+
const [value, setValue] = useState<boolean>(start);
|
|
1475
|
+
const toggle = useCallback(
|
|
1476
|
+
(value?: any) => setValue(prevValue => (typeof value === 'boolean' ? value : !prevValue)),
|
|
1477
|
+
[],
|
|
1478
|
+
);
|
|
1479
|
+
return [value, toggle];
|
|
1480
|
+
}
|
|
1481
|
+
</file>
|
|
1482
|
+
|
|
1483
|
+
<file path="src/make-icon/icomoon-gen.mjs">
|
|
1484
|
+
#!/usr/bin/env node
|
|
1485
|
+
|
|
1486
|
+
import fs from 'node:fs';
|
|
1487
|
+
|
|
1488
|
+
function readJson(path) {
|
|
1489
|
+
return JSON.parse(fs.readFileSync(path, 'utf-8'));
|
|
1490
|
+
}
|
|
1491
|
+
|
|
1492
|
+
const dataJson = readJson('./icomoon/selection.json');
|
|
1493
|
+
const dataStylePath = './icomoon/style.css';
|
|
1494
|
+
const fontsDir = './icomoon/fonts';
|
|
1495
|
+
|
|
1496
|
+
const array = dataJson.icons.map(i => i.properties.name);
|
|
1497
|
+
|
|
1498
|
+
let buf = 'const iconNames = [\n';
|
|
1499
|
+
|
|
1500
|
+
const iconTypes = ['filled', 'outlined'];
|
|
1501
|
+
|
|
1502
|
+
let errorTypeIcons = [];
|
|
1503
|
+
|
|
1504
|
+
array.sort().forEach(i => {
|
|
1505
|
+
const [, type] = i.split('_');
|
|
1506
|
+
if (!type && !iconTypes.includes(type)) {
|
|
1507
|
+
errorTypeIcons.push(i);
|
|
1508
|
+
}
|
|
1509
|
+
|
|
1510
|
+
buf += ` '${i}',\n`;
|
|
1511
|
+
});
|
|
1512
|
+
|
|
1513
|
+
if (errorTypeIcons.length > 0) {
|
|
1514
|
+
console.error('\x1b[32m%s\x1b[0m', errorTypeIcons);
|
|
1515
|
+
throw new Error(`unknown icon type: ${errorTypeIcons}, should end with: '_' and ${iconTypes}`);
|
|
1516
|
+
}
|
|
1517
|
+
|
|
1518
|
+
buf += '] as const;\n';
|
|
1519
|
+
buf += 'export default iconNames;\n';
|
|
1520
|
+
|
|
1521
|
+
fs.writeFileSync('./icons-names.ts', buf);
|
|
1522
|
+
|
|
1523
|
+
fs.readdir(fontsDir, (err, files) => {
|
|
1524
|
+
if (err) {
|
|
1525
|
+
console.error(`Failed to read directory: ${err.message}`);
|
|
1526
|
+
return;
|
|
1527
|
+
}
|
|
1528
|
+
files.forEach(file => {
|
|
1529
|
+
if (file.split('.').at(-1) === 'svg') {
|
|
1530
|
+
const filePath = `${fontsDir}/${file}`;
|
|
1531
|
+
try {
|
|
1532
|
+
fs.rmSync(filePath);
|
|
1533
|
+
console.log(`File deleted: ${filePath} 👍`);
|
|
1534
|
+
} catch (err) {
|
|
1535
|
+
console.error(`Failed to delete file: ${filePath}, error: ${err.message}`);
|
|
1536
|
+
}
|
|
1537
|
+
}
|
|
1538
|
+
});
|
|
1539
|
+
});
|
|
1540
|
+
|
|
1541
|
+
function removeSvgFontEntry(filePath) {
|
|
1542
|
+
const cssContent = fs.readFileSync(filePath, 'utf-8');
|
|
1543
|
+
const updatedContent = cssContent.replace(
|
|
1544
|
+
/,\s*url\('fonts\/[^']+\.svg\?[^']+'\)\s*format\('svg'\)/gm,
|
|
1545
|
+
'',
|
|
1546
|
+
);
|
|
1547
|
+
fs.writeFileSync(filePath, updatedContent, 'utf-8');
|
|
1548
|
+
}
|
|
1549
|
+
|
|
1550
|
+
removeSvgFontEntry('./icomoon/style.css');
|
|
1551
|
+
removeSvgFontEntry(dataStylePath);
|
|
1552
|
+
|
|
1553
|
+
const iconRegex = /\.icon-([a-zA-Z0-9-_]+):before\s*{\s*content:\s*"\\([a-fA-F0-9]+)";\s*}/gm;
|
|
1554
|
+
const cssContent = fs.readFileSync(dataStylePath, 'utf-8');
|
|
1555
|
+
|
|
1556
|
+
if (!cssContent) {
|
|
1557
|
+
console.log(`file ` + dataStylePath + ` not found`);
|
|
1558
|
+
}
|
|
1559
|
+
|
|
1560
|
+
const iconsObject = {};
|
|
1561
|
+
|
|
1562
|
+
let match;
|
|
1563
|
+
while ((match = iconRegex.exec(cssContent)) !== null) {
|
|
1564
|
+
const iconName = match[1];
|
|
1565
|
+
const iconCode = match[2];
|
|
1566
|
+
iconsObject[iconName] = `\\\\${iconCode}`;
|
|
1567
|
+
}
|
|
1568
|
+
|
|
1569
|
+
let tsContent = 'const iconObject = {\n';
|
|
1570
|
+
|
|
1571
|
+
for (const [key, value] of Object.entries(iconsObject)) {
|
|
1572
|
+
tsContent += ` '${key}': '${value}',\n`;
|
|
1573
|
+
}
|
|
1574
|
+
|
|
1575
|
+
tsContent += '};\n';
|
|
1576
|
+
tsContent += 'export default iconObject;\n';
|
|
1577
|
+
|
|
1578
|
+
fs.writeFileSync('./icons-object.ts', tsContent, 'utf-8');
|
|
1579
|
+
|
|
1580
|
+
console.log('Icons object created successfully.');
|
|
1581
|
+
</file>
|
|
1582
|
+
|
|
1583
|
+
<file path="src/make-icon/icomoon.css">
|
|
1584
|
+
:where([class^="icon-"]), :where([class*=" icon-"]) {
|
|
1585
|
+
font-size: 24px;
|
|
1586
|
+
}
|
|
1587
|
+
|
|
1588
|
+
|
|
1589
|
+
@keyframes icon-rotation {
|
|
1590
|
+
0% {
|
|
1591
|
+
transform: rotate(0deg);
|
|
1592
|
+
}
|
|
1593
|
+
100% {
|
|
1594
|
+
transform: rotate(360deg);
|
|
1595
|
+
}
|
|
1596
|
+
}
|
|
1597
|
+
</file>
|
|
1598
|
+
|
|
1599
|
+
<file path="src/make-icon/Icon.tsx">
|
|
1600
|
+
import { IIcon } from '#make-icon/types';
|
|
1601
|
+
import { omitProps } from '#utils/emotion-omit-props';
|
|
1602
|
+
import { css } from '@emotion/react';
|
|
1603
|
+
import styled from '@emotion/styled';
|
|
1604
|
+
import React from 'react';
|
|
1605
|
+
import './icomoon.css';
|
|
1606
|
+
|
|
1607
|
+
function IconUnstyled({ name, className, style }: IIcon<string[]>) {
|
|
1608
|
+
return <i className={`icon-${name} ${className}`} style={style} />;
|
|
1609
|
+
}
|
|
1610
|
+
|
|
1611
|
+
const colorTable: Record<string, string> = {
|
|
1612
|
+
default: 'colorText',
|
|
1613
|
+
danger: 'colorError',
|
|
1614
|
+
primary: 'colorPrimary',
|
|
1615
|
+
gray: 'colorTextQuaternary',
|
|
1616
|
+
};
|
|
1617
|
+
|
|
1618
|
+
const Icon = styled(IconUnstyled, omitProps('spin', 'color', 'rotate'))<
|
|
1619
|
+
Pick<IIcon<any>, 'rotate' | 'spin' | 'color'>
|
|
1620
|
+
>`
|
|
1621
|
+
${p => css`
|
|
1622
|
+
transition: transform ${p.theme.motionDurationMid} ${p.theme.motionEaseInOutCirc};
|
|
1623
|
+
transform: ${(p.rotate || p.rotate === 0) && `rotate(${p.rotate}deg)`};
|
|
1624
|
+
`};
|
|
1625
|
+
|
|
1626
|
+
${({ spin }) =>
|
|
1627
|
+
spin &&
|
|
1628
|
+
css`
|
|
1629
|
+
transform-origin: 52%;
|
|
1630
|
+
animation: icon-rotation ${typeof spin === 'boolean' ? 1 : spin}s linear infinite;
|
|
1631
|
+
display: block;
|
|
1632
|
+
`};
|
|
1633
|
+
|
|
1634
|
+
${p =>
|
|
1635
|
+
p.color &&
|
|
1636
|
+
css`
|
|
1637
|
+
color: ${(p.theme as any)?.[colorTable[p.color] || p.color] || p.color};
|
|
1638
|
+
`};
|
|
1639
|
+
`;
|
|
1640
|
+
|
|
1641
|
+
export default Icon;
|
|
1642
|
+
</file>
|
|
1643
|
+
|
|
1644
|
+
<file path="src/make-icon/index.tsx">
|
|
1645
|
+
import { FC } from 'react';
|
|
1646
|
+
import Icon from './Icon';
|
|
1647
|
+
|
|
1648
|
+
import { IconNames, IIcon } from './types';
|
|
1649
|
+
|
|
1650
|
+
export default function makeIcon<T extends IconNames>(iconNames: T): FC<IIcon<T>> {
|
|
1651
|
+
return Icon as unknown as FC<IIcon<T>>;
|
|
1652
|
+
}
|
|
1653
|
+
</file>
|
|
1654
|
+
|
|
1655
|
+
<file path="src/make-icon/types.ts">
|
|
1656
|
+
import { CSSProperties } from 'react';
|
|
1657
|
+
import '../emotion';
|
|
1658
|
+
|
|
1659
|
+
export type IconThemesMap = 'default' | 'danger' | 'gray' | 'primary' | string;
|
|
1660
|
+
|
|
1661
|
+
export type IconNames = readonly string[];
|
|
1662
|
+
|
|
1663
|
+
export interface IIcon<T extends IconNames> {
|
|
1664
|
+
name: T[number];
|
|
1665
|
+
color?: IconThemesMap;
|
|
1666
|
+
className?: string;
|
|
1667
|
+
style?: CSSProperties;
|
|
1668
|
+
styleIcon?: CSSProperties;
|
|
1669
|
+
rotate?: number; // angle to rotate icon to
|
|
1670
|
+
spin?: boolean | number; // boolean or number of seconds to make full rotation
|
|
1671
|
+
}
|
|
1672
|
+
|
|
1673
|
+
export interface IErrorProps<T extends IconNames> {
|
|
1674
|
+
name: T[number];
|
|
1675
|
+
isIconStyle: boolean;
|
|
1676
|
+
includeIcon: boolean;
|
|
1677
|
+
}
|
|
1678
|
+
</file>
|
|
1679
|
+
|
|
1680
|
+
<file path="src/make-icon/with-tooltip.tsx">
|
|
1681
|
+
import { Tooltip } from 'antd';
|
|
1682
|
+
import { FC, ReactNode } from 'react';
|
|
1683
|
+
import Icon from './Icon';
|
|
1684
|
+
import { IIcon } from './types';
|
|
1685
|
+
|
|
1686
|
+
export function makeIconWithTooltip<T extends string[]>(iconsNames: T): FC<IIcon<T>> {
|
|
1687
|
+
const iconNamesHash: Record<string, boolean> = {};
|
|
1688
|
+
iconsNames.forEach(name => {
|
|
1689
|
+
iconNamesHash[name] = true;
|
|
1690
|
+
});
|
|
1691
|
+
|
|
1692
|
+
return function IconWithTooltip<T extends string[]>(props: IIcon<T>) {
|
|
1693
|
+
const error = !props.name ? (
|
|
1694
|
+
'icon not found, name is not correct'
|
|
1695
|
+
) : !iconNamesHash[props.name] ? (
|
|
1696
|
+
<>
|
|
1697
|
+
Type for icon <b>{props.name}</b> not found
|
|
1698
|
+
</>
|
|
1699
|
+
) : undefined;
|
|
1700
|
+
|
|
1701
|
+
if (error) return <ErrorTooltip error={error} />;
|
|
1702
|
+
|
|
1703
|
+
return <Icon {...props} />;
|
|
1704
|
+
};
|
|
1705
|
+
}
|
|
1706
|
+
|
|
1707
|
+
const DefaultIcon = () => (
|
|
1708
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 1024 1024">
|
|
1709
|
+
<path
|
|
1710
|
+
fill="#fa6900"
|
|
1711
|
+
d="M60 256v512c0 108 88 196 196 196h512c108 0 196-88 196-196V256c0-108-88-196-196-196H256C148 60 60 148 60 256zm452 9c24 0 43 19 43 42v205a43 43 0 1 1-86 0V307c0-23 19-42 43-42zm0 356c24 0 43 19 43 43v2a43 43 0 1 1-86 0v-2c0-24 19-43 43-43z"
|
|
1712
|
+
/>
|
|
1713
|
+
</svg>
|
|
1714
|
+
);
|
|
1715
|
+
|
|
1716
|
+
const ErrorTooltip: FC<{ error: ReactNode }> = ({ error }) => (
|
|
1717
|
+
<Tooltip title={error} getPopupContainer={() => document.body}>
|
|
1718
|
+
<div style={{ width: 24 }}>
|
|
1719
|
+
<DefaultIcon />
|
|
1720
|
+
</div>
|
|
1721
|
+
</Tooltip>
|
|
1722
|
+
);
|
|
1723
|
+
</file>
|
|
1724
|
+
|
|
1725
|
+
<file path="src/render/Render.tsx">
|
|
1726
|
+
import { ErrorBoundary } from '#components/ErrorBoundary';
|
|
1727
|
+
import { ShowAfterTimeout } from '#components/ShowAfterTimeout';
|
|
1728
|
+
import { useRenderContext } from '#context/RenderContext';
|
|
1729
|
+
import { useSwrSync } from '#hooks/useSwrSync';
|
|
1730
|
+
import {
|
|
1731
|
+
IReactContextProps,
|
|
1732
|
+
Meta,
|
|
1733
|
+
metaType,
|
|
1734
|
+
Node,
|
|
1735
|
+
ReactTypeContextInfo,
|
|
1736
|
+
types,
|
|
1737
|
+
} from '@treenity/core';
|
|
1738
|
+
import { FC, PropsWithChildren } from 'react';
|
|
1739
|
+
|
|
1740
|
+
export type TFC<T, P = {}, N extends Node = Node> = FC<IReactContextProps<T, P, N>>;
|
|
1741
|
+
|
|
1742
|
+
export type TFCC<T, P = {}, N extends Node = Node> = FC<
|
|
1743
|
+
PropsWithChildren<IReactContextProps<T, P, N>>
|
|
1744
|
+
>;
|
|
1745
|
+
|
|
1746
|
+
export interface RenderURLProps {
|
|
1747
|
+
url: string;
|
|
1748
|
+
children?: any;
|
|
1749
|
+
|
|
1750
|
+
loading?: () => JSX.Element;
|
|
1751
|
+
loader?: (props: RenderURLProps) => ReactTypeContextInfo | Promise<ReactTypeContextInfo>;
|
|
1752
|
+
|
|
1753
|
+
[more: string]: any;
|
|
1754
|
+
}
|
|
1755
|
+
|
|
1756
|
+
let Render = function Render(props: RenderURLProps) {
|
|
1757
|
+
const ctx = useRenderContext();
|
|
1758
|
+
const { data: componentInfo, error } = useSwrSync<ReactTypeContextInfo>(
|
|
1759
|
+
`render_${props.context ?? ctx}_${props.url}`,
|
|
1760
|
+
() =>
|
|
1761
|
+
props.loader ? props.loader(props) : types.react.getInfo(props.context ?? ctx, props.url),
|
|
1762
|
+
props.swr,
|
|
1763
|
+
);
|
|
1764
|
+
|
|
1765
|
+
const { url, fallback, render, loading, loaderHook, value: _value, ...other } = props;
|
|
1766
|
+
|
|
1767
|
+
// @ts-ignore
|
|
1768
|
+
const value = _value ?? componentInfo?.options?.default;
|
|
1769
|
+
|
|
1770
|
+
if (!props.swr?.suspense) {
|
|
1771
|
+
if (value == null) {
|
|
1772
|
+
return <>Loading ...</>;
|
|
1773
|
+
}
|
|
1774
|
+
}
|
|
1775
|
+
|
|
1776
|
+
if (!componentInfo) {
|
|
1777
|
+
if (fallback !== undefined) return fallback(props);
|
|
1778
|
+
return error ? (
|
|
1779
|
+
`not found ${url}`
|
|
1780
|
+
) : (
|
|
1781
|
+
<ShowAfterTimeout timeout={200}>Loading. ff..</ShowAfterTimeout>
|
|
1782
|
+
);
|
|
1783
|
+
}
|
|
1784
|
+
|
|
1785
|
+
let {
|
|
1786
|
+
component: Component,
|
|
1787
|
+
options: { props: componentProps },
|
|
1788
|
+
} = componentInfo;
|
|
1789
|
+
|
|
1790
|
+
const allProps = { ...componentProps, ...other, value, url };
|
|
1791
|
+
|
|
1792
|
+
// @ts-ignore
|
|
1793
|
+
const result = <Component {...allProps} />;
|
|
1794
|
+
|
|
1795
|
+
return render ? render(result, allProps) : result;
|
|
1796
|
+
};
|
|
1797
|
+
|
|
1798
|
+
// if (process.env.NODE_ENV !== 'production') {
|
|
1799
|
+
const RenderOrig = Render;
|
|
1800
|
+
Render = (props: RenderURLProps) => <ErrorBoundary>{RenderOrig(props)}</ErrorBoundary>;
|
|
1801
|
+
// }
|
|
1802
|
+
|
|
1803
|
+
export { Render };
|
|
1804
|
+
|
|
1805
|
+
export const render = (url: string, defProps: any) => (props: any) =>
|
|
1806
|
+
Render({ url, ...defProps, ...props });
|
|
1807
|
+
|
|
1808
|
+
interface IRenderMetaProps extends Omit<RenderURLProps, 'url'> {
|
|
1809
|
+
value: Meta;
|
|
1810
|
+
// node: NodeLoader;
|
|
1811
|
+
context?: string;
|
|
1812
|
+
}
|
|
1813
|
+
|
|
1814
|
+
export const RenderMeta = ({ value, node, ...props }: IRenderMetaProps) => {
|
|
1815
|
+
if (!value) {
|
|
1816
|
+
return null;
|
|
1817
|
+
}
|
|
1818
|
+
return Render({ ...props, url: value.$.type.$type, value, node });
|
|
1819
|
+
};
|
|
1820
|
+
|
|
1821
|
+
interface IRenderType extends Omit<RenderURLProps, 'url'> {
|
|
1822
|
+
type: Meta;
|
|
1823
|
+
metaName?: string;
|
|
1824
|
+
}
|
|
1825
|
+
|
|
1826
|
+
export const RenderType = ({ node, type, metaName, swr, ...props }: IRenderType) => {
|
|
1827
|
+
type = metaType(type);
|
|
1828
|
+
let { data: value } = useSwrSync(
|
|
1829
|
+
`render_type_${node?.path}_${type.$type}_${metaName || ''}`,
|
|
1830
|
+
async () => {
|
|
1831
|
+
const meta = await node.get(type, metaName);
|
|
1832
|
+
return meta;
|
|
1833
|
+
},
|
|
1834
|
+
swr ? swr : { revalidate: false },
|
|
1835
|
+
);
|
|
1836
|
+
|
|
1837
|
+
let url = type.$type;
|
|
1838
|
+
|
|
1839
|
+
// if (!value) {
|
|
1840
|
+
// return <>Loading...</>;
|
|
1841
|
+
// }
|
|
1842
|
+
|
|
1843
|
+
return <Render {...props} url={url} node={node} value={value} swr={swr} />;
|
|
1844
|
+
};
|
|
1845
|
+
</file>
|
|
1846
|
+
|
|
1847
|
+
<file path="src/store/create-loader-store.ts">
|
|
1848
|
+
import { useLoading } from '#tree/loading';
|
|
1849
|
+
import { Draft } from 'immer';
|
|
1850
|
+
import { useMemo } from 'react';
|
|
1851
|
+
import useSwr, { SWRResponse } from 'swr';
|
|
1852
|
+
import { createStore, StateCreator } from './create-store';
|
|
1853
|
+
|
|
1854
|
+
export interface LoadState<T> {
|
|
1855
|
+
useLoad(): void;
|
|
1856
|
+
}
|
|
1857
|
+
|
|
1858
|
+
interface LoadStateLoader<T> extends LoadState<T> {
|
|
1859
|
+
useLoader<R>(
|
|
1860
|
+
key: string,
|
|
1861
|
+
fetcher: () => Promise<R>,
|
|
1862
|
+
callback: (store: Draft<T>, result: R) => void,
|
|
1863
|
+
): SWRResponse<R>;
|
|
1864
|
+
}
|
|
1865
|
+
|
|
1866
|
+
export type StateCreatorLoader<T> = (
|
|
1867
|
+
set: Parameters<StateCreator<T>>[0],
|
|
1868
|
+
get: Parameters<StateCreator<T & LoadStateLoader<T>>>[1], // get has some additional functions
|
|
1869
|
+
store: Parameters<StateCreator<T>>[2],
|
|
1870
|
+
) => T & LoadState<T>;
|
|
1871
|
+
type LoaderStore<T> = ReturnType<typeof createStore<T & LoadStateLoader<T>>>;
|
|
1872
|
+
export const createLoaderStore = <T>(stateCreator: StateCreatorLoader<T>): LoaderStore<T> => {
|
|
1873
|
+
type TL = T & LoadStateLoader<T>;
|
|
1874
|
+
|
|
1875
|
+
const stateWithLoader: StateCreatorLoader<T> = (set, get, store) => {
|
|
1876
|
+
const state = stateCreator(set, get, store) as TL;
|
|
1877
|
+
let first = true;
|
|
1878
|
+
state.useLoader = (key, fetcher, callback) => {
|
|
1879
|
+
return useSwr(
|
|
1880
|
+
key,
|
|
1881
|
+
() => {
|
|
1882
|
+
const loadingOff = useLoading.getState().set(key, first);
|
|
1883
|
+
return fetcher()
|
|
1884
|
+
.then(result => {
|
|
1885
|
+
set(state => {
|
|
1886
|
+
callback(state, result);
|
|
1887
|
+
});
|
|
1888
|
+
return result;
|
|
1889
|
+
})
|
|
1890
|
+
.finally(() => {
|
|
1891
|
+
loadingOff();
|
|
1892
|
+
first = false;
|
|
1893
|
+
});
|
|
1894
|
+
},
|
|
1895
|
+
typeof window !== 'undefined' &&
|
|
1896
|
+
// @ts-ignore
|
|
1897
|
+
window.ENV?.NODE_ENV === 'development' &&
|
|
1898
|
+
// @ts-ignore
|
|
1899
|
+
window.ENV?.ENABLE_SWR_UPDATE_IN_DEV !== 'true'
|
|
1900
|
+
? {
|
|
1901
|
+
revalidateIfStale: false,
|
|
1902
|
+
revalidateOnFocus: false,
|
|
1903
|
+
revalidateOnReconnect: false,
|
|
1904
|
+
}
|
|
1905
|
+
: undefined,
|
|
1906
|
+
);
|
|
1907
|
+
};
|
|
1908
|
+
|
|
1909
|
+
return state;
|
|
1910
|
+
};
|
|
1911
|
+
|
|
1912
|
+
// @ts-ignore
|
|
1913
|
+
const useStore = createStore<TL>(stateWithLoader);
|
|
1914
|
+
|
|
1915
|
+
type Store = typeof useStore;
|
|
1916
|
+
|
|
1917
|
+
const store = () => {
|
|
1918
|
+
const store = useStore();
|
|
1919
|
+
store.useLoad();
|
|
1920
|
+
return store;
|
|
1921
|
+
};
|
|
1922
|
+
(store as Store).getState = useStore.getState;
|
|
1923
|
+
(store as Store).setState = useStore.setState;
|
|
1924
|
+
(store as Store).subscribe = useStore.subscribe;
|
|
1925
|
+
|
|
1926
|
+
// @ts-ignore
|
|
1927
|
+
return store;
|
|
1928
|
+
};
|
|
1929
|
+
|
|
1930
|
+
export const createComponentStore =
|
|
1931
|
+
<T, P extends any[]>(creatorCreator: (...args: P) => StateCreatorLoader<T>) =>
|
|
1932
|
+
(...args: P) => {
|
|
1933
|
+
const useStore = useMemo(() => createLoaderStore<T>(creatorCreator(...args)), args);
|
|
1934
|
+
const store = useStore();
|
|
1935
|
+
store.useLoad();
|
|
1936
|
+
return store;
|
|
1937
|
+
};
|
|
1938
|
+
</file>
|
|
1939
|
+
|
|
1940
|
+
<file path="src/store/create-store.ts">
|
|
1941
|
+
import { mutate } from 'swr';
|
|
1942
|
+
import { create } from 'zustand';
|
|
1943
|
+
import type { PersistOptions } from 'zustand/middleware';
|
|
1944
|
+
import { persist } from 'zustand/middleware';
|
|
1945
|
+
import { immer } from 'zustand/middleware/immer';
|
|
1946
|
+
import { enableMapSet } from 'immer';
|
|
1947
|
+
enableMapSet();
|
|
1948
|
+
|
|
1949
|
+
export type StateCreator<T> = Parameters<typeof immer<T>>[0];
|
|
1950
|
+
|
|
1951
|
+
export const createStore = <T>(storeCreator: StateCreator<T>) => create(immer<T>(storeCreator));
|
|
1952
|
+
|
|
1953
|
+
export const createStorageStore = <T, U>(
|
|
1954
|
+
options: PersistOptions<T, U>,
|
|
1955
|
+
storeCreator: StateCreator<T>,
|
|
1956
|
+
) =>
|
|
1957
|
+
typeof window === 'undefined' // SSR
|
|
1958
|
+
? createStore<T>(storeCreator)
|
|
1959
|
+
: create(persist(immer<T>(storeCreator), options));
|
|
1960
|
+
|
|
1961
|
+
export const invalidate = (key: string) => mutate(key, undefined, true);
|
|
1962
|
+
</file>
|
|
1963
|
+
|
|
1964
|
+
<file path="src/store/loading.ts">
|
|
1965
|
+
import { createStore } from './create-store';
|
|
1966
|
+
|
|
1967
|
+
export interface LoadersStore {
|
|
1968
|
+
loading: Record<string, boolean>;
|
|
1969
|
+
|
|
1970
|
+
set(key: string, value: boolean): () => void;
|
|
1971
|
+
get(key: string): boolean;
|
|
1972
|
+
|
|
1973
|
+
subscribe(key: string, listener: (value: { isLoading: boolean }) => void): boolean;
|
|
1974
|
+
}
|
|
1975
|
+
|
|
1976
|
+
export const useLoading = createStore<LoadersStore>((set, get, store) => ({
|
|
1977
|
+
loading: {},
|
|
1978
|
+
|
|
1979
|
+
set(key: string, value: boolean): () => void {
|
|
1980
|
+
set(state => {
|
|
1981
|
+
state.loading[key] = value;
|
|
1982
|
+
});
|
|
1983
|
+
return () => {
|
|
1984
|
+
set(state => {
|
|
1985
|
+
state.loading[key] = false;
|
|
1986
|
+
});
|
|
1987
|
+
};
|
|
1988
|
+
},
|
|
1989
|
+
|
|
1990
|
+
get(key: string): boolean {
|
|
1991
|
+
return !!get().loading[key];
|
|
1992
|
+
},
|
|
1993
|
+
|
|
1994
|
+
subscribe(key: string, listener: (value: { isLoading: boolean }) => void): boolean {
|
|
1995
|
+
store.subscribe(state => {
|
|
1996
|
+
listener({ isLoading: state.loading[key] });
|
|
1997
|
+
});
|
|
1998
|
+
return get().loading[key];
|
|
1999
|
+
},
|
|
2000
|
+
}));
|
|
2001
|
+
</file>
|
|
2002
|
+
|
|
2003
|
+
<file path="src/theme/provider/emotion.d.ts">
|
|
2004
|
+
/*
|
|
2005
|
+
* Copyright (c) 2024. Treenity Inc.
|
|
2006
|
+
*/
|
|
2007
|
+
|
|
2008
|
+
import { MergedTokensComponents } from '../types';
|
|
2009
|
+
// import { OverrideToken } from 'antd';
|
|
2010
|
+
//
|
|
2011
|
+
// declare module '@emotion/react' {
|
|
2012
|
+
// export interface Theme {
|
|
2013
|
+
// token: ThemeToken;
|
|
2014
|
+
// components: OverrideToken;
|
|
2015
|
+
// }
|
|
2016
|
+
// }
|
|
2017
|
+
import 'antd';
|
|
2018
|
+
|
|
2019
|
+
declare module '@emotion/react' {
|
|
2020
|
+
export interface Theme extends MergedTokensComponents {}
|
|
2021
|
+
}
|
|
2022
|
+
|
|
2023
|
+
declare namespace antd {
|
|
2024
|
+
export const _default: {
|
|
2025
|
+
useToken(): {
|
|
2026
|
+
token: any;
|
|
2027
|
+
hashId: string;
|
|
2028
|
+
};
|
|
2029
|
+
};
|
|
2030
|
+
}
|
|
2031
|
+
</file>
|
|
2032
|
+
|
|
2033
|
+
<file path="src/theme/provider/theme-entity.ts">
|
|
2034
|
+
/*
|
|
2035
|
+
* Copyright (c) 2024. Treenity Inc.
|
|
2036
|
+
*/
|
|
2037
|
+
|
|
2038
|
+
import { metaType } from '@treenity/core';
|
|
2039
|
+
import { entity, writeMethod } from '@treenity/entity';
|
|
2040
|
+
import { MergedConfig, Theme, ThemeConfig } from '../types';
|
|
2041
|
+
|
|
2042
|
+
@entity('theme')
|
|
2043
|
+
export class ThemeEntity implements Theme {
|
|
2044
|
+
name!: string;
|
|
2045
|
+
config!: ThemeConfig;
|
|
2046
|
+
|
|
2047
|
+
get key() {
|
|
2048
|
+
return this.name;
|
|
2049
|
+
}
|
|
2050
|
+
|
|
2051
|
+
@writeMethod
|
|
2052
|
+
setConfig(config: MergedConfig) {
|
|
2053
|
+
this.config = config;
|
|
2054
|
+
}
|
|
2055
|
+
}
|
|
2056
|
+
</file>
|
|
2057
|
+
|
|
2058
|
+
<file path="src/theme/provider/ThemeProvider.tsx">
|
|
2059
|
+
/*
|
|
2060
|
+
* Copyright (c) 2024. Treenity Inc.
|
|
2061
|
+
*/
|
|
2062
|
+
|
|
2063
|
+
import { Theme as ETheme, ThemeProvider as EmotionThemeProvider } from '@emotion/react';
|
|
2064
|
+
import { ConfigProvider, theme } from 'antd';
|
|
2065
|
+
import React, { createContext, FC, PropsWithChildren, useContext, useMemo } from 'react';
|
|
2066
|
+
import { MergedTokens, Theme } from '../types';
|
|
2067
|
+
import { IThemeContext } from './types';
|
|
2068
|
+
import { Locale } from 'antd/es/locale';
|
|
2069
|
+
|
|
2070
|
+
const { useToken } = theme;
|
|
2071
|
+
|
|
2072
|
+
export const ThemeContext: React.Context<IThemeContext> = createContext<IThemeContext>(null!);
|
|
2073
|
+
export const useCurrentTheme = () => useContext(ThemeContext);
|
|
2074
|
+
|
|
2075
|
+
// type Themes = { [key: string]: ThemeConfig };
|
|
2076
|
+
// const THEMES: Themes = {
|
|
2077
|
+
// light: lightTheme,
|
|
2078
|
+
// dark: darkTheme,
|
|
2079
|
+
// };
|
|
2080
|
+
|
|
2081
|
+
const InnerThemeProvider: FC<PropsWithChildren<Omit<IThemeContext, 'theme'>>> = ({
|
|
2082
|
+
themeName,
|
|
2083
|
+
setTheme,
|
|
2084
|
+
themes,
|
|
2085
|
+
children,
|
|
2086
|
+
onChange,
|
|
2087
|
+
}) => {
|
|
2088
|
+
const token = useToken();
|
|
2089
|
+
const emotionTheme = useMemo(
|
|
2090
|
+
() =>
|
|
2091
|
+
({
|
|
2092
|
+
...token.token,
|
|
2093
|
+
//@ts-ignore
|
|
2094
|
+
token: token.token as MergedTokens,
|
|
2095
|
+
}) as ETheme,
|
|
2096
|
+
[token],
|
|
2097
|
+
);
|
|
2098
|
+
|
|
2099
|
+
return (
|
|
2100
|
+
<ThemeContext.Provider value={{ themeName, setTheme, themes, onChange }}>
|
|
2101
|
+
<EmotionThemeProvider theme={emotionTheme}>{children}</EmotionThemeProvider>
|
|
2102
|
+
</ThemeContext.Provider>
|
|
2103
|
+
);
|
|
2104
|
+
};
|
|
2105
|
+
|
|
2106
|
+
const configProviderWave = { disabled: true };
|
|
2107
|
+
|
|
2108
|
+
const getPopupContainer = (triggerNode?: HTMLElement) => triggerNode?.parentNode as HTMLElement;
|
|
2109
|
+
|
|
2110
|
+
export const ThemeProvider: FC<
|
|
2111
|
+
PropsWithChildren<{
|
|
2112
|
+
light: Theme;
|
|
2113
|
+
dark: Theme;
|
|
2114
|
+
storedThemeName: string;
|
|
2115
|
+
setThemeName(themeName: string): void;
|
|
2116
|
+
onChange?: (themeField: string, value: any) => void;
|
|
2117
|
+
locale?: Locale;
|
|
2118
|
+
}>
|
|
2119
|
+
> = ({ children, light, dark, setThemeName, storedThemeName, locale, onChange }) => {
|
|
2120
|
+
const { theme, themes } = useMemo(() => {
|
|
2121
|
+
const sourceTheme = storedThemeName === 'dark' ? dark : light;
|
|
2122
|
+
|
|
2123
|
+
const theme: any = sourceTheme.config;
|
|
2124
|
+
theme.algorithm = sourceTheme.config.algorithm;
|
|
2125
|
+
|
|
2126
|
+
const themes = [light, dark];
|
|
2127
|
+
|
|
2128
|
+
const currentTheme = themes.find(theme => theme.name === storedThemeName) || themes[0];
|
|
2129
|
+
if (storedThemeName != currentTheme.name) {
|
|
2130
|
+
setThemeName(currentTheme.name);
|
|
2131
|
+
}
|
|
2132
|
+
|
|
2133
|
+
return { theme, themes };
|
|
2134
|
+
}, [dark.config, light.config, storedThemeName]);
|
|
2135
|
+
|
|
2136
|
+
return (
|
|
2137
|
+
<ConfigProvider
|
|
2138
|
+
wave={configProviderWave}
|
|
2139
|
+
//@ts-ignore
|
|
2140
|
+
theme={theme}
|
|
2141
|
+
getPopupContainer={getPopupContainer}
|
|
2142
|
+
locale={locale}
|
|
2143
|
+
>
|
|
2144
|
+
<InnerThemeProvider
|
|
2145
|
+
themeName={storedThemeName}
|
|
2146
|
+
setTheme={setThemeName}
|
|
2147
|
+
themes={themes}
|
|
2148
|
+
children={children}
|
|
2149
|
+
onChange={onChange}
|
|
2150
|
+
/>
|
|
2151
|
+
</ConfigProvider>
|
|
2152
|
+
);
|
|
2153
|
+
};
|
|
2154
|
+
</file>
|
|
2155
|
+
|
|
2156
|
+
<file path="src/theme/provider/types.ts">
|
|
2157
|
+
/*
|
|
2158
|
+
* Copyright (c) 2024. Treenity Inc.
|
|
2159
|
+
*/
|
|
2160
|
+
|
|
2161
|
+
import { Theme } from '../types';
|
|
2162
|
+
|
|
2163
|
+
export interface IThemeContext {
|
|
2164
|
+
themeName: string;
|
|
2165
|
+
themes: Theme[];
|
|
2166
|
+
setTheme(theme: string): void;
|
|
2167
|
+
onChange?: (themeField: string, value: any) => void;
|
|
2168
|
+
}
|
|
2169
|
+
</file>
|
|
2170
|
+
|
|
2171
|
+
<file path="src/theme/provider/use-token.ts">
|
|
2172
|
+
/*
|
|
2173
|
+
* Copyright (c) 2024. Treenity Inc.
|
|
2174
|
+
*/
|
|
2175
|
+
|
|
2176
|
+
import { theme } from 'antd';
|
|
2177
|
+
import { MergedTokensComponents } from '../types';
|
|
2178
|
+
|
|
2179
|
+
type UseTokenResult = Omit<ReturnType<typeof theme.useToken>, 'token'> & {
|
|
2180
|
+
token: MergedTokensComponents;
|
|
2181
|
+
};
|
|
2182
|
+
|
|
2183
|
+
export function useToken(): UseTokenResult {
|
|
2184
|
+
// @ts-ignore
|
|
2185
|
+
return theme.useToken() as UseTokenResult;
|
|
2186
|
+
}
|
|
2187
|
+
</file>
|
|
2188
|
+
|
|
2189
|
+
<file path="src/theme/additional-tokens.ts">
|
|
2190
|
+
/*
|
|
2191
|
+
* Copyright (c) 2024. Treenity Inc.
|
|
2192
|
+
*/
|
|
2193
|
+
|
|
2194
|
+
export interface AdditionalTokens {
|
|
2195
|
+
advancedSiderWidth: number;
|
|
2196
|
+
advancedSiderCollapsedWidth: number;
|
|
2197
|
+
bodyBg: string;
|
|
2198
|
+
colorGrayText: string;
|
|
2199
|
+
gray400: string;
|
|
2200
|
+
colorBgPanel: string;
|
|
2201
|
+
colorBgContrast: string;
|
|
2202
|
+
colorBgSecondaryHover: string;
|
|
2203
|
+
gray500: string;
|
|
2204
|
+
gray700: string;
|
|
2205
|
+
colorBtnBgHover: string;
|
|
2206
|
+
colorBtnBgActive: string;
|
|
2207
|
+
base500: string;
|
|
2208
|
+
base600: string;
|
|
2209
|
+
base400: string;
|
|
2210
|
+
base700: string;
|
|
2211
|
+
error200: string;
|
|
2212
|
+
contrastingColorText: string;
|
|
2213
|
+
base: string;
|
|
2214
|
+
Avatar: {
|
|
2215
|
+
colorTextLightSolid: string;
|
|
2216
|
+
colorTextPlaceholder: string;
|
|
2217
|
+
};
|
|
2218
|
+
Layout: {
|
|
2219
|
+
triggerBg: string;
|
|
2220
|
+
colorBgElevated: string;
|
|
2221
|
+
siderBg: string;
|
|
2222
|
+
headerBg: string;
|
|
2223
|
+
};
|
|
2224
|
+
Panel: {
|
|
2225
|
+
colorBgContainer: string;
|
|
2226
|
+
};
|
|
2227
|
+
ColorPicker: {
|
|
2228
|
+
fontSizeSM: number;
|
|
2229
|
+
fontSizeXS: number;
|
|
2230
|
+
controlHeight: number;
|
|
2231
|
+
controlHeightSM: number;
|
|
2232
|
+
controlHeightLG: number;
|
|
2233
|
+
borderRadius: number;
|
|
2234
|
+
borderRadiusSM: number;
|
|
2235
|
+
borderRadiusLG: number;
|
|
2236
|
+
};
|
|
2237
|
+
colorBgItems: string;
|
|
2238
|
+
Button: {
|
|
2239
|
+
paddingBlockXL: string;
|
|
2240
|
+
paddingBlockXS: string;
|
|
2241
|
+
secOutlinedBg: string;
|
|
2242
|
+
secOutlinedColor: string;
|
|
2243
|
+
secOutlinedBorderColor: string;
|
|
2244
|
+
secOutlinedHoverBg: string;
|
|
2245
|
+
secOutlinedHoverColor: string;
|
|
2246
|
+
secOutlinedHoverBorderColor: string;
|
|
2247
|
+
secOutlinedActiveBg: string;
|
|
2248
|
+
secOutlinedActiveColor: string;
|
|
2249
|
+
secOutlinedActiveBorderColor: string;
|
|
2250
|
+
colorBgSecondaryHover: string;
|
|
2251
|
+
secFilledBg: string;
|
|
2252
|
+
secFilledColor: string;
|
|
2253
|
+
secFilledBorderColor: string;
|
|
2254
|
+
secFilledHoverBg: string;
|
|
2255
|
+
secFilledHoverColor: string;
|
|
2256
|
+
secFilledHoverBorderColor: string;
|
|
2257
|
+
secFilledActiveBg: string;
|
|
2258
|
+
secFilledActiveColor: string;
|
|
2259
|
+
secFilledActiveBorderColor: string;
|
|
2260
|
+
dangerFilledBg: string;
|
|
2261
|
+
dangerFilledColor: string;
|
|
2262
|
+
dangerFilledBorderColor: string;
|
|
2263
|
+
dangerFilledHoverBg: string;
|
|
2264
|
+
dangerFilledHoverColor: string;
|
|
2265
|
+
dangerFilledHoverBorderColor: string;
|
|
2266
|
+
dangerFilledActiveBg: string;
|
|
2267
|
+
dangerFilledActiveColor: string;
|
|
2268
|
+
dangerFilledActiveBorderColor: string;
|
|
2269
|
+
dangerOutlinedBg: string;
|
|
2270
|
+
dangerOutlinedColor: string;
|
|
2271
|
+
dangerOutlinedBorderColor: string;
|
|
2272
|
+
dangerOutlinedHoverBg: string;
|
|
2273
|
+
dangerOutlinedHoverColor: string;
|
|
2274
|
+
dangerOutlinedHoverBorderColor: string;
|
|
2275
|
+
dangerOutlinedActiveBg: string;
|
|
2276
|
+
dangerOutlinedActiveColor: string;
|
|
2277
|
+
dangerOutlinedActiveBorderColor: string;
|
|
2278
|
+
colorBgDangerHover: string;
|
|
2279
|
+
colorBgDanger: string;
|
|
2280
|
+
controlHeight: string;
|
|
2281
|
+
controlHeightXL: string;
|
|
2282
|
+
paddingInlineXL: string;
|
|
2283
|
+
paddingInlineXS: string;
|
|
2284
|
+
colorBorderHover: string;
|
|
2285
|
+
colorBgSecondary: string;
|
|
2286
|
+
colorBgSecondaryActive: string;
|
|
2287
|
+
borderRadiusXL: string;
|
|
2288
|
+
};
|
|
2289
|
+
Input: {
|
|
2290
|
+
colorBgContainer: string;
|
|
2291
|
+
controlHeightXL: string;
|
|
2292
|
+
controlHeightXS: string;
|
|
2293
|
+
inputFontSizeXL: string;
|
|
2294
|
+
borderRadiusXL: string;
|
|
2295
|
+
inputFontSizeXS: string;
|
|
2296
|
+
paddingInlineXL: string;
|
|
2297
|
+
paddingInlineXS: string;
|
|
2298
|
+
};
|
|
2299
|
+
Select: {
|
|
2300
|
+
borderRadiusDropdownXS: string;
|
|
2301
|
+
borderRadiusOptionXS: string;
|
|
2302
|
+
optionHeightXS: string;
|
|
2303
|
+
fontSizeXS: string;
|
|
2304
|
+
};
|
|
2305
|
+
}
|
|
2306
|
+
</file>
|
|
2307
|
+
|
|
2308
|
+
<file path="src/theme/index.ts">
|
|
2309
|
+
/*
|
|
2310
|
+
* Copyright (c) 2024. Treenity Inc.
|
|
2311
|
+
*/
|
|
2312
|
+
|
|
2313
|
+
export * from './types';
|
|
2314
|
+
export { AdditionalTokens } from './additional-tokens';
|
|
2315
|
+
|
|
2316
|
+
export * from './provider/ThemeProvider';
|
|
2317
|
+
export * from './provider/use-token';
|
|
2318
|
+
export * from './provider/theme-entity';
|
|
2319
|
+
export type { IThemeContext } from './provider/types';
|
|
2320
|
+
</file>
|
|
2321
|
+
|
|
2322
|
+
<file path="src/theme/types.ts">
|
|
2323
|
+
/*
|
|
2324
|
+
* Copyright (c) 2024. Treenity Inc.
|
|
2325
|
+
*/
|
|
2326
|
+
|
|
2327
|
+
import type { ThemeConfig as AntdThemeConfig } from 'antd';
|
|
2328
|
+
import { Theme as AntdTheme } from 'antd-token-previewer';
|
|
2329
|
+
import { AdditionalTokens } from './additional-tokens';
|
|
2330
|
+
|
|
2331
|
+
export type MergedTokens = AntdThemeConfig['token'] & AdditionalTokens;
|
|
2332
|
+
export type MergedTokensComponents<T = {}> = MergedTokens &
|
|
2333
|
+
AntdThemeConfig['components'] & {
|
|
2334
|
+
token: MergedTokens & T;
|
|
2335
|
+
} & T;
|
|
2336
|
+
|
|
2337
|
+
export type MergedConfig = Omit<AntdThemeConfig, 'token'> & {
|
|
2338
|
+
token: MergedTokens;
|
|
2339
|
+
appearance: string;
|
|
2340
|
+
};
|
|
2341
|
+
export type ThemeConfig = MergedConfig;
|
|
2342
|
+
|
|
2343
|
+
export type Theme = Omit<AntdTheme, 'config'> & {
|
|
2344
|
+
config: MergedConfig;
|
|
2345
|
+
};
|
|
2346
|
+
</file>
|
|
2347
|
+
|
|
2348
|
+
<file path="src/txt/react/layout.jsx">
|
|
2349
|
+
function TxtLayout({ children }) {
|
|
2350
|
+
return <div>Layout:
|
|
2351
|
+
<div>{children}</div>
|
|
2352
|
+
</div>;
|
|
2353
|
+
}
|
|
2354
|
+
|
|
2355
|
+
uix.add(TxtLayout);
|
|
2356
|
+
</file>
|
|
2357
|
+
|
|
2358
|
+
<file path="src/utils/portal/index.tsx">
|
|
2359
|
+
import { Component, createElement } from 'react';
|
|
2360
|
+
import { createPortal } from 'react-dom';
|
|
2361
|
+
import { IPortalHandlerProps, IPortalProps, IPortals } from './types';
|
|
2362
|
+
|
|
2363
|
+
const portals: IPortals = {};
|
|
2364
|
+
|
|
2365
|
+
export class PortalHandler extends Component<IPortalHandlerProps> {
|
|
2366
|
+
private element?: Element;
|
|
2367
|
+
|
|
2368
|
+
componentDidMount() {
|
|
2369
|
+
const { name, multi } = this.props;
|
|
2370
|
+
let portal = portals[name];
|
|
2371
|
+
if (!this.element) return;
|
|
2372
|
+
|
|
2373
|
+
if (!portal) {
|
|
2374
|
+
portal = { el: [this.element] };
|
|
2375
|
+
portals[name] = portal;
|
|
2376
|
+
} else if (!multi && portal.el?.length) {
|
|
2377
|
+
throw new Error(`Portal with name ${name} already exists`);
|
|
2378
|
+
} else {
|
|
2379
|
+
if (!portal.el) {
|
|
2380
|
+
portal.el = [];
|
|
2381
|
+
}
|
|
2382
|
+
portal.el?.push(this.element);
|
|
2383
|
+
if (portal.comp) {
|
|
2384
|
+
portal.comp.forceUpdate();
|
|
2385
|
+
}
|
|
2386
|
+
}
|
|
2387
|
+
}
|
|
2388
|
+
|
|
2389
|
+
componentWillUnmount() {
|
|
2390
|
+
delete portals[this.props.name];
|
|
2391
|
+
}
|
|
2392
|
+
|
|
2393
|
+
setRef = (ref: any) => (this.element = ref);
|
|
2394
|
+
|
|
2395
|
+
render() {
|
|
2396
|
+
return createElement(this.props.component ?? 'span', { ref: this.setRef });
|
|
2397
|
+
}
|
|
2398
|
+
}
|
|
2399
|
+
|
|
2400
|
+
export class Portal extends Component<IPortalProps> {
|
|
2401
|
+
render() {
|
|
2402
|
+
const { name, children } = this.props;
|
|
2403
|
+
|
|
2404
|
+
if (!children) {
|
|
2405
|
+
return null;
|
|
2406
|
+
}
|
|
2407
|
+
|
|
2408
|
+
const portal = portals[name];
|
|
2409
|
+
|
|
2410
|
+
if (!portal || !portal.el) {
|
|
2411
|
+
portals[name] = { comp: this };
|
|
2412
|
+
return null;
|
|
2413
|
+
}
|
|
2414
|
+
return <>{portal.el.map((el, index) => createPortal(children, el))}</>;
|
|
2415
|
+
}
|
|
2416
|
+
}
|
|
2417
|
+
</file>
|
|
2418
|
+
|
|
2419
|
+
<file path="src/utils/portal/types.ts">
|
|
2420
|
+
import type { PropsWithChildren } from 'react';
|
|
2421
|
+
|
|
2422
|
+
export interface IPortalProps extends PropsWithChildren {
|
|
2423
|
+
name: string;
|
|
2424
|
+
}
|
|
2425
|
+
|
|
2426
|
+
export interface IPortals {
|
|
2427
|
+
[key: string]: IPortalsProps;
|
|
2428
|
+
}
|
|
2429
|
+
|
|
2430
|
+
export interface IComponentPortal {
|
|
2431
|
+
forceUpdate(): void;
|
|
2432
|
+
el?: Element;
|
|
2433
|
+
}
|
|
2434
|
+
|
|
2435
|
+
export interface IPortalsProps {
|
|
2436
|
+
comp?: IComponentPortal;
|
|
2437
|
+
el?: Element[];
|
|
2438
|
+
}
|
|
2439
|
+
|
|
2440
|
+
export interface IPortalHandlerProps {
|
|
2441
|
+
name: string;
|
|
2442
|
+
component?: string;
|
|
2443
|
+
multi?: boolean;
|
|
2444
|
+
}
|
|
2445
|
+
</file>
|
|
2446
|
+
|
|
2447
|
+
<file path="src/utils/emotion-omit-props.ts">
|
|
2448
|
+
export const omitProps = (...props: string[]) => ({
|
|
2449
|
+
shouldForwardProp: (name: string) => !props.includes(name) && name[0] !== '$',
|
|
2450
|
+
});
|
|
2451
|
+
</file>
|
|
2452
|
+
|
|
2453
|
+
<file path="src/utils/image.ts">
|
|
2454
|
+
/*
|
|
2455
|
+
* Copyright (c) 2024. Treenity Inc.
|
|
2456
|
+
*/
|
|
2457
|
+
|
|
2458
|
+
import { isClient } from '@treenity/js-shared';
|
|
2459
|
+
|
|
2460
|
+
// @ts-ignore
|
|
2461
|
+
const API_URL = () => (isClient ? window.ENV.WS_API_URL : process.env.WS_API_URL);
|
|
2462
|
+
|
|
2463
|
+
export const createImageUrlFn =
|
|
2464
|
+
(defaultImage: string, defaultWidth: number, defaultHeight: number) =>
|
|
2465
|
+
(
|
|
2466
|
+
key?: string | null,
|
|
2467
|
+
width: number = defaultWidth,
|
|
2468
|
+
height: number = defaultHeight,
|
|
2469
|
+
defaultImg?: string,
|
|
2470
|
+
) => {
|
|
2471
|
+
if (typeof key !== 'string' || !key || key.length < 1) {
|
|
2472
|
+
return defaultImg || defaultImage;
|
|
2473
|
+
}
|
|
2474
|
+
|
|
2475
|
+
if (key?.startsWith('https://')) {
|
|
2476
|
+
return key;
|
|
2477
|
+
}
|
|
2478
|
+
|
|
2479
|
+
return getImageUrl(width, height, key);
|
|
2480
|
+
};
|
|
2481
|
+
|
|
2482
|
+
//This action for get image from server
|
|
2483
|
+
export const getImageUrl = (width: number, height: number, key: string) =>
|
|
2484
|
+
// `${API_URL()}/v1/image/${width}/${height}?key=${encodeURIComponent(key)}`;
|
|
2485
|
+
`${API_URL()}/api/sys/file?key=${encodeURIComponent(key)}&width=${width}&height=${height}`;
|
|
2486
|
+
|
|
2487
|
+
//This method for upload image
|
|
2488
|
+
export const getImageAction = () => `${API_URL()}/api/sys/file`;
|
|
2489
|
+
</file>
|
|
2490
|
+
|
|
2491
|
+
<file path="src/utils/normalizeComponentSize.tsx">
|
|
2492
|
+
/*
|
|
2493
|
+
* Copyright (c) 2024. Treenity Inc.
|
|
2494
|
+
*/
|
|
2495
|
+
|
|
2496
|
+
export type NormalizeSizeType = 'x-small' | 'small' | 'middle' | 'large' | 'x-large';
|
|
2497
|
+
|
|
2498
|
+
export const normalizeComponentSize = (size: NormalizeSizeType) => {
|
|
2499
|
+
if (size === 'x-large') {
|
|
2500
|
+
return 'large';
|
|
2501
|
+
}
|
|
2502
|
+
if (size === 'x-small') {
|
|
2503
|
+
return 'small';
|
|
2504
|
+
}
|
|
2505
|
+
};
|
|
2506
|
+
</file>
|
|
2507
|
+
|
|
2508
|
+
<file path="src/context.ts">
|
|
2509
|
+
export * from './context/RenderContext';
|
|
2510
|
+
</file>
|
|
2511
|
+
|
|
2512
|
+
<file path="src/form.ts">
|
|
2513
|
+
export { default as SchemaForm } from './form/index';
|
|
2514
|
+
export { default as ParseForm } from './form/parser';
|
|
2515
|
+
export { default as RefParser } from './form/ref';
|
|
2516
|
+
export * from './form/tools';
|
|
2517
|
+
export * from './form/types';
|
|
2518
|
+
</file>
|
|
2519
|
+
|
|
2520
|
+
<file path="src/hooks.ts">
|
|
2521
|
+
export { default as useToggle } from './hooks/useToggle';
|
|
2522
|
+
export { default as useStorage } from './hooks/useStorage';
|
|
2523
|
+
export { useSwrSync } from './hooks/useSwrSync';
|
|
2524
|
+
export * from './hooks/use-save-shortcut';
|
|
2525
|
+
</file>
|
|
2526
|
+
|
|
2527
|
+
<file path="src/index.ts">
|
|
2528
|
+
import type { IconNames, IIcon } from './make-icon/types';
|
|
2529
|
+
|
|
2530
|
+
export { default as makeIcon } from './make-icon';
|
|
2531
|
+
export { makeIconWithTooltip } from './make-icon/with-tooltip';
|
|
2532
|
+
|
|
2533
|
+
export * from './components/ShowAfterTimeout';
|
|
2534
|
+
export * from './components/ErrorBoundary';
|
|
2535
|
+
|
|
2536
|
+
export * from './store/create-store';
|
|
2537
|
+
|
|
2538
|
+
export * from './context';
|
|
2539
|
+
|
|
2540
|
+
export * from './render/Render';
|
|
2541
|
+
|
|
2542
|
+
export type { IIcon, IconNames };
|
|
2543
|
+
</file>
|
|
2544
|
+
|
|
2545
|
+
<file path="src/store.ts">
|
|
2546
|
+
export * from './store/create-store';
|
|
2547
|
+
export * from './store/loading';
|
|
2548
|
+
export * from './store/create-loader-store';
|
|
2549
|
+
</file>
|
|
2550
|
+
|
|
2551
|
+
<file path="src/theme.ts">
|
|
2552
|
+
export * from './theme/index';
|
|
2553
|
+
</file>
|
|
2554
|
+
|
|
2555
|
+
<file path="src/utils.ts">
|
|
2556
|
+
export * from './utils/emotion-omit-props';
|
|
2557
|
+
export * from './utils/normalizeComponentSize';
|
|
2558
|
+
export * from './utils/portal';
|
|
2559
|
+
export * from './utils/image';
|
|
2560
|
+
</file>
|
|
2561
|
+
|
|
2562
|
+
<file path="test/code/uix-export.jsx">
|
|
2563
|
+
exports.helloWorld = () => {
|
|
2564
|
+
const str = 'Hello world!';
|
|
2565
|
+
console.log(str);
|
|
2566
|
+
return str;
|
|
2567
|
+
};
|
|
2568
|
+
</file>
|
|
2569
|
+
|
|
2570
|
+
<file path="test/react/default.jsx">
|
|
2571
|
+
import ReactSelect from '/esmsh/react-select';
|
|
2572
|
+
// const { default: ReactSelect } = await uix.require('https://esm.sh/v82/react-select@5.3.2/es2022/react-select.bundle.js');
|
|
2573
|
+
|
|
2574
|
+
const options = [{ label: 'test', value: 'test' } , { label: 'test1', value: 'test1' }];
|
|
2575
|
+
|
|
2576
|
+
uix.add(() => {
|
|
2577
|
+
const [value, setValue] = uix.React.useState();
|
|
2578
|
+
return <div>
|
|
2579
|
+
<div>Hello from test</div>
|
|
2580
|
+
<ReactSelect value={value} onChange={setValue} options={options}/>
|
|
2581
|
+
</div>;
|
|
2582
|
+
});
|
|
2583
|
+
</file>
|
|
2584
|
+
|
|
2585
|
+
<file path="test/react/uix-require.jsx">
|
|
2586
|
+
const uixExports = await uix.require('uix:test/uix-export');
|
|
2587
|
+
|
|
2588
|
+
console.log('uixExports', uixExports);
|
|
2589
|
+
|
|
2590
|
+
const { helloWorld } = uixExports;
|
|
2591
|
+
|
|
2592
|
+
helloWorld();
|
|
2593
|
+
|
|
2594
|
+
uix.add(() => {
|
|
2595
|
+
return <div>{helloWorld()}</div>;
|
|
2596
|
+
});
|
|
2597
|
+
</file>
|
|
2598
|
+
|
|
2599
|
+
<file path=".npmignore">
|
|
2600
|
+
src/
|
|
2601
|
+
node_modules/
|
|
2602
|
+
tsconfig.json
|
|
2603
|
+
.prettierrc
|
|
2604
|
+
.gitignore
|
|
2605
|
+
.package-lock.json
|
|
2606
|
+
.idea
|
|
2607
|
+
.turbo
|
|
2608
|
+
.npmrc
|
|
2609
|
+
rollup.config.*
|
|
2610
|
+
docs
|
|
2611
|
+
typedoc.json
|
|
2612
|
+
jest.config.*
|
|
2613
|
+
types
|
|
2614
|
+
dist/**/stats.html
|
|
2615
|
+
</file>
|
|
2616
|
+
|
|
2617
|
+
<file path="CHANGELOG.md">
|
|
2618
|
+
# @treenity/ui-components
|
|
2619
|
+
|
|
2620
|
+
## 2.1.80
|
|
2621
|
+
|
|
2622
|
+
### Patch Changes
|
|
2623
|
+
|
|
2624
|
+
- Update version
|
|
2625
|
+
- Updated dependencies
|
|
2626
|
+
- @treenity/json-schema@0.1.41
|
|
2627
|
+
- @treenity/js-shared@1.0.35
|
|
2628
|
+
- @treenity/entity@0.5.41
|
|
2629
|
+
- @treenity/core@1.0.48
|
|
2630
|
+
|
|
2631
|
+
## 2.1.79
|
|
2632
|
+
|
|
2633
|
+
### Patch Changes
|
|
2634
|
+
|
|
2635
|
+
- Update version
|
|
2636
|
+
|
|
2637
|
+
## 2.1.78
|
|
2638
|
+
|
|
2639
|
+
### Patch Changes
|
|
2640
|
+
|
|
2641
|
+
- update version
|
|
2642
|
+
- Updated dependencies
|
|
2643
|
+
- @treenity/json-schema@0.1.40
|
|
2644
|
+
- @treenity/core@1.0.47
|
|
2645
|
+
- @treenity/entity@0.5.40
|
|
2646
|
+
|
|
2647
|
+
## 2.1.77
|
|
2648
|
+
|
|
2649
|
+
### Patch Changes
|
|
2650
|
+
|
|
2651
|
+
- Update version
|
|
2652
|
+
|
|
2653
|
+
## 2.1.76
|
|
2654
|
+
|
|
2655
|
+
### Patch Changes
|
|
2656
|
+
|
|
2657
|
+
- Update version
|
|
2658
|
+
|
|
2659
|
+
## 2.1.75
|
|
2660
|
+
|
|
2661
|
+
### Patch Changes
|
|
2662
|
+
|
|
2663
|
+
- Update version
|
|
2664
|
+
|
|
2665
|
+
## 2.1.74
|
|
2666
|
+
|
|
2667
|
+
### Patch Changes
|
|
2668
|
+
|
|
2669
|
+
- Update version
|
|
2670
|
+
- Updated dependencies
|
|
2671
|
+
- @treenity/js-shared@1.0.34
|
|
2672
|
+
- @treenity/entity@0.5.39
|
|
2673
|
+
- @treenity/core@1.0.46
|
|
2674
|
+
|
|
2675
|
+
## 2.1.73
|
|
2676
|
+
|
|
2677
|
+
### Patch Changes
|
|
2678
|
+
|
|
2679
|
+
- Updated dependencies
|
|
2680
|
+
- @treenity/entity@0.5.38
|
|
2681
|
+
- @treenity/core@1.0.45
|
|
2682
|
+
|
|
2683
|
+
## 2.1.72
|
|
2684
|
+
|
|
2685
|
+
### Patch Changes
|
|
2686
|
+
|
|
2687
|
+
- Update libs
|
|
2688
|
+
- Updated dependencies
|
|
2689
|
+
- @treenity/js-shared@1.0.33
|
|
2690
|
+
- @treenity/entity@0.5.37
|
|
2691
|
+
- @treenity/core@1.0.44
|
|
2692
|
+
|
|
2693
|
+
## 2.1.71
|
|
2694
|
+
|
|
2695
|
+
### Patch Changes
|
|
2696
|
+
|
|
2697
|
+
- Update version
|
|
2698
|
+
- Updated dependencies
|
|
2699
|
+
- @treenity/js-shared@1.0.32
|
|
2700
|
+
- @treenity/entity@0.5.36
|
|
2701
|
+
- @treenity/core@1.0.43
|
|
2702
|
+
|
|
2703
|
+
## 2.1.70
|
|
2704
|
+
|
|
2705
|
+
### Patch Changes
|
|
2706
|
+
|
|
2707
|
+
- Updated dependencies
|
|
2708
|
+
- @treenity/entity@0.5.35
|
|
2709
|
+
|
|
2710
|
+
## 2.1.69
|
|
2711
|
+
|
|
2712
|
+
### Patch Changes
|
|
2713
|
+
|
|
2714
|
+
- Update version
|
|
2715
|
+
- Updated dependencies
|
|
2716
|
+
- @treenity/js-shared@1.0.31
|
|
2717
|
+
- @treenity/entity@0.5.34
|
|
2718
|
+
- @treenity/core@1.0.42
|
|
2719
|
+
|
|
2720
|
+
## 2.1.68
|
|
2721
|
+
|
|
2722
|
+
### Patch Changes
|
|
2723
|
+
|
|
2724
|
+
- Update version
|
|
2725
|
+
- Updated dependencies
|
|
2726
|
+
- @treenity/entity@0.5.33
|
|
2727
|
+
|
|
2728
|
+
## 2.1.67
|
|
2729
|
+
|
|
2730
|
+
### Patch Changes
|
|
2731
|
+
|
|
2732
|
+
- Updated dependencies
|
|
2733
|
+
- @treenity/core@1.0.41
|
|
2734
|
+
- @treenity/entity@0.5.32
|
|
2735
|
+
|
|
2736
|
+
## 2.1.66
|
|
2737
|
+
|
|
2738
|
+
### Patch Changes
|
|
2739
|
+
|
|
2740
|
+
- Updated dependencies
|
|
2741
|
+
- @treenity/js-shared@1.0.30
|
|
2742
|
+
- @treenity/core@1.0.40
|
|
2743
|
+
- @treenity/entity@0.5.31
|
|
2744
|
+
|
|
2745
|
+
## 2.1.65
|
|
2746
|
+
|
|
2747
|
+
### Patch Changes
|
|
2748
|
+
|
|
2749
|
+
- Updated dependencies
|
|
2750
|
+
- @treenity/entity@0.5.30
|
|
2751
|
+
|
|
2752
|
+
## 2.1.64
|
|
2753
|
+
|
|
2754
|
+
### Patch Changes
|
|
2755
|
+
|
|
2756
|
+
- Update version
|
|
2757
|
+
|
|
2758
|
+
## 2.1.63
|
|
2759
|
+
|
|
2760
|
+
### Patch Changes
|
|
2761
|
+
|
|
2762
|
+
- Update version
|
|
2763
|
+
- Updated dependencies
|
|
2764
|
+
- @treenity/entity@0.5.29
|
|
2765
|
+
|
|
2766
|
+
## 2.1.62
|
|
2767
|
+
|
|
2768
|
+
### Patch Changes
|
|
2769
|
+
|
|
2770
|
+
- Update version
|
|
2771
|
+
|
|
2772
|
+
## 2.1.61
|
|
2773
|
+
|
|
2774
|
+
### Patch Changes
|
|
2775
|
+
|
|
2776
|
+
- Update version
|
|
2777
|
+
|
|
2778
|
+
## 2.1.60
|
|
2779
|
+
|
|
2780
|
+
### Patch Changes
|
|
2781
|
+
|
|
2782
|
+
- Update webeditor config
|
|
2783
|
+
|
|
2784
|
+
## 2.1.59
|
|
2785
|
+
|
|
2786
|
+
### Patch Changes
|
|
2787
|
+
|
|
2788
|
+
- Update libs
|
|
2789
|
+
- Updated dependencies
|
|
2790
|
+
- @treenity/js-shared@1.0.29
|
|
2791
|
+
- @treenity/entity@0.5.28
|
|
2792
|
+
- @treenity/core@1.0.39
|
|
2793
|
+
|
|
2794
|
+
## 2.1.58
|
|
2795
|
+
|
|
2796
|
+
### Patch Changes
|
|
2797
|
+
|
|
2798
|
+
- Updated dependencies
|
|
2799
|
+
- @treenity/core@1.0.38
|
|
2800
|
+
- @treenity/entity@0.5.27
|
|
2801
|
+
|
|
2802
|
+
## 2.1.57
|
|
2803
|
+
|
|
2804
|
+
### Patch Changes
|
|
2805
|
+
|
|
2806
|
+
- Updated dependencies
|
|
2807
|
+
- @treenity/js-shared@1.0.28
|
|
2808
|
+
- @treenity/core@1.0.37
|
|
2809
|
+
- @treenity/entity@0.5.26
|
|
2810
|
+
|
|
2811
|
+
## 2.1.56
|
|
2812
|
+
|
|
2813
|
+
### Patch Changes
|
|
2814
|
+
|
|
2815
|
+
- Update libs
|
|
2816
|
+
|
|
2817
|
+
## 2.1.55
|
|
2818
|
+
|
|
2819
|
+
### Patch Changes
|
|
2820
|
+
|
|
2821
|
+
- Update emotion
|
|
2822
|
+
|
|
2823
|
+
## 2.1.54
|
|
2824
|
+
|
|
2825
|
+
### Patch Changes
|
|
2826
|
+
|
|
2827
|
+
- Remove default theme from theme provider
|
|
2828
|
+
|
|
2829
|
+
## 2.1.53
|
|
2830
|
+
|
|
2831
|
+
### Patch Changes
|
|
2832
|
+
|
|
2833
|
+
- Fix editor
|
|
2834
|
+
|
|
2835
|
+
## 2.1.52
|
|
2836
|
+
|
|
2837
|
+
### Patch Changes
|
|
2838
|
+
|
|
2839
|
+
- Updated dependencies
|
|
2840
|
+
- @treenity/entity@0.5.25
|
|
2841
|
+
|
|
2842
|
+
## 2.1.51
|
|
2843
|
+
|
|
2844
|
+
### Patch Changes
|
|
2845
|
+
|
|
2846
|
+
- Update versions
|
|
2847
|
+
- Updated dependencies
|
|
2848
|
+
- @treenity/entity@0.5.24
|
|
2849
|
+
- @treenity/core@1.0.36
|
|
2850
|
+
|
|
2851
|
+
## 2.1.50
|
|
2852
|
+
|
|
2853
|
+
### Patch Changes
|
|
2854
|
+
|
|
2855
|
+
- Update version
|
|
2856
|
+
- Updated dependencies
|
|
2857
|
+
- @treenity/entity@0.5.23
|
|
2858
|
+
- @treenity/core@1.0.35
|
|
2859
|
+
|
|
2860
|
+
## 2.1.49
|
|
2861
|
+
|
|
2862
|
+
### Patch Changes
|
|
2863
|
+
|
|
2864
|
+
- update create feathers client in repositroy
|
|
2865
|
+
- Updated dependencies
|
|
2866
|
+
- @treenity/js-shared@1.0.27
|
|
2867
|
+
- @treenity/core@1.0.34
|
|
2868
|
+
- @treenity/entity@0.5.22
|
|
2869
|
+
|
|
2870
|
+
## 2.1.48
|
|
2871
|
+
|
|
2872
|
+
### Patch Changes
|
|
2873
|
+
|
|
2874
|
+
- update version
|
|
2875
|
+
- Updated dependencies
|
|
2876
|
+
- @treenity/js-shared@1.0.26
|
|
2877
|
+
- @treenity/entity@0.5.21
|
|
2878
|
+
- @treenity/core@1.0.33
|
|
2879
|
+
|
|
2880
|
+
## 2.1.47
|
|
2881
|
+
|
|
2882
|
+
### Patch Changes
|
|
2883
|
+
|
|
2884
|
+
- Update webeditor
|
|
2885
|
+
- Updated dependencies
|
|
2886
|
+
- @treenity/entity@0.5.20
|
|
2887
|
+
|
|
2888
|
+
## 2.1.46
|
|
2889
|
+
|
|
2890
|
+
### Patch Changes
|
|
2891
|
+
|
|
2892
|
+
- Some change
|
|
2893
|
+
- Updated dependencies
|
|
2894
|
+
- @treenity/js-shared@1.0.25
|
|
2895
|
+
- @treenity/entity@0.5.19
|
|
2896
|
+
- @treenity/core@1.0.32
|
|
2897
|
+
|
|
2898
|
+
## 2.1.45
|
|
2899
|
+
|
|
2900
|
+
### Patch Changes
|
|
2901
|
+
|
|
2902
|
+
- @treenity/entity@0.5.18
|
|
2903
|
+
|
|
2904
|
+
## 2.1.44
|
|
2905
|
+
|
|
2906
|
+
### Patch Changes
|
|
2907
|
+
|
|
2908
|
+
- Fix animation
|
|
2909
|
+
|
|
2910
|
+
## 2.1.43
|
|
2911
|
+
|
|
2912
|
+
### Patch Changes
|
|
2913
|
+
|
|
2914
|
+
- Updated dependencies
|
|
2915
|
+
- @treenity/js-shared@1.0.24
|
|
2916
|
+
- @treenity/entity@0.5.17
|
|
2917
|
+
- @treenity/core@1.0.31
|
|
2918
|
+
|
|
2919
|
+
## 2.1.42
|
|
2920
|
+
|
|
2921
|
+
### Patch Changes
|
|
2922
|
+
|
|
2923
|
+
- Add json files to a bundle
|
|
2924
|
+
|
|
2925
|
+
## 2.1.41
|
|
2926
|
+
|
|
2927
|
+
### Patch Changes
|
|
2928
|
+
|
|
2929
|
+
- Update libs
|
|
2930
|
+
- Updated dependencies
|
|
2931
|
+
- @treenity/entity@0.5.16
|
|
2932
|
+
- @treenity/core@1.0.30
|
|
2933
|
+
|
|
2934
|
+
## 2.1.40
|
|
2935
|
+
|
|
2936
|
+
### Patch Changes
|
|
2937
|
+
|
|
2938
|
+
- Update webeditor and add new register component
|
|
2939
|
+
- Updated dependencies
|
|
2940
|
+
- @treenity/core@1.0.29
|
|
2941
|
+
- @treenity/entity@0.5.15
|
|
2942
|
+
|
|
2943
|
+
## 2.1.39
|
|
2944
|
+
|
|
2945
|
+
### Patch Changes
|
|
2946
|
+
|
|
2947
|
+
- Updated libs
|
|
2948
|
+
- Updated dependencies
|
|
2949
|
+
- @treenity/entity@0.5.14
|
|
2950
|
+
|
|
2951
|
+
## 2.1.38
|
|
2952
|
+
|
|
2953
|
+
### Patch Changes
|
|
2954
|
+
|
|
2955
|
+
- Fix lower case login, add access check in rest
|
|
2956
|
+
|
|
2957
|
+
## 2.1.37
|
|
2958
|
+
|
|
2959
|
+
### Patch Changes
|
|
2960
|
+
|
|
2961
|
+
- Update components
|
|
2962
|
+
|
|
2963
|
+
## 2.1.36
|
|
2964
|
+
|
|
2965
|
+
### Patch Changes
|
|
2966
|
+
|
|
2967
|
+
- Some updates
|
|
2968
|
+
|
|
2969
|
+
## 2.1.35
|
|
2970
|
+
|
|
2971
|
+
### Patch Changes
|
|
2972
|
+
|
|
2973
|
+
- Update image work
|
|
2974
|
+
|
|
2975
|
+
## 2.1.34
|
|
2976
|
+
|
|
2977
|
+
### Patch Changes
|
|
2978
|
+
|
|
2979
|
+
- Fix styles in admin components
|
|
2980
|
+
- Updated dependencies
|
|
2981
|
+
- @treenity/entity@0.5.13
|
|
2982
|
+
- @treenity/core@1.0.28
|
|
2983
|
+
|
|
2984
|
+
## 2.1.33
|
|
2985
|
+
|
|
2986
|
+
### Patch Changes
|
|
2987
|
+
|
|
2988
|
+
- Fix bugs
|
|
2989
|
+
|
|
2990
|
+
## 2.1.32
|
|
2991
|
+
|
|
2992
|
+
### Patch Changes
|
|
2993
|
+
|
|
2994
|
+
- other changes
|
|
2995
|
+
|
|
2996
|
+
## 2.1.31
|
|
2997
|
+
|
|
2998
|
+
### Patch Changes
|
|
2999
|
+
|
|
3000
|
+
- Giga update
|
|
3001
|
+
- Updated dependencies
|
|
3002
|
+
- @treenity/entity@0.5.12
|
|
3003
|
+
- @treenity/core@1.0.27
|
|
3004
|
+
|
|
3005
|
+
## 2.1.30
|
|
3006
|
+
|
|
3007
|
+
### Patch Changes
|
|
3008
|
+
|
|
3009
|
+
- Fix outline button colors
|
|
3010
|
+
|
|
3011
|
+
## 2.1.29
|
|
3012
|
+
|
|
3013
|
+
### Patch Changes
|
|
3014
|
+
|
|
3015
|
+
- Update components and theme
|
|
3016
|
+
|
|
3017
|
+
## 2.1.28
|
|
3018
|
+
|
|
3019
|
+
### Patch Changes
|
|
3020
|
+
|
|
3021
|
+
- Bug fix
|
|
3022
|
+
|
|
3023
|
+
## 2.1.27
|
|
3024
|
+
|
|
3025
|
+
### Patch Changes
|
|
3026
|
+
|
|
3027
|
+
- Update components
|
|
3028
|
+
|
|
3029
|
+
## 2.1.26
|
|
3030
|
+
|
|
3031
|
+
### Patch Changes
|
|
3032
|
+
|
|
3033
|
+
- Update components
|
|
3034
|
+
|
|
3035
|
+
## 2.1.25
|
|
3036
|
+
|
|
3037
|
+
### Patch Changes
|
|
3038
|
+
|
|
3039
|
+
- Move the theme editor to admin-components
|
|
3040
|
+
|
|
3041
|
+
## 2.1.24
|
|
3042
|
+
|
|
3043
|
+
### Patch Changes
|
|
3044
|
+
|
|
3045
|
+
- Fix theme provider theme merging
|
|
3046
|
+
|
|
3047
|
+
## 2.1.23
|
|
3048
|
+
|
|
3049
|
+
### Patch Changes
|
|
3050
|
+
|
|
3051
|
+
- Update components
|
|
3052
|
+
|
|
3053
|
+
## 2.1.22
|
|
3054
|
+
|
|
3055
|
+
### Patch Changes
|
|
3056
|
+
|
|
3057
|
+
- fix exchanger default and fix ui-kit
|
|
3058
|
+
|
|
3059
|
+
## 2.1.21
|
|
3060
|
+
|
|
3061
|
+
### Patch Changes
|
|
3062
|
+
|
|
3063
|
+
- Update components
|
|
3064
|
+
|
|
3065
|
+
## 2.1.20
|
|
3066
|
+
|
|
3067
|
+
### Patch Changes
|
|
3068
|
+
|
|
3069
|
+
- Update libs
|
|
3070
|
+
- Updated dependencies
|
|
3071
|
+
- @treenity/entity@0.5.11
|
|
3072
|
+
|
|
3073
|
+
## 2.1.19
|
|
3074
|
+
|
|
3075
|
+
### Patch Changes
|
|
3076
|
+
|
|
3077
|
+
- Many updates
|
|
3078
|
+
- Updated dependencies
|
|
3079
|
+
- @treenity/js-shared@1.0.23
|
|
3080
|
+
- @treenity/core@1.0.26
|
|
3081
|
+
- @treenity/entity@0.5.10
|
|
3082
|
+
|
|
3083
|
+
## 2.1.18
|
|
3084
|
+
|
|
3085
|
+
### Patch Changes
|
|
3086
|
+
|
|
3087
|
+
- Add translate and some changes
|
|
3088
|
+
|
|
3089
|
+
## 2.1.17
|
|
3090
|
+
|
|
3091
|
+
### Patch Changes
|
|
3092
|
+
|
|
3093
|
+
- Update version
|
|
3094
|
+
|
|
3095
|
+
## 2.1.16
|
|
3096
|
+
|
|
3097
|
+
### Patch Changes
|
|
3098
|
+
|
|
3099
|
+
- Add logs and fixed icons
|
|
3100
|
+
|
|
3101
|
+
## 2.1.15
|
|
3102
|
+
|
|
3103
|
+
### Patch Changes
|
|
3104
|
+
|
|
3105
|
+
- Update libs
|
|
3106
|
+
- Updated dependencies
|
|
3107
|
+
- @treenity/core@1.0.25
|
|
3108
|
+
|
|
3109
|
+
## 2.1.14
|
|
3110
|
+
|
|
3111
|
+
### Patch Changes
|
|
3112
|
+
|
|
3113
|
+
- Updated dependencies
|
|
3114
|
+
- @treenity/js-shared@1.0.22
|
|
3115
|
+
- @treenity/core@1.0.24
|
|
3116
|
+
|
|
3117
|
+
## 2.1.13
|
|
3118
|
+
|
|
3119
|
+
### Patch Changes
|
|
3120
|
+
|
|
3121
|
+
- Add entity and other changes
|
|
3122
|
+
- Updated dependencies
|
|
3123
|
+
- @treenity/js-shared@1.0.21
|
|
3124
|
+
- @treenity/core@1.0.23
|
|
3125
|
+
|
|
3126
|
+
## 2.1.12
|
|
3127
|
+
|
|
3128
|
+
### Patch Changes
|
|
3129
|
+
|
|
3130
|
+
- some changes
|
|
3131
|
+
|
|
3132
|
+
## 2.1.11
|
|
3133
|
+
|
|
3134
|
+
### Patch Changes
|
|
3135
|
+
|
|
3136
|
+
- Update deps
|
|
3137
|
+
- Updated dependencies
|
|
3138
|
+
- @treenity/js-shared@1.0.20
|
|
3139
|
+
- @treenity/core@1.0.22
|
|
3140
|
+
|
|
3141
|
+
## 2.1.10
|
|
3142
|
+
|
|
3143
|
+
### Patch Changes
|
|
3144
|
+
|
|
3145
|
+
- Updated dependencies
|
|
3146
|
+
- @treenity/core@1.0.21
|
|
3147
|
+
|
|
3148
|
+
## 2.1.9
|
|
3149
|
+
|
|
3150
|
+
### Patch Changes
|
|
3151
|
+
|
|
3152
|
+
- Updated dependencies
|
|
3153
|
+
- @treenity/js-shared@1.0.19
|
|
3154
|
+
- @treenity/core@1.0.20
|
|
3155
|
+
|
|
3156
|
+
## 2.1.8
|
|
3157
|
+
|
|
3158
|
+
### Patch Changes
|
|
3159
|
+
|
|
3160
|
+
- Update something
|
|
3161
|
+
- Updated dependencies
|
|
3162
|
+
- @treenity/js-shared@1.0.18
|
|
3163
|
+
- @treenity/core@1.0.19
|
|
3164
|
+
|
|
3165
|
+
## 2.1.7
|
|
3166
|
+
|
|
3167
|
+
### Patch Changes
|
|
3168
|
+
|
|
3169
|
+
- Update version for stabilization build
|
|
3170
|
+
- Updated dependencies
|
|
3171
|
+
- @treenity/js-shared@1.0.17
|
|
3172
|
+
|
|
3173
|
+
## 2.1.6
|
|
3174
|
+
|
|
3175
|
+
### Patch Changes
|
|
3176
|
+
|
|
3177
|
+
- Add types
|
|
3178
|
+
- Updated dependencies
|
|
3179
|
+
- @treenity/js-shared@1.0.16
|
|
3180
|
+
|
|
3181
|
+
## 2.1.5
|
|
3182
|
+
|
|
3183
|
+
### Patch Changes
|
|
3184
|
+
|
|
3185
|
+
- Updated dependencies
|
|
3186
|
+
- @treenity/js-shared@1.0.15
|
|
3187
|
+
|
|
3188
|
+
## 2.1.4
|
|
3189
|
+
|
|
3190
|
+
### Patch Changes
|
|
3191
|
+
|
|
3192
|
+
- Update versions
|
|
3193
|
+
- Updated dependencies
|
|
3194
|
+
- @treenity/js-shared@1.0.14
|
|
3195
|
+
|
|
3196
|
+
## 2.1.3
|
|
3197
|
+
|
|
3198
|
+
### Patch Changes
|
|
3199
|
+
|
|
3200
|
+
- Update versions
|
|
3201
|
+
|
|
3202
|
+
## 2.1.2
|
|
3203
|
+
|
|
3204
|
+
### Patch Changes
|
|
3205
|
+
|
|
3206
|
+
- Add portal
|
|
3207
|
+
|
|
3208
|
+
## 2.1.1
|
|
3209
|
+
|
|
3210
|
+
### Patch Changes
|
|
3211
|
+
|
|
3212
|
+
- Update icons
|
|
3213
|
+
|
|
3214
|
+
## 2.1.0
|
|
3215
|
+
|
|
3216
|
+
### Minor Changes
|
|
3217
|
+
|
|
3218
|
+
- Add useToggle
|
|
3219
|
+
|
|
3220
|
+
## 2.0.8
|
|
3221
|
+
|
|
3222
|
+
### Patch Changes
|
|
3223
|
+
|
|
3224
|
+
- Some changes
|
|
3225
|
+
- Updated dependencies
|
|
3226
|
+
- @treenity/js-shared@1.0.13
|
|
3227
|
+
|
|
3228
|
+
## 2.0.7
|
|
3229
|
+
|
|
3230
|
+
### Patch Changes
|
|
3231
|
+
|
|
3232
|
+
- Updated packages version
|
|
3233
|
+
- Updated dependencies
|
|
3234
|
+
- @treenity/js-shared@1.0.12
|
|
3235
|
+
|
|
3236
|
+
## 2.0.6
|
|
3237
|
+
|
|
3238
|
+
### Patch Changes
|
|
3239
|
+
|
|
3240
|
+
- Updated libs
|
|
3241
|
+
|
|
3242
|
+
## 2.0.5
|
|
3243
|
+
|
|
3244
|
+
### Patch Changes
|
|
3245
|
+
|
|
3246
|
+
- Updated libs
|
|
3247
|
+
|
|
3248
|
+
## 2.0.4
|
|
3249
|
+
|
|
3250
|
+
### Patch Changes
|
|
3251
|
+
|
|
3252
|
+
- Updated dependencies
|
|
3253
|
+
- @treenity/streams@1.0.20
|
|
3254
|
+
|
|
3255
|
+
## 2.0.3
|
|
3256
|
+
|
|
3257
|
+
### Patch Changes
|
|
3258
|
+
|
|
3259
|
+
- Updated libs
|
|
3260
|
+
- Updated dependencies
|
|
3261
|
+
- @treenity/streams@1.0.19
|
|
3262
|
+
- @treenity/js-shared@1.0.11
|
|
3263
|
+
|
|
3264
|
+
## 2.0.2
|
|
3265
|
+
|
|
3266
|
+
### Patch Changes
|
|
3267
|
+
|
|
3268
|
+
- Updated dependencies
|
|
3269
|
+
- @treenity/streams@1.0.18
|
|
3270
|
+
|
|
3271
|
+
## 2.0.1
|
|
3272
|
+
|
|
3273
|
+
### Patch Changes
|
|
3274
|
+
|
|
3275
|
+
- Changed version
|
|
3276
|
+
- Updated dependencies
|
|
3277
|
+
- @treenity/streams@1.0.17
|
|
3278
|
+
- @treenity/js-shared@1.0.10
|
|
3279
|
+
|
|
3280
|
+
## 2.0.0
|
|
3281
|
+
|
|
3282
|
+
### Major Changes
|
|
3283
|
+
|
|
3284
|
+
- Fixed bugs
|
|
3285
|
+
|
|
3286
|
+
## 1.0.7
|
|
3287
|
+
|
|
3288
|
+
### Patch Changes
|
|
3289
|
+
|
|
3290
|
+
- Fix type script error and add missing package
|
|
3291
|
+
|
|
3292
|
+
## 1.0.6
|
|
3293
|
+
|
|
3294
|
+
### Patch Changes
|
|
3295
|
+
|
|
3296
|
+
- Updated libs
|
|
3297
|
+
- Updated dependencies
|
|
3298
|
+
- @treenity/js-shared@1.0.9
|
|
3299
|
+
|
|
3300
|
+
## 1.0.5
|
|
3301
|
+
|
|
3302
|
+
### Patch Changes
|
|
3303
|
+
|
|
3304
|
+
- 95f4620: update ui-kit
|
|
3305
|
+
|
|
3306
|
+
## 1.0.5
|
|
3307
|
+
|
|
3308
|
+
### Patch Changes
|
|
3309
|
+
|
|
3310
|
+
- Updated dependencies
|
|
3311
|
+
- @treenity/js-shared@1.0.8
|
|
3312
|
+
|
|
3313
|
+
## 1.0.4
|
|
3314
|
+
|
|
3315
|
+
### Patch Changes
|
|
3316
|
+
|
|
3317
|
+
- Fixed build
|
|
3318
|
+
|
|
3319
|
+
## 1.0.3
|
|
3320
|
+
|
|
3321
|
+
### Patch Changes
|
|
3322
|
+
|
|
3323
|
+
- Updated versions
|
|
3324
|
+
- Updated dependencies
|
|
3325
|
+
- @treenity/js-shared@1.0.5
|
|
3326
|
+
|
|
3327
|
+
## 1.0.2
|
|
3328
|
+
|
|
3329
|
+
### Patch Changes
|
|
3330
|
+
|
|
3331
|
+
- Updated version to update new front-proxy
|
|
3332
|
+
- Updated dependencies
|
|
3333
|
+
- @treenity/js-shared@1.0.4
|
|
3334
|
+
</file>
|
|
3335
|
+
|
|
3336
|
+
<file path="emotion.d.ts">
|
|
3337
|
+
import { MergedTokensComponents } from './dist/theme/types';
|
|
3338
|
+
|
|
3339
|
+
declare module '@emotion/react' {
|
|
3340
|
+
export interface Theme extends MergedTokensComponents {}
|
|
3341
|
+
}
|
|
3342
|
+
</file>
|
|
3343
|
+
|
|
3344
|
+
<file path="global.d.ts">
|
|
3345
|
+
declare module '*.module.scss';
|
|
3346
|
+
</file>
|
|
3347
|
+
|
|
3348
|
+
<file path="package.json">
|
|
3349
|
+
{
|
|
3350
|
+
"name": "@treenity/ui-kit",
|
|
3351
|
+
"version": "2.1.80",
|
|
3352
|
+
"description": "txt.dev ui kit",
|
|
3353
|
+
"author": "Treenity",
|
|
3354
|
+
"license": "ISC",
|
|
3355
|
+
"scripts": {
|
|
3356
|
+
"build": "rollup -c",
|
|
3357
|
+
"watch": "rollup -c -w",
|
|
3358
|
+
"clean": "treenity-clean",
|
|
3359
|
+
"portmanager:test": "jest ./src/test/*"
|
|
3360
|
+
},
|
|
3361
|
+
"bin": {
|
|
3362
|
+
"icomoon-gen": "./src/make-icon/icomoon-gen.mjs"
|
|
3363
|
+
},
|
|
3364
|
+
"type": "module",
|
|
3365
|
+
"module": "./dist/index.mjs",
|
|
3366
|
+
"types": "./dist/index.d.ts",
|
|
3367
|
+
"exports": {
|
|
3368
|
+
".": {
|
|
3369
|
+
"types": "./dist/index.d.ts",
|
|
3370
|
+
"default": "./dist/index.mjs"
|
|
3371
|
+
},
|
|
3372
|
+
"./utils": {
|
|
3373
|
+
"types": "./dist/utils.d.ts",
|
|
3374
|
+
"default": "./dist/utils.mjs"
|
|
3375
|
+
},
|
|
3376
|
+
"./hooks": {
|
|
3377
|
+
"types": "./dist/hooks.d.ts",
|
|
3378
|
+
"default": "./dist/hooks.mjs"
|
|
3379
|
+
},
|
|
3380
|
+
"./store": {
|
|
3381
|
+
"types": "./dist/store.d.ts",
|
|
3382
|
+
"default": "./dist/store.mjs"
|
|
3383
|
+
},
|
|
3384
|
+
"./form": {
|
|
3385
|
+
"types": "./dist/form.d.ts",
|
|
3386
|
+
"default": "./dist/form.mjs"
|
|
3387
|
+
},
|
|
3388
|
+
"./theme": {
|
|
3389
|
+
"types": "./dist/theme.d.ts",
|
|
3390
|
+
"default": "./dist/theme.mjs"
|
|
3391
|
+
},
|
|
3392
|
+
"./styles.css": "./dist/assets/styles.css"
|
|
3393
|
+
},
|
|
3394
|
+
"typesVersions": {
|
|
3395
|
+
"*": {
|
|
3396
|
+
".": [
|
|
3397
|
+
"./dist/index.d.ts"
|
|
3398
|
+
],
|
|
3399
|
+
"form": [
|
|
3400
|
+
"./dist/form.d.ts"
|
|
3401
|
+
],
|
|
3402
|
+
"utils": [
|
|
3403
|
+
"./dist/utils.d.ts"
|
|
3404
|
+
],
|
|
3405
|
+
"hooks": [
|
|
3406
|
+
"./dist/hooks.d.ts"
|
|
3407
|
+
],
|
|
3408
|
+
"store": [
|
|
3409
|
+
"./dist/store.d.ts"
|
|
3410
|
+
],
|
|
3411
|
+
"theme": [
|
|
3412
|
+
"./dist/theme.d.ts"
|
|
3413
|
+
]
|
|
3414
|
+
}
|
|
3415
|
+
},
|
|
3416
|
+
"files": [
|
|
3417
|
+
"/dist/**/*.d.ts",
|
|
3418
|
+
"/dist/**/*.mjs",
|
|
3419
|
+
"/dist/**/*.json",
|
|
3420
|
+
"/dist/assets",
|
|
3421
|
+
"package.json"
|
|
3422
|
+
],
|
|
3423
|
+
"dependencies": {
|
|
3424
|
+
"@ant-design/cssinjs": "^1.22.0",
|
|
3425
|
+
"@s-libs/micro-dash": "^17.1.0",
|
|
3426
|
+
"@treenity/core": "1.0.48",
|
|
3427
|
+
"@treenity/entity": "0.5.41",
|
|
3428
|
+
"@treenity/js-shared": "1.0.35",
|
|
3429
|
+
"@treenity/json-schema": "0.1.41",
|
|
3430
|
+
"antd-token-previewer": "^2.0.8",
|
|
3431
|
+
"classnames": "^2.5.1",
|
|
3432
|
+
"immer": "10.0.3",
|
|
3433
|
+
"lodash": "npm:@s-libs/micro-dash@^18.0.0",
|
|
3434
|
+
"rc-util": "^5.38.1",
|
|
3435
|
+
"react-colorful": "^5.6.1",
|
|
3436
|
+
"react-layout-kit": "^1.7.4",
|
|
3437
|
+
"swr": "2.3.0",
|
|
3438
|
+
"tinycolor2": "^1.6.0",
|
|
3439
|
+
"tslib": "^2.8.1",
|
|
3440
|
+
"use-debouncy": "^5.0.1",
|
|
3441
|
+
"zustand": "^4.5.5"
|
|
3442
|
+
},
|
|
3443
|
+
"peerDependencies": {
|
|
3444
|
+
"@emotion/react": "^11.13.5",
|
|
3445
|
+
"@emotion/styled": "^11.13.5",
|
|
3446
|
+
"antd": "^5.22.1",
|
|
3447
|
+
"react": "^18.3.1",
|
|
3448
|
+
"react-dom": "^18.3.1"
|
|
3449
|
+
},
|
|
3450
|
+
"devDependencies": {
|
|
3451
|
+
"@emotion/react": "^11.13.5",
|
|
3452
|
+
"@emotion/styled": "^11.13.5",
|
|
3453
|
+
"@treenity/build-utils": "1.1.32",
|
|
3454
|
+
"@treenity/tsconfig": "1.0.14",
|
|
3455
|
+
"@types/lodash": "npm:@s-libs/micro-dash@^18.0.0",
|
|
3456
|
+
"@types/react": "18.2.51",
|
|
3457
|
+
"@types/react-dom": "18.2.18",
|
|
3458
|
+
"css": "^3.0.0",
|
|
3459
|
+
"jest": "^29.7.0",
|
|
3460
|
+
"resize-observer-polyfill": "^1.5.1",
|
|
3461
|
+
"rollup": "^4.26.0",
|
|
3462
|
+
"rollup-plugin-copy": "3.5.0",
|
|
3463
|
+
"sass": "^1.70.0",
|
|
3464
|
+
"typescript": "^5.4.5",
|
|
3465
|
+
"typescript-plugin-css-modules": "^5.0.2"
|
|
3466
|
+
}
|
|
3467
|
+
}
|
|
3468
|
+
</file>
|
|
3469
|
+
|
|
3470
|
+
<file path="rollup.config.mjs">
|
|
3471
|
+
import { libraryConfig } from '@treenity/build-utils/library-config.js';
|
|
3472
|
+
|
|
3473
|
+
const inputs = [
|
|
3474
|
+
'src/index.ts',
|
|
3475
|
+
'src/utils.ts',
|
|
3476
|
+
'src/hooks.ts',
|
|
3477
|
+
'src/store.ts',
|
|
3478
|
+
'src/theme.ts',
|
|
3479
|
+
'src/form.ts',
|
|
3480
|
+
];
|
|
3481
|
+
|
|
3482
|
+
export default [
|
|
3483
|
+
libraryConfig(inputs, 'browser', {
|
|
3484
|
+
check: false,
|
|
3485
|
+
only: true,
|
|
3486
|
+
external: ['react', 'react-dom', '@emotion/react', '@emotion/styled'],
|
|
3487
|
+
}),
|
|
3488
|
+
];
|
|
3489
|
+
</file>
|
|
3490
|
+
|
|
3491
|
+
<file path="tsconfig.json">
|
|
3492
|
+
{
|
|
3493
|
+
"extends": "@treenity/tsconfig/react-library.json",
|
|
3494
|
+
"include": ["src"],
|
|
3495
|
+
"skipLibCheck": true,
|
|
3496
|
+
"compilerOptions": {
|
|
3497
|
+
"paths": {
|
|
3498
|
+
"@/*": ["./src/*"]
|
|
3499
|
+
},
|
|
3500
|
+
"plugins": [
|
|
3501
|
+
{
|
|
3502
|
+
"name": "typescript-plugin-css-modules"
|
|
3503
|
+
}
|
|
3504
|
+
]
|
|
3505
|
+
}
|
|
3506
|
+
}
|
|
3507
|
+
</file>
|
|
3508
|
+
|
|
3509
|
+
</files>
|